mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
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:
parent
2b5e892d60
commit
fdad701e3f
@ -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)
|
||||
|
@ -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.'''
|
||||
|
Loading…
Reference in New Issue
Block a user