[libvirt] [PATCH]: Implement ruby-libvirt storage pool discovery binding

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

 



Attached is a pretty simple patch to implement the
virConnectFindStoragePoolSources() binding for ruby-libvirt.This capability went
into libvirt-0.4.5, so any version of libvirt that has storage API support
should have support for this call.  There's not much more to say; it works in my
testing, and the implementation is pretty straightforward.

Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>
diff -r 543054386d15 ext/libvirt/_libvirt.c
--- a/ext/libvirt/_libvirt.c	Tue Aug 12 15:07:06 2008 -0700
+++ b/ext/libvirt/_libvirt.c	Thu Oct 23 10:03:08 2008 +0000
@@ -1307,6 +1292,25 @@
     _E(pool == NULL, create_error(e_DefinitionError, "virStoragePoolDefineXML", "", conn));
 
     return pool_new(pool, c);
+}
+
+/*
+ * Call +virConnectFindStoragePoolSources+[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectFindStoragePoolSources]
+ */
+VALUE libvirt_conn_find_storage_pool_sources(int argc, VALUE *argv, VALUE c) {
+    virConnectPtr conn = connect_get(c);
+    VALUE type, srcSpec_val, flags;
+    const char *srcSpec;
+
+    rb_scan_args(argc, argv, "12", &type, &srcSpec_val, &flags);
+
+    srcSpec = get_string_or_nil(srcSpec_val);
+
+    if (NIL_P(flags))
+        flags = INT2FIX(0);
+
+    gen_call_string(virConnectFindStoragePoolSources, conn, 1, conn,
+                    StringValueCStr(type), srcSpec, NUM2UINT(flags));
 }
 
 /*
@@ -1854,6 +1858,8 @@
                      libvirt_conn_create_pool_xml, -1);
     rb_define_method(c_connect, "define_storage_pool_xml",
                      libvirt_conn_define_pool_xml, -1);
+    rb_define_method(c_connect, "discover_storage_pool_sources",
+                     libvirt_conn_find_storage_pool_sources, -1);
 #endif
 
     /*
--
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]