From 786d8d91b446d306cd973f93a3fa56ca85a334c6 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Fri, 3 Feb 2017 17:01:31 +0100 Subject: [PATCH] qemuDomainDiskChainElement{Prepare,Revoke}: manage /dev entry Again, one missed bit. This time without this commit there is no /dev entry in the namespace of the qemu process when doing disk snapshots or block-copy. Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 5db8b60c50..9e34d73be8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5090,13 +5090,16 @@ qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver, virDomainObjPtr vm, virStorageSourcePtr elem) { + if (qemuTeardownImageCgroup(vm, elem) < 0) + VIR_WARN("Failed to teardown cgroup for disk path %s", + NULLSTR(elem->path)); + if (virSecurityManagerRestoreImageLabel(driver->securityManager, vm->def, elem) < 0) VIR_WARN("Unable to restore security label on %s", NULLSTR(elem->path)); - if (qemuTeardownImageCgroup(vm, elem) < 0) - VIR_WARN("Failed to teardown cgroup for disk path %s", - NULLSTR(elem->path)); + if (qemuDomainNamespaceTeardownDisk(driver, vm, elem) < 0) + VIR_WARN("Unable to remove /dev entry for %s", NULLSTR(elem->path)); if (virDomainLockImageDetach(driver->lockManager, vm, elem) < 0) VIR_WARN("Unable to release lock on %s", NULLSTR(elem->path)); @@ -5126,6 +5129,9 @@ qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver, if (virDomainLockImageAttach(driver->lockManager, cfg->uri, vm, elem) < 0) goto cleanup; + if (qemuDomainNamespaceSetupDisk(driver, vm, elem) < 0) + goto cleanup; + if (qemuSetupImageCgroup(vm, elem) < 0) goto cleanup;