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
This commit is contained in:
Demi Marie Obenour 2021-02-17 19:28:36 -05:00 committed by Demi Marie Obenour
parent 7b1b2672d0
commit 0c943dfcd6
No known key found for this signature in database
GPG Key ID: 28A45C93B0B5B6E0
2 changed files with 2 additions and 31 deletions

View File

@ -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:

View File

@ -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):