[Libvir] ruby binding patch

Vadim Zaliva lord at crocodile.org
Sat Mar 29 01:10:25 UTC 2008


On Mar 28, 2008, at 10:48, David Lutterkort wrote:
>      * there were no tests for the two new methods. In general, try to
>        add/expand the tests in tests/tc_connect.rb when you add to the
>        bindings, though that is highly dependent on what the test
>        driver supports. In this case though it was pretty easy.
>
> Thanks again for doing this, and I am looking forward to the
> virDomainPinVcpu patch.



Attached is a patch, implementing Domain.pin_vcpu method.
I have tested it locally and it works. Here is my test code:

require 'libvirt'

    conn = Libvirt::open("")
    dom = conn.lookup_domain_by_name("centos52")
    dom.pin_vcpu(0,[2,3])

After running it, I can verify via virsh that it does pin CPUs  
correctly:

virsh > vcpuinfo centos52
VCPU:           0
CPU:            2
State:          blocked
CPU time:       40.8s
CPU Affinity:   --yy

However, when I try this method from test/tc_connect.rb it fails:

# rake test
(in /home/lord/src/ruby-libvirt)
Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/ 
rake_test_loader
Started
libvir: error : this function is not supported by the hypervisor:  
virDomainPinVcpu
E....
Finished in 0.006319 seconds.

   1) Error:
test_domain(TestConnect):
SystemCallError: unknown error - libvir call virDomainPinVcpu failed
     ./tests/tc_connect.rb:113:in `pin_vcpu'
     ./tests/tc_connect.rb:113:in `test_domain'

5 tests, 60 assertions, 0 failures, 1 errors
rake aborted!
Command failed with status (1): [/usr/bin/ruby -Ilib:ext/libvirt "/usr/ 
lib/...]

(See full trace by running task with --trace)

I will appreciate if somebody could help me to figure out why it is  
happening.

I might need to implement couple more methods, so if there are any  
remarks on
my code, I will appreciate your feedback.

Sincerely,
Vadim

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pin_vcpu.patch
Type: application/octet-stream
Size: 2353 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20080328/e5427438/attachment-0001.obj>
-------------- next part --------------




--
"La perfection est atteinte non quand il ne reste rien a ajouter, mais
quand il ne reste rien a enlever."  (Antoine de Saint-Exupery)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1607 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20080328/e5427438/attachment-0001.p7s>


More information about the libvir-list mailing list