[PATCH 03/14] qemu: hotplug: Untangle cleanup paths in qemuDomainChangeEjectableMedia

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Avoid the "audit" label to simplify control flow.
---
 src/qemu/qemu_hotplug.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index f6e98b4..0ad467e 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -107,7 +107,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 */
@@ -127,7 +127,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
         virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                        _("Unable to eject media"));
         ret = -1;
-        goto audit;
+        goto error;
     }

     src = virDomainDiskGetSource(disk);
@@ -153,7 +153,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
                                      src, format);
         qemuDomainObjExitMonitor(driver, vm);
     }
- audit:
+
     virDomainAuditDisk(vm, origdisk->src, disk->src, "update", ret >= 0);

     if (ret < 0)
@@ -180,6 +180,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);
-- 
2.0.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]