A return code of say 1 from Perform is currently considered an error,
but it could also be passed simply to Finish. This makes the v2
protocol much more powerful.
* src/remote/remote_protocol.x (remote_domain_migrate_perform_ret): New.
* src/qemu/qemu_driver.c (qemudDomainMigrateFinish2): Succeed if
qemudDomainMigratePerform returned a non-zero but positive value.
* daemon/remote.c (remoteDispatchDomainMigratePerform): Adjust for
remote_domain_migrate_perform_ret.
* daemon/remote_dispatch_prototypes.h: Regenerate.
* daemon/remote_dispatch_ret.h: Regenerate.
* daemon/remote_dispatch_table.h: Regenerate.
* src/remote/remote_driver.c (remoteDomainMigratePerform): Adjust for
remote_domain_migrate_perform_ret.
* src/remote/remote_protocol.c: Regenerate.
* src/remote/remote_protocol.h: Regenerate.
---
I'm including regenerated files to aid whoever commits the
patch.
daemon/remote.c | 3 ++-
daemon/remote_dispatch_prototypes.h | 2 +-
daemon/remote_dispatch_ret.h | 1 +
daemon/remote_dispatch_table.h | 2 +-
src/qemu/qemu_driver.c | 2 +-
src/remote/remote_driver.c | 6 ++++--
src/remote/remote_protocol.c | 11 ++++++++++-
src/remote/remote_protocol.h | 7 +++++++
src/remote/remote_protocol.x | 4 ++++
9 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index ba97379..67e85a4 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1364,7 +1364,7 @@ remoteDispatchDomainMigratePerform (struct qemud_server *server
ATTRIBUTE_UNUSED
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_migrate_perform_args *args,
- void *ret ATTRIBUTE_UNUSED)
+ remote_domain_migrate_perform_ret *ret)
{
int r;
virDomainPtr dom;
@@ -1389,6 +1389,7 @@ remoteDispatchDomainMigratePerform (struct qemud_server *server
ATTRIBUTE_UNUSED
return -1;
}
+ ret->code = r;
return 0;
}
diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h
index 16e8bb0..ba22df5 100644
--- a/daemon/remote_dispatch_prototypes.h
+++ b/daemon/remote_dispatch_prototypes.h
@@ -281,7 +281,7 @@ static int remoteDispatchDomainMigratePerform(
remote_message_header *hdr,
remote_error *err,
remote_domain_migrate_perform_args *args,
- void *ret);
+ remote_domain_migrate_perform_ret *ret);
static int remoteDispatchDomainMigratePrepare(
struct qemud_server *server,
struct qemud_client *client,
diff --git a/daemon/remote_dispatch_ret.h b/daemon/remote_dispatch_ret.h
index 6ced13a..8c37917 100644
--- a/daemon/remote_dispatch_ret.h
+++ b/daemon/remote_dispatch_ret.h
@@ -39,6 +39,7 @@
remote_get_hostname_ret val_remote_get_hostname_ret;
remote_supports_feature_ret val_remote_supports_feature_ret;
remote_domain_migrate_prepare_ret val_remote_domain_migrate_prepare_ret;
+ remote_domain_migrate_perform_ret val_remote_domain_migrate_perform_ret;
remote_domain_migrate_finish_ret val_remote_domain_migrate_finish_ret;
remote_domain_block_stats_ret val_remote_domain_block_stats_ret;
remote_domain_interface_stats_ret val_remote_domain_interface_stats_ret;
diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h
index 6b5df80..d2e66d4 100644
--- a/daemon/remote_dispatch_table.h
+++ b/daemon/remote_dispatch_table.h
@@ -315,7 +315,7 @@
{ /* DomainMigratePerform => 62 */
.fn = (dispatch_fn) remoteDispatchDomainMigratePerform,
.args_filter = (xdrproc_t) xdr_remote_domain_migrate_perform_args,
- .ret_filter = (xdrproc_t) xdr_void,
+ .ret_filter = (xdrproc_t) xdr_remote_domain_migrate_perform_ret,
},
{ /* DomainMigrateFinish => 63 */
.fn = (dispatch_fn) remoteDispatchDomainMigrateFinish,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d0b2942..d2429de 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6128,7 +6128,7 @@ qemudDomainMigrateFinish2 (virConnectPtr dconn,
/* Did the migration go as planned? If yes, return the domain
* object, but if no, clean up the empty qemu process.
*/
- if (retcode == 0) {
+ if (retcode >= 0) {
dom = virGetDomain (dconn, vm->def->name, vm->def->uuid);
if (!(flags & VIR_MIGRATE_PAUSED)) {
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 731b213..5ad833b 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2577,6 +2577,7 @@ remoteDomainMigratePerform (virDomainPtr domain,
{
int rv = -1;
remote_domain_migrate_perform_args args;
+ remote_domain_migrate_perform_ret ret;
struct private_data *priv = domain->conn->privateData;
remoteDriverLock(priv);
@@ -2589,12 +2590,13 @@ remoteDomainMigratePerform (virDomainPtr domain,
args.dname = dname == NULL ? NULL : (char **) &dname;
args.resource = resource;
+ memset (&ret, 0, sizeof (ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PERFORM,
(xdrproc_t) xdr_remote_domain_migrate_perform_args, (char *) &args,
- (xdrproc_t) xdr_void, (char *) NULL) == -1)
+ (xdrproc_t) xdr_remote_domain_migrate_perform_ret, (char *) &ret) ==
-1)
goto done;
- rv = 0;
+ rv = ret.code;
done:
remoteDriverUnlock(priv);
diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c
index 1d2d242..0fab007 100644
--- a/src/remote/remote_protocol.c
+++ b/src/remote/remote_protocol.c
@@ -4,7 +4,7 @@
* It was generated using rpcgen.
*/
-#include "remote_protocol.h"
+#include "./remote/remote_protocol.h"
#include "internal.h"
#include <arpa/inet.h>
@@ -974,6 +974,15 @@ xdr_remote_domain_migrate_perform_args (XDR *xdrs,
remote_domain_migrate_perform
}
bool_t
+xdr_remote_domain_migrate_perform_ret (XDR *xdrs, remote_domain_migrate_perform_ret
*objp)
+{
+
+ if (!xdr_int (xdrs, &objp->code))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
xdr_remote_domain_migrate_finish_args (XDR *xdrs, remote_domain_migrate_finish_args
*objp)
{
char **objp_cpp0 = (char **) (void *) &objp->cookie.cookie_val;
diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h
index 64da9fa..85fb491 100644
--- a/src/remote/remote_protocol.h
+++ b/src/remote/remote_protocol.h
@@ -525,6 +525,11 @@ struct remote_domain_migrate_perform_args {
};
typedef struct remote_domain_migrate_perform_args remote_domain_migrate_perform_args;
+struct remote_domain_migrate_perform_ret {
+ int code;
+};
+typedef struct remote_domain_migrate_perform_ret remote_domain_migrate_perform_ret;
+
struct remote_domain_migrate_finish_args {
remote_nonnull_string dname;
struct {
@@ -1790,6 +1795,7 @@ extern bool_t xdr_remote_domain_dump_xml_ret (XDR *,
remote_domain_dump_xml_ret
extern bool_t xdr_remote_domain_migrate_prepare_args (XDR *,
remote_domain_migrate_prepare_args*);
extern bool_t xdr_remote_domain_migrate_prepare_ret (XDR *,
remote_domain_migrate_prepare_ret*);
extern bool_t xdr_remote_domain_migrate_perform_args (XDR *,
remote_domain_migrate_perform_args*);
+extern bool_t xdr_remote_domain_migrate_perform_ret (XDR *,
remote_domain_migrate_perform_ret*);
extern bool_t xdr_remote_domain_migrate_finish_args (XDR *,
remote_domain_migrate_finish_args*);
extern bool_t xdr_remote_domain_migrate_finish_ret (XDR *,
remote_domain_migrate_finish_ret*);
extern bool_t xdr_remote_domain_migrate_prepare2_args (XDR *,
remote_domain_migrate_prepare2_args*);
@@ -2044,6 +2050,7 @@ extern bool_t xdr_remote_domain_dump_xml_ret ();
extern bool_t xdr_remote_domain_migrate_prepare_args ();
extern bool_t xdr_remote_domain_migrate_prepare_ret ();
extern bool_t xdr_remote_domain_migrate_perform_args ();
+extern bool_t xdr_remote_domain_migrate_perform_ret ();
extern bool_t xdr_remote_domain_migrate_finish_args ();
extern bool_t xdr_remote_domain_migrate_finish_ret ();
extern bool_t xdr_remote_domain_migrate_prepare2_args ();
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 6b0a784..3c7873e 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -573,6 +573,10 @@ struct remote_domain_migrate_perform_args {
unsigned hyper resource;
};
+struct remote_domain_migrate_perform_ret {
+ int code;
+};
+
struct remote_domain_migrate_finish_args {
remote_nonnull_string dname;
opaque cookie<REMOTE_MIGRATE_COOKIE_MAX>;
--
1.6.2.5