Merge remote-tracking branch 'origin/pr/123'

* origin/pr/123:
  Add test for qvm-ls --all
  qvm-ls: don't exclude dom0 when using --all
This commit is contained in:
Marek Marczykowski-Górecki 2020-01-16 00:59:23 +01:00
commit de1969150d
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 18 additions and 1 deletions

View File

@ -120,7 +120,16 @@ class TC_50_List(qubesadmin.tests.QubesTestCase):
'dom0\n'
'test-vm\n')
def test_103_network_tree(self):
def test_103_list_all(self):
app = TestApp()
with qubesadmin.tests.tools.StdoutBuffer() as stdout:
qubesadmin.tools.qvm_ls.main(['--all'], app=app)
self.assertEqual(stdout.getvalue(),
'NAME STATE CLASS LABEL TEMPLATE NETVM\n'
'dom0 Running TestVM - - -\n'
'test-vm Running TestVM - - -\n')
def test_110_network_tree(self):
app = TestApp()
app.domains = TestVMCollection(
[

View File

@ -690,6 +690,14 @@ def main(args=None, app=None):
else:
domains = args.app.domains
if args.all_domains:
# Normally, --all means "all domains except for AdminVM".
# However, in the case of qvm-ls it does not make sense to exclude
# AdminVMs, so we override the list from parser.
domains = [
vm for vm in args.app.domains if vm.name not in args.exclude
]
if args.tags:
# filter only VMs having at least one of the specified tags
domains = [dom for dom in domains