mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-11-30 04:23:46 +03:00
python: add API exports for virConnectListAllDomains()
This patch adds export of the new API function virConnectListAllDomains() to the libvirt-python bindings. The virConnect object now has method "listAllDomains" that takes only the flags parameter and returns a python list of virDomain object corresponding to virDomainPtrs returned by the underlying api. The implementation is done manually as the generator does not support wrapping list of virDomainPtrs into virDomain objects.
This commit is contained in:
@@ -185,3 +185,15 @@
|
||||
raise libvirtError ('virConnectDomainEventRegisterAny() failed', conn=self)
|
||||
self.domainEventCallbackID[ret] = opaque
|
||||
return ret
|
||||
|
||||
def listAllDomains(self, flags):
|
||||
"""List all domains and returns a list of domain objects"""
|
||||
ret = libvirtmod.virConnectListAllDomains(self._o, flags)
|
||||
if ret is None:
|
||||
raise libvirtError("virConnectListAllDomains() failed", conn=self)
|
||||
|
||||
retlist = list()
|
||||
for domptr in ret:
|
||||
retlist.append(virDomain(self, _obj=domptr))
|
||||
|
||||
return retlist
|
||||
|
||||
Reference in New Issue
Block a user