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

[libvirt] Small patch for ruby-libvirt to add api wrapping for DomainAttachDevice and DomainDetachDevice



--- ext/libvirt/_libvirt.c.orig    2009-01-19 18:24:22.000000000 -0800
+++ ext/libvirt/_libvirt.c    2009-01-19 18:24:39.000000000 -0800
@@ -728,6 +728,21 @@
     gen_call_void(virDomainSave, conn(s),
                   domain_get(s), StringValueCStr(to));
 }
+/*
+ * Call +virDomainAttachDevice+[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainAttachDevice]
+ */
+VALUE libvirt_dom_attach_device_xml(VALUE s, VALUE xml) {
+    virDomainPtr dom = domain_get(s);
+    return virDomainAttachDevice(dom, StringValueCStr(xml));
+}
+
+/*
+ * Call +virDomainDetachDevice+[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainDetachDevice]
+ */
+VALUE libvirt_dom_detach_device_xml(VALUE s, VALUE xml) {
+    virDomainPtr dom = domain_get(s);
+    return virDomainDetachDevice(dom, StringValueCStr(xml));
+}

 /*
* Call +virDomainCoreDump+[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainCoreDump]
@@ -1921,7 +1936,8 @@
     rb_define_method(c_domain, "autostart", libvirt_dom_autostart, 0);
rb_define_method(c_domain, "autostart=", libvirt_dom_autostart_set, 1);
     rb_define_method(c_domain, "free", libvirt_dom_free, 0);
-
+ rb_define_method(c_domain, "attach_device", libvirt_dom_attach_device_xml, 1); + rb_define_method(c_domain, "detach_device", libvirt_dom_detach_device_xml, 1);
     /*
      * Class Libvirt::Domain::Info
      */


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