提交 240eb2fb 编写于 作者: P Peter Krempa

qemu: hotplug: Untangle cleanup paths in qemuDomainChangeEjectableMedia

Avoid the "audit" label to simplify control flow.
上级 1cc6bdc2
...@@ -108,7 +108,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, ...@@ -108,7 +108,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
qemuDomainObjExitMonitor(driver, vm); qemuDomainObjExitMonitor(driver, vm);
if (ret < 0) if (ret < 0)
goto audit; goto error;
virObjectRef(vm); virObjectRef(vm);
/* we don't want to report errors from media tray_open polling */ /* we don't want to report errors from media tray_open polling */
...@@ -128,7 +128,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, ...@@ -128,7 +128,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
virReportError(VIR_ERR_OPERATION_FAILED, "%s", virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Unable to eject media")); _("Unable to eject media"));
ret = -1; ret = -1;
goto audit; goto error;
} }
src = virDomainDiskGetSource(disk); src = virDomainDiskGetSource(disk);
...@@ -154,7 +154,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, ...@@ -154,7 +154,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
src, format); src, format);
qemuDomainObjExitMonitor(driver, vm); qemuDomainObjExitMonitor(driver, vm);
} }
audit:
virDomainAuditDisk(vm, origdisk->src, disk->src, "update", ret >= 0); virDomainAuditDisk(vm, origdisk->src, disk->src, "update", ret >= 0);
if (ret < 0) if (ret < 0)
...@@ -181,6 +181,8 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, ...@@ -181,6 +181,8 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
return ret; return ret;
error: error:
virDomainAuditDisk(vm, origdisk->src, disk->src, "update", false);
if (virSecurityManagerRestoreDiskLabel(driver->securityManager, if (virSecurityManagerRestoreDiskLabel(driver->securityManager,
vm->def, disk) < 0) vm->def, disk) < 0)
VIR_WARN("Unable to restore security label on new media %s", src); VIR_WARN("Unable to restore security label on new media %s", src);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册