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

Tatsuro Enokura fj7716hz at aa.jp.fujitsu.com
Tue Mar 13 09:38:56 UTC 2007


Hi,

When I used the lookupByName() function of libvirt.py, it failed with
the following error messages.

------
Traceback (most recent call last):
  File "./virt-install.mod", line 569, in <module>
    main()
  File "./virt-install.mod", line 499, in main
    guest, hvm, conn)
  File "./virt-install.mod", line 187, in get_disks
    disk, size)
  File "./virt-install.mod", line 186, in <lambda>
    map(lambda d, s: get_disk(d, s, sparse, guest, hvm, conn),
  File "./virt-install.mod", line 131, in get_disk
    vm = conn.lookupByName(name)
  File "/usr/lib/python2.5/site-packages/libvirt.py", line 483, in
lookupByName
    if ret is None:raise libvirtError('virNetworkLookupByName() failed',
conn=self)
libvirt.libvirtError: virNetworkLookupByName() failed
------

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.

Thanks,
Tatsuro Enokura

---
cat /usr/lib/python2.5/site-packages/libvirt.py
.. snip ..
    def lookupByName(self, name):
        """Try to lookup a domain on the given hypervisor based on its
           name. """
        ret = libvirtmod.virDomainLookupByName(self._o, name)
        if ret is None:raise libvirtError('virDomainLookupByName()
failed', conn=self)
        __tmp = virDomain(_obj=ret)
        __tmp.ref = self
        return __tmp

    def lookupByName(self, name):
        """Try to lookup a network on the given hypervisor based on
           its name. """
        ret = libvirtmod.virNetworkLookupByName(self._o, name)
        if ret is None:raise libvirtError('virNetworkLookupByName()
failed', conn=self)
        __tmp = virNetwork(_obj=ret)
        __tmp.ref = self
        return __tmp

    def lookupByUUIDString(self, uuidstr):
        """Try to lookup a network on the given hypervisor based on
           its UUID. """
        ret = libvirtmod.virNetworkLookupByUUIDString(self._o, uuidstr)
        if ret is None:raise
libvirtError('virNetworkLookupByUUIDString() failed', conn=self)
        __tmp = virNetwork(_obj=ret)
        __tmp.ref = self
        return __tmp

    def lookupByUUIDString(self, uuidstr):
        """Try to lookup a domain on the given hypervisor based on its
           UUID. """
        ret = libvirtmod.virDomainLookupByUUIDString(self._o, uuidstr)
        if ret is None:raise libvirtError('virDomainLookupByUUIDString()
failed', conn=self)
        __tmp = virDomain(_obj=ret)
        __tmp.ref = self
        return __tmp
.. snip ..
--








More information about the libvir-list mailing list