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

Re: [Libvir] libvirt.py has the two functions that names are the same.



Hi, Dan

Daniel Veillard wrote:
>> When I used the lookupByName() function of libvirt.py, it failed with
>> the following error messages.
> [...]
>> The lookupByName() function is the same name for domain and for
>>  network in libvirt.py. The lookupByUUIDstring() function is similar.
>>
>> I think that generator of libvirt.py's function is incorrect.
> 
>   Whoops ! That's nasty, I would have expected python to complain in case
> of double declaration of a method with same number of arguments, especially
> with a different content.
>   I fixed the generator so that the virNetworkLookup... functions are now
> mapped as networkLookup... methods, that should fix the problem !
> 
>   thanks for raising this, I commited the fix in CVS,

Thanks for fixing.
I try today's libvirt. The lookupBy..() methods is fine,
but the defineXML() method still have the same problem.

The attached patch adds to solve the problem.

Signed-off-by: Tatsuro Enokura <fj7716hz aa jp fujitsu com>

Thanks,
Tatsuro Enokura

Index: python/generator.py
===================================================================
RCS file: /data/cvs/libvirt/python/generator.py,v
retrieving revision 1.17
diff -u -p -r1.17 generator.py
--- python/generator.py 15 Mar 2007 15:23:21 -0000      1.17
+++ python/generator.py 16 Mar 2007 08:14:05 -0000
@@ -583,9 +583,12 @@ def nameFixup(name, classe, type, file):
     if name[0:l] == listname:
         func = name[l:]
         func = string.lower(func[0:1]) + func[1:]
+    elif name[0:16] == "virNetworkDefine":
+        func = name[3:]
+        func = string.lower(func[0:1]) + func[1:]
     elif name[0:16] == "virNetworkLookup":
-       func = name[3:]
-       func = string.lower(func[0:1]) + func[1:]
+        func = name[3:]
+        func = string.lower(func[0:1]) + func[1:]
     elif name[0:12] == "virDomainGet":
         func = name[12:]
         func = string.lower(func[0:1]) + func[1:]
====================================================================



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