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:
parent
7b1b2672d0
commit
0c943dfcd6
@ -30,19 +30,6 @@ import qubes
|
|||||||
import qubes.storage
|
import qubes.storage
|
||||||
import qubes.utils
|
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):
|
class ThinPool(qubes.storage.Pool):
|
||||||
''' LVM Thin based pool implementation
|
''' LVM Thin based pool implementation
|
||||||
|
|
||||||
@ -350,11 +337,6 @@ class ThinVolume(qubes.storage.Volume):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return self._size
|
return self._size
|
||||||
|
|
||||||
@size.setter
|
|
||||||
def size(self, _):
|
|
||||||
raise qubes.storage.StoragePoolException(
|
|
||||||
"You shouldn't use lvm size setter")
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def _reset(self):
|
def _reset(self):
|
||||||
''' Resets a volatile volume '''
|
''' Resets a volatile volume '''
|
||||||
@ -771,9 +753,6 @@ def _get_lvm_cmdline(cmd):
|
|||||||
lvm_cmd = ['lvrename', cmd[1], cmd[2]]
|
lvm_cmd = ['lvrename', cmd[1], cmd[2]]
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError('unsupported action: ' + action)
|
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:
|
if os.getuid() != 0:
|
||||||
cmd = ['sudo', 'lvm'] + lvm_cmd
|
cmd = ['sudo', 'lvm'] + lvm_cmd
|
||||||
else:
|
else:
|
||||||
|
@ -289,14 +289,6 @@ class TC_00_ThinPool(ThinPoolBase):
|
|||||||
|
|
||||||
def _get_lv_origin_uuid(self, lv):
|
def _get_lv_origin_uuid(self, lv):
|
||||||
sudo = [] if os.getuid() == 0 else ['sudo']
|
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(
|
lvs_output = subprocess.check_output(
|
||||||
sudo + ['lvs', '--noheadings', '-o', 'origin_uuid', lv])
|
sudo + ['lvs', '--noheadings', '-o', 'origin_uuid', lv])
|
||||||
return lvs_output.strip()
|
return lvs_output.strip()
|
||||||
|
Loading…
Reference in New Issue
Block a user