Fix impl of virDomainCreateWithFlags remote client helper

In the following commit:

  commit 03d813bbcd
  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>
This commit is contained in:
Daniel P. Berrange 2013-07-12 11:56:00 +01:00
parent bfd663ef97
commit ddaf15d7a3

View 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: