diff --git a/qubesadmin/tests/tools/qvm_ls.py b/qubesadmin/tests/tools/qvm_ls.py index 79e029a..cd9bddb 100644 --- a/qubesadmin/tests/tools/qvm_ls.py +++ b/qubesadmin/tests/tools/qvm_ls.py @@ -82,9 +82,9 @@ class TC_50_List(qubesadmin.tests.QubesTestCase): with qubesadmin.tests.tools.StdoutBuffer() as stdout: qubesadmin.tools.qvm_ls.main([], app=app) self.assertEqual(stdout.getvalue(), - 'NAME STATUS LABEL TEMPLATE NETVM\n' - 'dom0 -r------ black - -\n' - 'test-vm -r------ green template sys-net\n') + 'NAME STATE CLASS LABEL TEMPLATE NETVM\n' + 'dom0 Running TestVM black - -\n' + 'test-vm Running TestVM green template sys-net\n') class TC_90_List_with_qubesd_calls(qubesadmin.tests.QubesTestCase): @@ -110,13 +110,7 @@ class TC_90_List_with_qubesd_calls(qubesadmin.tests.QubesTestCase): 'label': b'type=label green', 'template': b'type=vm template1', 'netvm': b'type=vm sys-net', - 'updateable': b'type=bool False', - 'provides_network': b'type=bool False', - 'hvm': b'type=bool False', - 'installed_by_rpm': b'type=bool False', - 'internal': b'type=bool False', - 'debug': b'type=bool False', - 'autostart': b'type=bool False', +# 'hvm': b'type=bool False', } for key, value in props.items(): self.app.expected_calls[ @@ -125,7 +119,6 @@ class TC_90_List_with_qubesd_calls(qubesadmin.tests.QubesTestCase): # setup template1 props['label'] = b'type=label black' - props['updateable'] = b'type=bool True' for key, value in props.items(): self.app.expected_calls[ ('template1', 'admin.vm.property.Get', key, None)] = \ @@ -136,8 +129,6 @@ class TC_90_List_with_qubesd_calls(qubesadmin.tests.QubesTestCase): # setup sys-net props['label'] = b'type=label red' - props['provides_network'] = b'type=bool True' - props['updateable'] = b'type=bool False' for key, value in props.items(): self.app.expected_calls[ ('sys-net', 'admin.vm.property.Get', key, None)] = \ @@ -146,8 +137,8 @@ class TC_90_List_with_qubesd_calls(qubesadmin.tests.QubesTestCase): with qubesadmin.tests.tools.StdoutBuffer() as stdout: qubesadmin.tools.qvm_ls.main([], app=self.app) self.assertEqual(stdout.getvalue(), - 'NAME STATUS LABEL TEMPLATE NETVM\n' - 'sys-net ar-N---- red template1 sys-net\n' - 'template1 t-U----- black - sys-net\n' - 'vm1 ar------ green template1 sys-net\n') + 'NAME STATE CLASS LABEL TEMPLATE NETVM\n' + 'sys-net Running AppVM red template1 sys-net\n' + 'template1 Halted TemplateVM black - sys-net\n' + 'vm1 Running AppVM green template1 sys-net\n') self.assertAllCalled() diff --git a/qubesadmin/tools/qvm_ls.py b/qubesadmin/tools/qvm_ls.py index a5326cc..acb074e 100644 --- a/qubesadmin/tools/qvm_ls.py +++ b/qubesadmin/tools/qvm_ls.py @@ -191,13 +191,13 @@ def simple_flag(field, letter, attr, doc=None): return helper -class StatusColumn(Column): +class FlagsColumn(Column): '''Some fancy flags that describe general status of the domain.''' # pylint: disable=no-self-use def __init__(self): - super(StatusColumn, self).__init__( - head='STATUS', + super(FlagsColumn, self).__init__( + head='FLAGS', doc=self.__class__.__doc__) @@ -333,6 +333,15 @@ def calc_used(vm, volume_name): # todo maxmem +Column('STATE', + attr=(lambda vm: vm.get_power_state()), + doc='Current power state.') + +Column('CLASS', + attr=(lambda vm: type(vm).__name__), + doc='Class of the qube.') + + Column('GATEWAY', attr='netvm.gateway', doc='Network gateway.') @@ -372,7 +381,7 @@ Column('ROOT-USED', doc='Disk utilisation by root image as a percentage of available space.') -StatusColumn() +FlagsColumn() class Table(object): @@ -421,11 +430,11 @@ class Table(object): #: Available formats. Feel free to plug your own one. formats = { - 'simple': ('name', 'status', 'label', 'template', 'netvm'), - 'network': ('name', 'status', 'netvm', 'ip', 'ipback', 'gateway'), - 'full': ('name', 'status', 'label', 'qid', 'xid', 'uuid'), -# 'perf': ('name', 'status', 'cpu', 'memory'), - 'disk': ('name', 'status', 'disk', + 'simple': ('name', 'state', 'class', 'label', 'template', 'netvm'), + 'network': ('name', 'state', 'netvm', 'ip', 'ipback', 'gateway'), + 'full': ('name', 'state', 'class', 'label', 'qid', 'xid', 'uuid'), +# 'perf': ('name', 'state', 'cpu', 'memory'), + 'disk': ('name', 'state', 'disk', 'priv-curr', 'priv-max', 'priv-used', 'root-curr', 'root-max', 'root-used'), }