From c5ed749c221381bea6089953b10c1adde95b4454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 13 Jan 2014 05:09:07 +0100 Subject: [PATCH] backups: make released block device visible to the block manager Devices used as part of other device (e.g. LUKS) are marked as unavailable. So after releasing the device it need to be discovered again. Unfortunately udev event isn't triggered on such occasion (only "remove" event for device-mapper dev). This patch triggers this event manually. --- qubesmanager/backup_utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qubesmanager/backup_utils.py b/qubesmanager/backup_utils.py index 49713ca..8225fbb 100644 --- a/qubesmanager/backup_utils.py +++ b/qubesmanager/backup_utils.py @@ -81,6 +81,15 @@ def detach_device(dialog, dev_name): with dialog.blk_manager.blk_lock: dialog.blk_manager.detach_device(dialog.vm, dev_name) dialog.blk_manager.update() + else: + # umount/LUKS remove do not trigger udev event on underlying device, + # so trigger it manually - to publish back as available device + subprocess.call(["sudo", "udevadm", "trigger", "--action=change", + "--subsystem-match=block", + "--sysname-match=%s" % dev_name.split(":")[1]]) + with dialog.blk_manager.blk_lock: + dialog.blk_manager.update() + def fill_appvms_list(dialog): dialog.appvm_combobox.clear()