Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
SUSE:SLE-12-SP2:Update
libvirt.6841
a7f84cb1-qemu-virtio-disk-error-cleanup.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File a7f84cb1-qemu-virtio-disk-error-cleanup.patch of Package libvirt.6841
commit a7f84cb1ee037c2ea6c803450eb692d8030b4227 Author: John Ferlan <jferlan@redhat.com> Date: Thu Jul 14 17:28:53 2016 -0400 qemu: Alter error path cleanup for qemuDomainAttachVirtioDiskDevice Based on recent review comment - rather than have a spate of goto failxxxx, change to a boolean based model. Ensures that the original error can be preserved and cleanup is a bit more orderly if more objects are added. Index: libvirt-2.0.0/src/qemu/qemu_hotplug.c =================================================================== --- libvirt-2.0.0.orig/src/qemu/qemu_hotplug.c +++ libvirt-2.0.0/src/qemu/qemu_hotplug.c @@ -308,6 +308,7 @@ qemuDomainAttachVirtioDiskDevice(virConn char *drivestr = NULL; char *drivealias = NULL; bool releaseaddr = false; + bool driveAdded = false; virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); const char *src = virDomainDiskGetSource(disk); @@ -354,18 +355,18 @@ qemuDomainAttachVirtioDiskDevice(virConn if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0) goto error; - /* Attach the device - 2 step process */ qemuDomainObjEnterMonitor(driver, vm); if (qemuMonitorAddDrive(priv->mon, drivestr) < 0) - goto failadddrive; + goto exit_monitor; + driveAdded = true; if (qemuMonitorAddDevice(priv->mon, devstr) < 0) - goto failadddevice; + goto exit_monitor; if (qemuDomainObjExitMonitor(driver, vm) < 0) { releaseaddr = false; - goto failexitmonitor; + goto error; } virDomainAuditDisk(vm, NULL, disk->src, "attach", true); @@ -381,9 +382,9 @@ qemuDomainAttachVirtioDiskDevice(virConn virObjectUnref(cfg); return ret; - failadddevice: + exit_monitor: orig_err = virSaveLastError(); - if (qemuMonitorDriveDel(priv->mon, drivealias) < 0) { + if (driveAdded && qemuMonitorDriveDel(priv->mon, drivealias) < 0) { VIR_WARN("Unable to remove drive %s (%s) after failed " "qemuMonitorAddDevice", drivealias, drivestr); } @@ -391,12 +392,9 @@ qemuDomainAttachVirtioDiskDevice(virConn virSetError(orig_err); virFreeError(orig_err); } - - failadddrive: if (qemuDomainObjExitMonitor(driver, vm) < 0) releaseaddr = false; - failexitmonitor: virDomainAuditDisk(vm, NULL, disk->src, "attach", false); error:
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor