Merge remote-tracking branch 'origin/pr/267'
* origin/pr/267: lvm: run blkdiscard before remove
This commit is contained in:
commit
d5bdb5d5e0
@ -806,9 +806,16 @@ def qubes_lvm_coro(cmd, log=logging.getLogger('qubes.storage.lvm')):
|
|||||||
''' Call :program:`lvm` to execute an LVM operation
|
''' Call :program:`lvm` to execute an LVM operation
|
||||||
|
|
||||||
Coroutine version of :py:func:`qubes_lvm`'''
|
Coroutine version of :py:func:`qubes_lvm`'''
|
||||||
cmd = _get_lvm_cmdline(cmd)
|
|
||||||
environ = os.environ.copy()
|
environ = os.environ.copy()
|
||||||
environ['LC_ALL'] = 'C.utf8'
|
environ['LC_ALL'] = 'C.utf8'
|
||||||
|
if cmd[0] == "remove":
|
||||||
|
pre_cmd = ['blkdiscard', '/dev/'+cmd[1]]
|
||||||
|
p = yield from asyncio.create_subprocess_exec(*pre_cmd,
|
||||||
|
stdout=subprocess.DEVNULL,
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
close_fds=True, env=environ)
|
||||||
|
_, _ = yield from p.communicate()
|
||||||
|
cmd = _get_lvm_cmdline(cmd)
|
||||||
p = yield from asyncio.create_subprocess_exec(*cmd,
|
p = yield from asyncio.create_subprocess_exec(*cmd,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
|
Loading…
Reference in New Issue
Block a user