Hum, I saw now reply and don't see this in git, Chris did you had a look at those two patches ? Daniel On Fri, May 21, 2010 at 04:05:35AM +0200, Jaromír Červenka wrote: > Author is Michal Hrušecký <mhrusecky@xxxxxxx>. > > He was unsure about second patch, maybe adds duplicate functionality, > please check it. > > Greetings, Jaromir. > # HG changeset patch > # User Michal Hrusecky <Michal@xxxxxxxxxxxx> > # Date 1274020848 -7200 > # Node ID 60251582f566d956fb4e70ec813496bd7378e780 > # Parent b34ab097189e6b0e7ca339f3c92763838480fa32 > Add support for virNodeGetFreeMemory function > > This function is supported by library but currently not supported by ruby > interface. This patch adds desired functionality. > > diff -r b34ab097189e -r 60251582f566 ext/libvirt/_libvirt.c > --- a/ext/libvirt/_libvirt.c Fri Dec 18 13:43:50 2009 -0800 > +++ b/ext/libvirt/_libvirt.c Sun May 16 16:40:48 2010 +0200 > @@ -521,6 +521,20 @@ > } > > /* > + * Call +virNodeGetFreeMemory+[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeGetFreeMemory] > + */ > +VALUE libvirt_conn_node_get_free_memory(VALUE s){ > + virConnectPtr conn = connect_get(s); > + unsigned long long mem; > + > + mem = virNodeGetFreeMemory(conn); > + _E(mem == 0, create_error(e_RetrieveError, "virNodeGetFreeMemory", "", conn)); > + > + return ULL2NUM(mem); > +} > + > + > +/* > * Call +virConnectGetCapabilities+[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectGetCapabilities] > */ > VALUE libvirt_conn_capabilities(VALUE s) { > @@ -1848,6 +1862,7 @@ > rb_define_method(c_connect, "uri", libvirt_conn_uri, 0); > rb_define_method(c_connect, "max_vcpus", libvirt_conn_max_vcpus, 1); > rb_define_method(c_connect, "node_get_info", libvirt_conn_node_get_info, 0); > + rb_define_method(c_connect, "node_get_free_memory", libvirt_conn_node_get_free_memory, 0); > rb_define_method(c_connect, "capabilities", libvirt_conn_capabilities, 0); > rb_define_method(c_connect, "num_of_domains", libvirt_conn_num_of_domains, 0); > rb_define_method(c_connect, "list_domains", libvirt_conn_list_domains, 0); > diff -r b34ab097189e -r 60251582f566 tests/tc_connect.rb > --- a/tests/tc_connect.rb Fri Dec 18 13:43:50 2009 -0800 > +++ b/tests/tc_connect.rb Sun May 16 16:40:48 2010 +0200 > @@ -72,6 +72,10 @@ > assert_equal("i986", ni.model) > end > > + def test_node_free_memory > + assert_not_equal(0, connect.node_get_free_memory) > + end > + > def test_misc > c = connect > assert_equal("Test", c.type) > # HG changeset patch > # User Michal Hrusecky <Michal@xxxxxxxxxxxx> > # Date 1274025967 -7200 > # Node ID f91b7c036fecb0aa15b028a98b1f090b1e33df5b > # Parent 60251582f566d956fb4e70ec813496bd7378e780 > Add support for virGetLibVersion function > > This function is supported by library but currently not supported by ruby > interface. This patch adds desired functionality. > > diff -r 60251582f566 -r f91b7c036fec ext/libvirt/_libvirt.c > --- a/ext/libvirt/_libvirt.c Sun May 16 16:40:48 2010 +0200 > +++ b/ext/libvirt/_libvirt.c Sun May 16 18:06:07 2010 +0200 > @@ -534,6 +534,20 @@ > return ULL2NUM(mem); > } > > +/* > + * Call +virGetLibVersion+[http://www.libvirt.org/html/libvirt-libvirt.html#virGetLibVersion] > + */ > +VALUE libvirt_conn_get_lib_version(VALUE s){ > + virConnectPtr conn = connect_get(s); > + unsigned long version; > + int ret; > + > + ret = virConnectGetLibVersion(conn, &version); > + _E(ret < 0, create_error(e_RetrieveError, "virGetLibVersion", "", conn)); > + > + return ULONG2NUM(version); > +} > + > > /* > * Call +virConnectGetCapabilities+[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectGetCapabilities] > @@ -1859,6 +1872,7 @@ > rb_define_method(c_connect, "closed?", libvirt_conn_closed_p, 0); > rb_define_method(c_connect, "type", libvirt_conn_type, 0); > rb_define_method(c_connect, "version", libvirt_conn_version, 0); > + rb_define_method(c_connect, "get_lib_version", libvirt_conn_get_lib_version, 0); > rb_define_method(c_connect, "hostname", libvirt_conn_hostname, 0); > rb_define_method(c_connect, "uri", libvirt_conn_uri, 0); > rb_define_method(c_connect, "max_vcpus", libvirt_conn_max_vcpus, 1); > diff -r 60251582f566 -r f91b7c036fec tests/tc_connect.rb > --- a/tests/tc_connect.rb Sun May 16 16:40:48 2010 +0200 > +++ b/tests/tc_connect.rb Sun May 16 18:06:07 2010 +0200 > @@ -74,7 +74,12 @@ > > def test_node_free_memory > assert_not_equal(0, connect.node_get_free_memory) > + end > + > + def test_get_lib_version > + ver = connect.get_lib_version > + assert_not_equal(0, ver) > end > > def test_misc > -- > libvir-list mailing list > libvir-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/libvir-list -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@xxxxxxxxxxxx | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list