Ruby bindings for libvirt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am exploring the possibility of creating ruby bindings for libvirt. The only attempt I found after some searching is this:

  http://www.cs.ucsb.edu/~ckrintz/racelab/jisha/

Following the SWIG method as described in the above URL, I have gotten to the following point:

  [root@dell1 libvirt_ruby]# irb
  irb(main):001:0> require 'libvirt_ruby'
  => true
  irb(main):002:0> conn = Libvirt_ruby.virConnectOpenReadOnly("")
  => #<SWIG::TYPE_p__virConnect:0x2aaaaabc46c8>
  irb(main):003:0>  dom = Libvirt_ruby.virDomainLookupByID(conn, 0)
  => #<SWIG::TYPE_p__virDomain:0x2aaaaabb5df8>
  irb(main):004:0> ret = Libvirt_ruby.virDomainGetInfo(dom, info)
  NameError: undefined local variable or method `info' for main:Object
          from (irb):4
  irb(main):005:0>

I am not sure how to create and pass in a ptr to a virDomainInfo struct object into the virDomainGetInfo call within ruby.

Note that I was trying to following the info1.c example on the libvirt website:

  http://libvirt.org/examples/info1.c

As you can tell, this is the first time I am trying to create any sort of language bindings for a C library.

Some questions:

1. Is there a better way of creating ruby bindings for libvirt besides SWIG? If so, any pointers on what should be done?

2. Alternatively I can try to make my ruby code use libvirt-python bindings as a python library. Has anyone done so? Any problems with this approach?

cheers,
mengkuan

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]