Merge remote-tracking branch 'origin/pr/267'

* origin/pr/267:
  lvm: run blkdiscard before remove
This commit is contained in:
Marek Marczykowski-Górecki 2019-06-23 03:26:30 +02:00
commit d5bdb5d5e0
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

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