[libvirt] [PATCH 1/5] python: Don't generate conflicting conn.createXML functions.

Cole Robinson crobinso at redhat.com
Wed Sep 23 17:01:24 UTC 2009


A special case in the generator wasn't doing its job, and duplicate
conn.createXML functions were being generated. The bindings diff is:

$ diff -rup ../tmp libvirt.py
--- ../tmp  2009-09-23 11:57:11.649203000 -0400
+++ libvirt.py  2009-09-23 11:58:15.165391000 -0400
@@ -1079,14 +1079,6 @@ class virConnect:
         return __tmp

     def createXML(self, xmlDesc, flags):
-        """Create a new device on the VM host machine, for example,
-           virtual HBAs created using vport_create. """
-        ret = libvirtmod.virNodeDeviceCreateXML(self._o, xmlDesc, flags)
-        if ret is None:raise libvirtError('virNodeDeviceCreateXML() failed', conn=self)
-        __tmp = virNodeDevice(self, _obj=ret)
-        return __tmp
-
-    def createXML(self, xmlDesc, flags):
         """Launch a new guest domain, based on an XML description
           similar to the one returned by virDomainGetXMLDesc() This
           function may requires privileged access to the hypervisor.
@@ -1327,6 +1319,14 @@ class virConnect:
         __tmp = virNetwork(self, _obj=ret)
         return __tmp

+    def nodeDeviceCreateXML(self, xmlDesc, flags):
+        """Create a new device on the VM host machine, for example,
+           virtual HBAs created using vport_create. """
+        ret = libvirtmod.virNodeDeviceCreateXML(self._o, xmlDesc, flags)
+        if ret is None:raise libvirtError('virNodeDeviceCreateXML() failed', conn=self)
+        __tmp = virNodeDevice(self, _obj=ret)
+        return __tmp
+
     def nodeDeviceLookupByName(self, name):
         """Lookup a node device by its name. """
         ret = libvirtmod.virNodeDeviceLookupByName(self._o, name)

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 python/generator.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/python/generator.py b/python/generator.py
index ad9c544..2754be0 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -790,7 +790,7 @@ def nameFixup(name, classe, type, file):
     elif name[0:13] == "virNodeDevice":
         if name[13:16] == "Get":
             func = string.lower(name[16]) + name[17:]
-        elif name[13:19] == "Lookup" or name[13:] == "Create":
+        elif name[13:19] == "Lookup" or name[13:19] == "Create":
             func = string.lower(name[3]) + name[4:]
         else:
             func = string.lower(name[13]) + name[14:]
-- 
1.6.4.4




More information about the libvir-list mailing list