]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix impl of virDomainCreateWithFlags remote client helper
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 12 Jul 2013 10:56:00 +0000 (11:56 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 18 Jul 2013 10:01:49 +0000 (11:01 +0100)
In the following commit:

  commit 03d813bbcd7b4a18360105500672b84d985dd889
  Author: Marek Marczykowski <marmarek@invisiblethingslab.com>
  Date:   Thu May 23 02:01:30 2013 +0200

    remote: fix dom->id after virDomainCreateWithFlags

The virDomainCreateWithFlags remote client helper was made to
invoke REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID to refresh the 'id'
of the domain, following the pattern used in the previous
virDomainCreate method impl.

The remote protocol for virDomainCreateWithFlags though did
actually fix the design flaw in virDomainCreate, by directly
returning the new domain info. For some reason, this data was
never used. So we can just use that data now instead.

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

index 71c8e67c93d21866c0ff583d083dc94d92992b49..eb06bfdf6b9ec8e05d8fc35434caafcf0a2fbb38 100644 (file)
@@ -2415,8 +2415,7 @@ remoteDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
     int rv = -1;
     struct private_data *priv = dom->conn->privateData;
     remote_domain_create_with_flags_args args;
-    remote_domain_lookup_by_uuid_args args2;
-    remote_domain_lookup_by_uuid_ret ret2;
+    remote_domain_create_with_flags_args ret;
 
     remoteDriverLock(priv);
 
@@ -2425,23 +2424,12 @@ remoteDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
 
     if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS,
              (xdrproc_t)xdr_remote_domain_create_with_flags_args, (char *)&args,
-             (xdrproc_t)xdr_void, (char *)NULL) == -1) {
+             (xdrproc_t)xdr_remote_domain_create_with_flags_ret, (char *)&ret) == -1) {
         goto done;
     }
 
-    /* Need to do a lookup figure out ID of newly started guest, because
-     * bug in design of REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS means we aren't getting
-     * it returned.
-     */
-    memcpy(args2.uuid, dom->uuid, VIR_UUID_BUFLEN);
-    memset(&ret2, 0, sizeof(ret2));
-    if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID,
-             (xdrproc_t) xdr_remote_domain_lookup_by_uuid_args, (char *) &args2,
-             (xdrproc_t) xdr_remote_domain_lookup_by_uuid_ret, (char *) &ret2) == -1)
-        goto done;
-
-    dom->id = ret2.dom.id;
-    xdr_free((xdrproc_t) &xdr_remote_domain_lookup_by_uuid_ret, (char *) &ret2);
+    dom->id = ret.dom.id;
+    xdr_free((xdrproc_t) &xdr_remote_domain_create_with_flags_ret, (char *) &ret);
     rv = 0;
 
 done: