Filter of listed domains works again.

With the change to libvirtworker to re-use code from the GUI, the
specified filters for started/defined domains was lost. This patch
re-enables that functionality.
This commit is contained in:
Darryl L. Pierce 2011-05-23 17:47:20 -04:00 committed by Cole Robinson
parent 2b5e892d60
commit fdad701e3f
2 changed files with 14 additions and 5 deletions

View File

@ -167,10 +167,10 @@ class DomainListConfigScreen(ConfigScreen):
if self.__has_domains:
self.__domain_list = Listbox(0)
for uuid in domuuids:
dom = self.get_libvirt().get_domain(uuid)
domain = self.get_libvirt().get_domain(uuid)
# dom is a vmmDomain
self.__domain_list.append(dom.get_name(), dom)
self.__domain_list.append(domain.get_name(), domain)
result = [self.__domain_list]
else:
grid = Grid(1, 1)

View File

@ -120,11 +120,20 @@ class LibvirtWorker:
'''Returns the capabilities for this libvirt host.'''
return self.__capabilities
def list_domains(self, defined = True, started = True):
def list_domains(self, defined = True, created = True):
'''Lists all domains.'''
# XXX: This doesn't abide the passed parameters
self.__vmmconn.tick()
return self.__vmmconn.list_vm_uuids()
uuids = self.__vmmconn.list_vm_uuids()
result = []
for uuid in uuids:
include = False
domain = self.get_domain(uuid)
if domain.status() in [libvirt.VIR_DOMAIN_RUNNING]:
if created: include = True
else:
if defined: include = True
if include: result.append(uuid)
return result
def get_domain(self, uuid):
'''Returns the specified domain.'''