Browse Source

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
Demi Marie Obenour 3 years ago
parent
commit
0c943dfcd6
2 changed files with 2 additions and 31 deletions
  1. 0 21
      qubes/storage/lvm.py
  2. 2 10
      qubes/tests/storage_lvm.py

+ 0 - 21
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:

+ 2 - 10
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):