]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix autodestroy of QEMU guests
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 27 Feb 2013 16:23:16 +0000 (16:23 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 27 Feb 2013 22:51:24 +0000 (22:51 +0000)
The virQEMUCloseCallbacksRunOne method was passing a uuid string
to virDomainObjListFindByUUID, when it actually expected to get
a raw uuid buffer. This was not caught by the compiler because
the method was using a 'void *uuid' instead of first casting
it to the expected type.

This regression was accidentally caused by refactoring in

  commit 568a6cda277f04ab9baaeb97490e548b7b608aa6
  Author: Jiri Denemark <jdenemar@redhat.com>
  Date:   Fri Feb 15 15:11:47 2013 +0100

    qemu: Avoid deadlock in autodestroy

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/qemu/qemu_conf.c

index 4f0cb187ebd503108f2454b748a45694cde0cfdb..1cd4b7c6539a9c82ac7fc1b0dd0d15d5258a3e49 100644 (file)
@@ -805,22 +805,26 @@ struct virQEMUCloseCallbacksData {
 
 static void
 virQEMUCloseCallbacksRunOne(void *payload,
-                            const void *uuid,
+                            const void *key,
                             void *opaque)
 {
     struct virQEMUCloseCallbacksData *data = opaque;
     qemuDriverCloseDefPtr closeDef = payload;
     virDomainObjPtr dom;
+    const char *uuidstr = key;
+    unsigned char uuid[VIR_UUID_BUFLEN];
+
+    if (virUUIDParse(uuidstr, uuid) < 0)
+        return;
 
     VIR_DEBUG("conn=%p, thisconn=%p, uuid=%s, cb=%p",
-              closeDef->conn, data->conn, (const char *) uuid, closeDef->cb);
+              closeDef->conn, data->conn, uuidstr, closeDef->cb);
 
     if (data->conn != closeDef->conn || !closeDef->cb)
         return;
 
     if (!(dom = virDomainObjListFindByUUID(data->driver->domains, uuid))) {
-        VIR_DEBUG("No domain object with UUID %s",
-                  (const char *) uuid);
+        VIR_DEBUG("No domain object with UUID %s", uuidstr);
         return;
     }