Re: [libvirt] [PATCH] remote: fix dom-id after virDomainCreateWithFlags

2013-06-10 Thread Marek Marczykowski-Górecki
On 23.05.2013 15:19, Michal Privoznik wrote:
 On 23.05.2013 02:01, Marek Marczykowski wrote:
 The same issue as (already fixed) in virDomainCreate -
 REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS doesn't return new domain ID, only
 -1 on error or 0 on success.

 Besides this one fix it is more general problem - local domain object
 ID can desynchronize with the real one, for example in case of another
 client creates/destroys domain in the meantime. Perhaps virDomainGetID
 should be called remotely (with all performance implications...)? Or
 some event-based notification used?

 Signed-off-by: Marek Marczykowski marma...@invisiblethingslab.com
 ---
  src/remote/remote_driver.c   | 40 
  src/remote/remote_protocol.x |  2 +-
  2 files changed, 41 insertions(+), 1 deletion(-)
 
 ACKed and pushed. However, this deserves to be pushed into maint
 branches as well, doesn't it?

Yes, I think so.

-- 
Best Regards,
Marek Marczykowski
Invisible Things Lab



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] remote: fix dom-id after virDomainCreateWithFlags

2013-05-23 Thread Michal Privoznik
On 23.05.2013 02:01, Marek Marczykowski wrote:
 The same issue as (already fixed) in virDomainCreate -
 REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS doesn't return new domain ID, only
 -1 on error or 0 on success.
 
 Besides this one fix it is more general problem - local domain object
 ID can desynchronize with the real one, for example in case of another
 client creates/destroys domain in the meantime. Perhaps virDomainGetID
 should be called remotely (with all performance implications...)? Or
 some event-based notification used?
 
 Signed-off-by: Marek Marczykowski marma...@invisiblethingslab.com
 ---
  src/remote/remote_driver.c   | 40 
  src/remote/remote_protocol.x |  2 +-
  2 files changed, 41 insertions(+), 1 deletion(-)

ACKed and pushed. However, this deserves to be pushed into maint
branches as well, doesn't it?

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] remote: fix dom-id after virDomainCreateWithFlags

2013-05-22 Thread Marek Marczykowski
The same issue as (already fixed) in virDomainCreate -
REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS doesn't return new domain ID, only
-1 on error or 0 on success.

Besides this one fix it is more general problem - local domain object
ID can desynchronize with the real one, for example in case of another
client creates/destroys domain in the meantime. Perhaps virDomainGetID
should be called remotely (with all performance implications...)? Or
some event-based notification used?

Signed-off-by: Marek Marczykowski marma...@invisiblethingslab.com
---
 src/remote/remote_driver.c   | 40 
 src/remote/remote_protocol.x |  2 +-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index f66304c..0bbfc22 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2423,6 +2423,46 @@ done:
 return rv;
 }
 
+static int
+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;
+
+remoteDriverLock(priv);
+
+make_nonnull_domain(args.dom, dom);
+args.flags = 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) {
+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);
+rv = 0;
+
+done:
+remoteDriverUnlock(priv);
+return rv;
+}
+
 static char *
 remoteDomainGetSchedulerType(virDomainPtr domain, int *nparams)
 {
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 512ba2e..d2e0175 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -3875,7 +3875,7 @@ enum remote_procedure {
 REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON = 195,
 
 /**
- * @generate: both
+ * @generate: server
  */
 REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196,
 
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list