On 12/11/2012 11:48 AM, Peter Krempa wrote:
---
src/qemu/qemu_driver.c | 54 +++++++++++---------------------------------------
1 file changed, 12 insertions(+), 42 deletions(-)
Nice reduction in size. However, you need a v2...
@@ -3323,50 +3316,28 @@ cleanup:
static int
qemuDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
{
- virQEMUDriverPtr driver = dom->conn->privateData;
virDomainObjPtr vm = NULL;
- int ret = -1;
virCheckFlags(0, -1);
- qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
- if (!vm) {
- char uuidstr[VIR_UUID_STRING_BUFLEN];
- virUUIDFormat(dom->uuid, uuidstr);
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"),
uuidstr);
- goto cleanup;
- }
-
- ret = vm->hasManagedSave;
+ if (!(vm = qemuDomObjFromDomain(dom)))
+ return -1;
-cleanup:
- if (vm)
- virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
- return ret;
+ return vm->hasManagedSave;
}
Ouch. This leaves vm locked on exit. It needs to look more like:
if !(vm = qemuDomObjFromDomain(dom)))
return -1;
ret = vm->hasManagedSave;
virDomainObjUnlock(vm);
retun ret;
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org