mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: hotplug: Untangle cleanup paths in qemuDomainChangeEjectableMedia
Avoid the "audit" label to simplify control flow.
This commit is contained in:
parent
1cc6bdc2e6
commit
240eb2fb89
@ -108,7 +108,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
|
||||
qemuDomainObjExitMonitor(driver, vm);
|
||||
|
||||
if (ret < 0)
|
||||
goto audit;
|
||||
goto error;
|
||||
|
||||
virObjectRef(vm);
|
||||
/* we don't want to report errors from media tray_open polling */
|
||||
@ -128,7 +128,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
_("Unable to eject media"));
|
||||
ret = -1;
|
||||
goto audit;
|
||||
goto error;
|
||||
}
|
||||
|
||||
src = virDomainDiskGetSource(disk);
|
||||
@ -154,7 +154,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
|
||||
src, format);
|
||||
qemuDomainObjExitMonitor(driver, vm);
|
||||
}
|
||||
audit:
|
||||
|
||||
virDomainAuditDisk(vm, origdisk->src, disk->src, "update", ret >= 0);
|
||||
|
||||
if (ret < 0)
|
||||
@ -181,6 +181,8 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
|
||||
return ret;
|
||||
|
||||
error:
|
||||
virDomainAuditDisk(vm, origdisk->src, disk->src, "update", false);
|
||||
|
||||
if (virSecurityManagerRestoreDiskLabel(driver->securityManager,
|
||||
vm->def, disk) < 0)
|
||||
VIR_WARN("Unable to restore security label on new media %s", src);
|
||||
|
Loading…
x
Reference in New Issue
Block a user