On 18.06.2013 16:05, Jiri Denemark wrote:
This patch implements extensible variants of all internal migration APIs used for v3 migration. --- daemon/remote.c | 331 ++++++++++++++++++++++++++++++++++++++++++- docs/apibuild.py | 6 + docs/hvsupport.pl | 7 + src/driver.h | 67 +++++++++ src/libvirt.c | 324 ++++++++++++++++++++++++++++++++++++++++++ src/libvirt_internal.h | 54 +++++++ src/libvirt_private.syms | 6 + src/remote/remote_protocol.x | 96 ++++++++++++- src/remote_protocol-structs | 107 ++++++++++++++ 9 files changed, 996 insertions(+), 2 deletions(-)
+static int +remoteDispatchDomainMigratePrepareTunnel3Params( + virNetServerPtr server ATTRIBUTE_UNUSED, + virNetServerClientPtr client, + virNetMessagePtr msg ATTRIBUTE_UNUSED,
Drop ATTRIBUTE_UNUSED as @msg is clearly used ...
+ virNetMessageErrorPtr rerr, + remote_domain_migrate_prepare_tunnel3_params_args *args, + remote_domain_migrate_prepare_tunnel3_params_ret *ret) +{ + virTypedParameterPtr params = NULL; + int nparams = 0; + char *cookieout = NULL; + int cookieoutlen = 0; + int rv = -1; + struct daemonClientPrivate *priv = + virNetServerClientGetPrivateData(client); + virStreamPtr st = NULL; + daemonClientStreamPtr stream = NULL; + + if (!priv->conn) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + goto cleanup; + } + + if (!(params = remoteDeserializeTypedParameters(args->params.params_val, + args->params.params_len, + 0, &nparams))) + goto cleanup; + + if (!(st = virStreamNew(priv->conn, VIR_STREAM_NONBLOCK)) || + !(stream = daemonCreateClientStream(client, st, remoteProgram, + &msg->header)))
... here.
+ goto cleanup; + + if (virDomainMigratePrepareTunnel3Params(priv->conn, st, params, nparams, + args->cookie_in.cookie_in_val, + args->cookie_in.cookie_in_len, + &cookieout, &cookieoutlen, + args->flags) < 0) + goto cleanup; + + if (daemonAddClientStream(client, stream, false) < 0) + goto cleanup; + + ret->cookie_out.cookie_out_val = cookieout; + ret->cookie_out.cookie_out_len = cookieoutlen; + rv = 0; + +cleanup: + virTypedParamsFree(params, nparams); + if (rv < 0) { + virNetMessageSaveError(rerr); + VIR_FREE(cookieout); + if (stream) { + virStreamAbort(st); + daemonFreeClientStream(client, stream); + } else { + virStreamFree(st); + } + } + return rv; +} + +