From 0c943dfcd615bd3e7a212ffb3d402e604a841dcb Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Wed, 17 Feb 2021 19:28:36 -0500 Subject: [PATCH] Remove obsolete code no longer needed - We now use a newer LVM version in CI - Properties default to read-only in Python if no setter is provided --- qubes/storage/lvm.py | 21 --------------------- qubes/tests/storage_lvm.py | 12 ++---------- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/qubes/storage/lvm.py b/qubes/storage/lvm.py index d37dce17..c6d77dbf 100644 --- a/qubes/storage/lvm.py +++ b/qubes/storage/lvm.py @@ -30,19 +30,6 @@ import qubes import qubes.storage import qubes.utils - -def check_lvm_version(): - #Check if lvm is very very old, like in Travis-CI - try: - lvm_help = subprocess.check_output(['lvm', 'lvcreate', '--help'], - stderr=subprocess.DEVNULL).decode() - return '--setactivationskip' not in lvm_help - except (subprocess.CalledProcessError, FileNotFoundError): - pass - -lvm_is_very_old = check_lvm_version() - - class ThinPool(qubes.storage.Pool): ''' LVM Thin based pool implementation @@ -350,11 +337,6 @@ class ThinVolume(qubes.storage.Volume): except KeyError: return self._size - @size.setter - def size(self, _): - raise qubes.storage.StoragePoolException( - "You shouldn't use lvm size setter") - @asyncio.coroutine def _reset(self): ''' Resets a volatile volume ''' @@ -771,9 +753,6 @@ def _get_lvm_cmdline(cmd): lvm_cmd = ['lvrename', cmd[1], cmd[2]] else: raise NotImplementedError('unsupported action: ' + action) - if lvm_is_very_old: - # old lvm in trusty image used there does not support -k option - lvm_cmd = [x for x in lvm_cmd if x != '-kn'] if os.getuid() != 0: cmd = ['sudo', 'lvm'] + lvm_cmd else: diff --git a/qubes/tests/storage_lvm.py b/qubes/tests/storage_lvm.py index 9f2dea06..51e3f3f7 100644 --- a/qubes/tests/storage_lvm.py +++ b/qubes/tests/storage_lvm.py @@ -289,16 +289,8 @@ class TC_00_ThinPool(ThinPoolBase): def _get_lv_origin_uuid(self, lv): sudo = [] if os.getuid() == 0 else ['sudo'] - if qubes.storage.lvm.lvm_is_very_old: - # no support for origin_uuid directly - lvs_output = subprocess.check_output( - sudo + ['lvs', '--noheadings', '-o', 'origin', lv]) - lvs_output = subprocess.check_output( - sudo + ['lvs', '--noheadings', '-o', 'lv_uuid', - lv.rsplit('/', 1)[0] + '/' + lvs_output.strip().decode()]) - else: - lvs_output = subprocess.check_output( - sudo + ['lvs', '--noheadings', '-o', 'origin_uuid', lv]) + lvs_output = subprocess.check_output( + sudo + ['lvs', '--noheadings', '-o', 'origin_uuid', lv]) return lvs_output.strip() def test_008_commit(self):