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

[libvirt] [PATCH 3/6] Fix impl of virDomainCreateWithFlags remote client helper



From: "Daniel P. Berrange" <berrange redhat com>

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 | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index e2764e2..91ecfe5 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -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:
-- 
1.8.1.4


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