storage: drop 'internal' volume property

Since external block devices use Devices API now, it isn't useful
anymore.

QubesOS/qubes-issues#2256
This commit is contained in:
Marek Marczykowski-Górecki 2017-07-20 12:11:42 +02:00
parent c736395432
commit ae0729fb53
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
5 changed files with 6 additions and 29 deletions

View File

@ -34,7 +34,7 @@ Commands
list
^^^^
| :command:`qvm-volume list` [-h] [--verbose] [--quiet] [-p *POOL_NAME*] [-i] [*VMNAME* [*VMNAME* ...]]
| :command:`qvm-volume list` [-h] [--verbose] [--quiet] [-p *POOL_NAME*] [*VMNAME* [*VMNAME* ...]]
List block devices. By default the internal devices are hidden. When the
stdout is connected to a TTY `qvm-volume list` will print a pretty table by
@ -45,10 +45,6 @@ passed or stdout is redirected to a pipe or file.
list volumes from specified pool
.. option:: -i, --internal
list internal devices
.. option:: --full
print domain names

View File

@ -165,12 +165,6 @@ class Volume(object):
return self._info['source']
return None
@property
def internal(self):
'''If `True` volume is hidden when qvm-block is used'''
self._fetch_info()
return self._info['internal'] == 'True'
@property
def revisions_to_keep(self):
'''Number of revisions to keep around'''

View File

@ -43,7 +43,6 @@ class TestVMVolume(qubesadmin.tests.QubesTestCase):
b'snap_on_start=True\n' \
b'save_on_stop=True\n' \
b'source=\n' \
b'internal=True\n' \
b'revisions_to_keep=3\n'
def test_000_qubesd_call(self):
@ -110,11 +109,6 @@ class TestVMVolume(qubesadmin.tests.QubesTestCase):
self.assertEqual(self.vol.source, 'test-pool:other-id')
self.assertAllCalled()
def test_019_internal(self):
self.expect_info()
self.assertEqual(self.vol.internal, True)
self.assertAllCalled()
def test_020_revisions_to_keep(self):
self.expect_info()
self.assertEqual(self.vol.revisions_to_keep, 3)
@ -205,7 +199,6 @@ class TestPoolVolume(TestVMVolume):
b'snap_on_start=True\n' \
b'save_on_stop=True\n' \
b'source=\n' \
b'internal=True\n' \
b'revisions_to_keep=3\n'
def test_001_fetch_info(self):

View File

@ -38,7 +38,6 @@ class TC_00_qvm_volume(qubesadmin.tests.QubesTestCase):
(b'pool=pool-file\n' if vol == 'root' else
b'pool=other-pool\n') + \
b'vid=' + vm.encode() + b'-' + vol.encode() + b'\n' \
b'internal=True\n' \
b'size=10737418240\n'
self.app.expected_calls[
(vm, 'admin.vm.volume.ListSnapshots', vol, None)] = \
@ -51,7 +50,7 @@ class TC_00_qvm_volume(qubesadmin.tests.QubesTestCase):
self.setup_expected_calls_for_list()
with qubesadmin.tests.tools.StdoutBuffer() as stdout:
self.assertEqual(0,
qubesadmin.tools.qvm_volume.main(['ls', '-i'], app=self.app))
qubesadmin.tools.qvm_volume.main(['ls'], app=self.app))
self.assertEqual(stdout.getvalue(),
'POOL:VOLUME VMNAME VOLUME_NAME '
'REVERT_POSSIBLE\n'
@ -66,7 +65,7 @@ class TC_00_qvm_volume(qubesadmin.tests.QubesTestCase):
self.setup_expected_calls_for_list(vms=('vm1',))
with qubesadmin.tests.tools.StdoutBuffer() as stdout:
self.assertEqual(0,
qubesadmin.tools.qvm_volume.main(['ls', '-i', 'vm1'],
qubesadmin.tools.qvm_volume.main(['ls', 'vm1'],
app=self.app))
self.assertEqual(stdout.getvalue(),
'POOL:VOLUME VMNAME VOLUME_NAME REVERT_POSSIBLE\n'
@ -84,7 +83,7 @@ class TC_00_qvm_volume(qubesadmin.tests.QubesTestCase):
with qubesadmin.tests.tools.StdoutBuffer() as stdout:
self.assertEqual(0,
qubesadmin.tools.qvm_volume.main(
['ls', '-i', '-p', 'pool-file', 'vm1'],
['ls', '-p', 'pool-file', 'vm1'],
app=self.app))
self.assertEqual(stdout.getvalue(),
'POOL:VOLUME VMNAME VOLUME_NAME REVERT_POSSIBLE\n'
@ -104,7 +103,7 @@ class TC_00_qvm_volume(qubesadmin.tests.QubesTestCase):
with qubesadmin.tests.tools.StdoutBuffer() as stdout:
self.assertEqual(0,
qubesadmin.tools.qvm_volume.main(
['ls', '-i', '-p', 'pool-file'],
['ls', '-p', 'pool-file'],
app=self.app))
self.assertEqual(stdout.getvalue(),
'POOL:VOLUME VMNAME VOLUME_NAME REVERT_POSSIBLE\n'
@ -123,7 +122,7 @@ class TC_00_qvm_volume(qubesadmin.tests.QubesTestCase):
with qubesadmin.tests.tools.StdoutBuffer() as stdout:
self.assertEqual(0,
qubesadmin.tools.qvm_volume.main(
['ls', '-i', 'vm1', 'vm2'], app=self.app))
['ls', 'vm1', 'vm2'], app=self.app))
self.assertEqual(stdout.getvalue(),
'POOL:VOLUME VMNAME VOLUME_NAME REVERT_POSSIBLE\n'
'other-pool:vm1-private vm1 private Yes\n'

View File

@ -99,9 +99,6 @@ def list_volumes(args):
# only specified pools
volumes = [v for v in volumes if v.pool in args.pools]
if not args.internal: # hide internal volumes
volumes = [v for v in volumes if not v.internal]
vd_dict = {}
for volume in volumes:
volume_data = VolumeData(volume)
@ -160,8 +157,6 @@ def init_list_parser(sub_parsers):
help='list storage volumes')
list_parser.add_argument('-p', '--pool', dest='pools',
action=qubesadmin.tools.PoolsAction)
list_parser.add_argument('-i', '--internal', action='store_true',
help='Show internal volumes')
list_parser.add_argument(
'--full', action='store_true',
help='print full line for each POOL_NAME:VOLUME_ID & vm combination')