提交 0a465238 编写于 作者: M Michal Privoznik

qemuDomainPrepareDisk: Fix ordering

The current ordering is as follows:
1) set label
2) create the device in namespace
3) allow device in the cgroup

While this might work for now, it will definitely not work if the
security driver would use transactions as in that case there
would be no device to relabel in the domain namespace as the
device is created in the second step.
Swap steps 1) and 2) to allow security driver to use more
transactions.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 6094169b
...@@ -110,14 +110,14 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver, ...@@ -110,14 +110,14 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver,
vm, disk) < 0) vm, disk) < 0)
goto cleanup; goto cleanup;
if (qemuSecuritySetDiskLabel(driver, vm, disk) < 0) if (qemuDomainNamespaceSetupDisk(driver, vm, disk) < 0)
goto rollback_lock; goto rollback_lock;
if (qemuDomainNamespaceSetupDisk(driver, vm, disk) < 0) if (qemuSecuritySetDiskLabel(driver, vm, disk) < 0)
goto rollback_label; goto rollback_namespace;
if (qemuSetupDiskCgroup(vm, disk) < 0) if (qemuSetupDiskCgroup(vm, disk) < 0)
goto rollback_namespace; goto rollback_label;
ret = 0; ret = 0;
goto cleanup; goto cleanup;
...@@ -126,16 +126,16 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver, ...@@ -126,16 +126,16 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver,
if (qemuTeardownDiskCgroup(vm, disk) < 0) if (qemuTeardownDiskCgroup(vm, disk) < 0)
VIR_WARN("Unable to tear down cgroup access on %s", VIR_WARN("Unable to tear down cgroup access on %s",
virDomainDiskGetSource(disk)); virDomainDiskGetSource(disk));
rollback_namespace:
if (qemuDomainNamespaceTeardownDisk(driver, vm, disk) < 0)
VIR_WARN("Unable to remove /dev entry for %s",
virDomainDiskGetSource(disk));
rollback_label: rollback_label:
if (qemuSecurityRestoreDiskLabel(driver, vm, disk) < 0) if (qemuSecurityRestoreDiskLabel(driver, vm, disk) < 0)
VIR_WARN("Unable to restore security label on %s", VIR_WARN("Unable to restore security label on %s",
virDomainDiskGetSource(disk)); virDomainDiskGetSource(disk));
rollback_namespace:
if (qemuDomainNamespaceTeardownDisk(driver, vm, disk) < 0)
VIR_WARN("Unable to remove /dev entry for %s",
virDomainDiskGetSource(disk));
rollback_lock: rollback_lock:
if (virDomainLockDiskDetach(driver->lockManager, vm, disk) < 0) if (virDomainLockDiskDetach(driver->lockManager, vm, disk) < 0)
VIR_WARN("Unable to release lock on %s", VIR_WARN("Unable to release lock on %s",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册