mirror of https://gitee.com/openkylin/libvirt.git
New internal migration APIs with extensible parameters
This patch implements extensible variants of all internal migration APIs used for v3 migration.
This commit is contained in:
parent
81709832ab
commit
c0762b6518
331
daemon/remote.c
331
daemon/remote.c
|
@ -885,7 +885,7 @@ remoteDeserializeTypedParameters(remote_typed_param *args_params_val,
|
|||
virTypedParameterPtr params = NULL;
|
||||
|
||||
/* Check the length of the returned list carefully. */
|
||||
if (args_params_len > limit) {
|
||||
if (limit && args_params_len > limit) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -4677,6 +4677,335 @@ cleanup:
|
|||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDispatchDomainMigrateBegin3Params(
|
||||
virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
||||
virNetMessagePtr msg ATTRIBUTE_UNUSED,
|
||||
virNetMessageErrorPtr rerr,
|
||||
remote_domain_migrate_begin3_params_args *args,
|
||||
remote_domain_migrate_begin3_params_ret *ret)
|
||||
{
|
||||
char *xml = NULL;
|
||||
virDomainPtr dom = NULL;
|
||||
virTypedParameterPtr params = NULL;
|
||||
int nparams = 0;
|
||||
char *cookieout = NULL;
|
||||
int cookieoutlen = 0;
|
||||
int rv = -1;
|
||||
struct daemonClientPrivate *priv =
|
||||
virNetServerClientGetPrivateData(client);
|
||||
|
||||
if (!priv->conn) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(params = remoteDeserializeTypedParameters(args->params.params_val,
|
||||
args->params.params_len,
|
||||
0, &nparams)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(xml = virDomainMigrateBegin3Params(dom, params, nparams,
|
||||
&cookieout, &cookieoutlen,
|
||||
args->flags)))
|
||||
goto cleanup;
|
||||
|
||||
ret->cookie_out.cookie_out_len = cookieoutlen;
|
||||
ret->cookie_out.cookie_out_val = cookieout;
|
||||
ret->xml = xml;
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
virTypedParamsFree(params, nparams);
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
if (dom)
|
||||
virDomainFree(dom);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDispatchDomainMigratePrepare3Params(
|
||||
virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
||||
virNetMessagePtr msg ATTRIBUTE_UNUSED,
|
||||
virNetMessageErrorPtr rerr,
|
||||
remote_domain_migrate_prepare3_params_args *args,
|
||||
remote_domain_migrate_prepare3_params_ret *ret)
|
||||
{
|
||||
virTypedParameterPtr params = NULL;
|
||||
int nparams = 0;
|
||||
char *cookieout = NULL;
|
||||
int cookieoutlen = 0;
|
||||
char **uri_out;
|
||||
int rv = -1;
|
||||
struct daemonClientPrivate *priv =
|
||||
virNetServerClientGetPrivateData(client);
|
||||
|
||||
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;
|
||||
|
||||
/* Wacky world of XDR ... */
|
||||
if (VIR_ALLOC(uri_out) < 0) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virDomainMigratePrepare3Params(priv->conn, params, nparams,
|
||||
args->cookie_in.cookie_in_val,
|
||||
args->cookie_in.cookie_in_len,
|
||||
&cookieout, &cookieoutlen,
|
||||
uri_out, args->flags) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret->cookie_out.cookie_out_len = cookieoutlen;
|
||||
ret->cookie_out.cookie_out_val = cookieout;
|
||||
ret->uri_out = !*uri_out ? NULL : uri_out;
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
virTypedParamsFree(params, nparams);
|
||||
if (rv < 0) {
|
||||
virNetMessageSaveError(rerr);
|
||||
VIR_FREE(uri_out);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDispatchDomainMigratePrepareTunnel3Params(
|
||||
virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
virNetServerClientPtr client,
|
||||
virNetMessagePtr msg,
|
||||
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)))
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDispatchDomainMigratePerform3Params(
|
||||
virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
||||
virNetMessagePtr msg ATTRIBUTE_UNUSED,
|
||||
virNetMessageErrorPtr rerr,
|
||||
remote_domain_migrate_perform3_params_args *args,
|
||||
remote_domain_migrate_perform3_params_ret *ret)
|
||||
{
|
||||
virTypedParameterPtr params = NULL;
|
||||
int nparams = 0;
|
||||
virDomainPtr dom = NULL;
|
||||
char *cookieout = NULL;
|
||||
int cookieoutlen = 0;
|
||||
char *dconnuri;
|
||||
int rv = -1;
|
||||
struct daemonClientPrivate *priv =
|
||||
virNetServerClientGetPrivateData(client);
|
||||
|
||||
if (!priv->conn) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(params = remoteDeserializeTypedParameters(args->params.params_val,
|
||||
args->params.params_len,
|
||||
0, &nparams)))
|
||||
goto cleanup;
|
||||
|
||||
dconnuri = args->dconnuri == NULL ? NULL : *args->dconnuri;
|
||||
|
||||
if (virDomainMigratePerform3Params(dom, dconnuri, params, nparams,
|
||||
args->cookie_in.cookie_in_val,
|
||||
args->cookie_in.cookie_in_len,
|
||||
&cookieout, &cookieoutlen,
|
||||
args->flags) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret->cookie_out.cookie_out_len = cookieoutlen;
|
||||
ret->cookie_out.cookie_out_val = cookieout;
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
virTypedParamsFree(params, nparams);
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
if (dom)
|
||||
virDomainFree(dom);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDispatchDomainMigrateFinish3Params(
|
||||
virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
||||
virNetMessagePtr msg ATTRIBUTE_UNUSED,
|
||||
virNetMessageErrorPtr rerr,
|
||||
remote_domain_migrate_finish3_params_args *args,
|
||||
remote_domain_migrate_finish3_params_ret *ret)
|
||||
{
|
||||
virTypedParameterPtr params = NULL;
|
||||
int nparams = 0;
|
||||
virDomainPtr dom = NULL;
|
||||
char *cookieout = NULL;
|
||||
int cookieoutlen = 0;
|
||||
int rv = -1;
|
||||
struct daemonClientPrivate *priv =
|
||||
virNetServerClientGetPrivateData(client);
|
||||
|
||||
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;
|
||||
|
||||
dom = virDomainMigrateFinish3Params(priv->conn, params, nparams,
|
||||
args->cookie_in.cookie_in_val,
|
||||
args->cookie_in.cookie_in_len,
|
||||
&cookieout, &cookieoutlen,
|
||||
args->flags, args->cancelled);
|
||||
if (!dom)
|
||||
goto cleanup;
|
||||
|
||||
make_nonnull_domain(&ret->dom, dom);
|
||||
|
||||
ret->cookie_out.cookie_out_len = cookieoutlen;
|
||||
ret->cookie_out.cookie_out_val = cookieout;
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
virTypedParamsFree(params, nparams);
|
||||
if (rv < 0) {
|
||||
virNetMessageSaveError(rerr);
|
||||
VIR_FREE(cookieout);
|
||||
}
|
||||
if (dom)
|
||||
virDomainFree(dom);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDispatchDomainMigrateConfirm3Params(
|
||||
virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
||||
virNetMessagePtr msg ATTRIBUTE_UNUSED,
|
||||
virNetMessageErrorPtr rerr,
|
||||
remote_domain_migrate_confirm3_params_args *args)
|
||||
{
|
||||
virTypedParameterPtr params = NULL;
|
||||
int nparams = 0;
|
||||
virDomainPtr dom = NULL;
|
||||
int rv = -1;
|
||||
struct daemonClientPrivate *priv =
|
||||
virNetServerClientGetPrivateData(client);
|
||||
|
||||
if (!priv->conn) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(params = remoteDeserializeTypedParameters(args->params.params_val,
|
||||
args->params.params_len,
|
||||
0, &nparams)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainMigrateConfirm3Params(dom, params, nparams,
|
||||
args->cookie_in.cookie_in_val,
|
||||
args->cookie_in.cookie_in_len,
|
||||
args->flags, args->cancelled) < 0)
|
||||
goto cleanup;
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
virTypedParamsFree(params, nparams);
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
if (dom)
|
||||
virDomainFree(dom);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/*----- Helpers. -----*/
|
||||
|
||||
/* get_nonnull_domain and get_nonnull_network turn an on-wire
|
||||
|
|
|
@ -70,6 +70,12 @@ ignored_functions = {
|
|||
"virTypedParameterToString": "internal function in virtypedparam.c",
|
||||
"virTypedParamsCheck": "internal function in virtypedparam.c",
|
||||
"virTypedParamsCopy": "internal function in virtypedparam.c",
|
||||
"virDomainMigrateBegin3Params": "private function for migration",
|
||||
"virDomainMigrateFinish3Params": "private function for migration",
|
||||
"virDomainMigratePerform3Params": "private function for migration",
|
||||
"virDomainMigratePrepare3Params": "private function for migration",
|
||||
"virDomainMigrateConfirm3Params": "private function for migration",
|
||||
"virDomainMigratePrepareTunnel3Params": "private function for tunnelled migration",
|
||||
}
|
||||
|
||||
ignored_macros = {
|
||||
|
|
|
@ -169,6 +169,13 @@ $apis{virDomainMigratePerform3} = "0.9.2";
|
|||
$apis{virDomainMigrateFinish3} = "0.9.2";
|
||||
$apis{virDomainMigrateConfirm3} = "0.9.2";
|
||||
|
||||
$apis{virDomainMigrateBegin3Params} = "1.1.0";
|
||||
$apis{virDomainMigratePrepare3Params} = "1.1.0";
|
||||
$apis{virDomainMigratePrepareTunnel3Params} = "1.1.0";
|
||||
$apis{virDomainMigratePerform3Params} = "1.1.0";
|
||||
$apis{virDomainMigrateFinish3Params} = "1.1.0";
|
||||
$apis{virDomainMigrateConfirm3Params} = "1.1.0";
|
||||
|
||||
|
||||
|
||||
# Now we want to get the mapping between public APIs
|
||||
|
|
67
src/driver.h
67
src/driver.h
|
@ -1045,6 +1045,67 @@ typedef int
|
|||
int **fdlist,
|
||||
unsigned int flags);
|
||||
|
||||
typedef char *
|
||||
(*virDrvDomainMigrateBegin3Params)(virDomainPtr domain,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainMigratePrepare3Params)(virConnectPtr dconn,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
char **uri_out,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainMigratePrepareTunnel3Params)(virConnectPtr dconn,
|
||||
virStreamPtr st,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainMigratePerform3Params)(virDomainPtr dom,
|
||||
const char *dconnuri,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned int flags);
|
||||
|
||||
typedef virDomainPtr
|
||||
(*virDrvDomainMigrateFinish3Params)(virConnectPtr dconn,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned int flags,
|
||||
int cancelled);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainMigrateConfirm3Params)(virDomainPtr domain,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
unsigned int flags,
|
||||
int cancelled);
|
||||
|
||||
typedef struct _virDriver virDriver;
|
||||
typedef virDriver *virDriverPtr;
|
||||
|
||||
|
@ -1246,6 +1307,12 @@ struct _virDriver {
|
|||
virDrvDomainFSTrim domainFSTrim;
|
||||
virDrvDomainSendProcessSignal domainSendProcessSignal;
|
||||
virDrvDomainLxcOpenNamespace domainLxcOpenNamespace;
|
||||
virDrvDomainMigrateBegin3Params domainMigrateBegin3Params;
|
||||
virDrvDomainMigratePrepare3Params domainMigratePrepare3Params;
|
||||
virDrvDomainMigratePrepareTunnel3Params domainMigratePrepareTunnel3Params;
|
||||
virDrvDomainMigratePerform3Params domainMigratePerform3Params;
|
||||
virDrvDomainMigrateFinish3Params domainMigrateFinish3Params;
|
||||
virDrvDomainMigrateConfirm3Params domainMigrateConfirm3Params;
|
||||
};
|
||||
|
||||
|
||||
|
|
324
src/libvirt.c
324
src/libvirt.c
|
@ -6547,6 +6547,330 @@ error:
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Not for public use. This function is part of the internal
|
||||
* implementation of migration in the remote case.
|
||||
*/
|
||||
char *
|
||||
virDomainMigrateBegin3Params(virDomainPtr domain,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%d, "
|
||||
"cookieout=%p, cookieoutlen=%p, flags=%x",
|
||||
params, nparams, cookieout, cookieoutlen, flags);
|
||||
VIR_TYPED_PARAMS_DEBUG(params, nparams);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
||||
virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||
virDispatchError(NULL);
|
||||
return NULL;
|
||||
}
|
||||
conn = domain->conn;
|
||||
|
||||
if (domain->conn->flags & VIR_CONNECT_RO) {
|
||||
virLibDomainError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (conn->driver->domainMigrateBegin3Params) {
|
||||
char *xml;
|
||||
xml = conn->driver->domainMigrateBegin3Params(domain, params, nparams,
|
||||
cookieout, cookieoutlen,
|
||||
flags);
|
||||
VIR_DEBUG("xml %s", NULLSTR(xml));
|
||||
if (!xml)
|
||||
goto error;
|
||||
return xml;
|
||||
}
|
||||
|
||||
virLibDomainError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
|
||||
error:
|
||||
virDispatchError(domain->conn);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Not for public use. This function is part of the internal
|
||||
* implementation of migration in the remote case.
|
||||
*/
|
||||
int
|
||||
virDomainMigratePrepare3Params(virConnectPtr dconn,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
char **uri_out,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_DEBUG("dconn=%p, params=%p, nparams=%d, cookiein=%p, cookieinlen=%d, "
|
||||
"cookieout=%p, cookieoutlen=%p, uri_out=%p, flags=%x",
|
||||
dconn, params, nparams, cookiein, cookieinlen,
|
||||
cookieout, cookieoutlen, uri_out, flags);
|
||||
VIR_TYPED_PARAMS_DEBUG(params, nparams);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (!VIR_IS_CONNECT(dconn)) {
|
||||
virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
|
||||
virDispatchError(NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (dconn->flags & VIR_CONNECT_RO) {
|
||||
virLibConnError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (dconn->driver->domainMigratePrepare3Params) {
|
||||
int ret;
|
||||
ret = dconn->driver->domainMigratePrepare3Params(dconn, params, nparams,
|
||||
cookiein, cookieinlen,
|
||||
cookieout, cookieoutlen,
|
||||
uri_out, flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
|
||||
error:
|
||||
virDispatchError(dconn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Not for public use. This function is part of the internal
|
||||
* implementation of migration in the remote case.
|
||||
*/
|
||||
int
|
||||
virDomainMigratePrepareTunnel3Params(virConnectPtr conn,
|
||||
virStreamPtr st,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned int flags)
|
||||
|
||||
{
|
||||
VIR_DEBUG("conn=%p, stream=%p, params=%p, nparams=%d, cookiein=%p, "
|
||||
"cookieinlen=%d, cookieout=%p, cookieoutlen=%p, flags=%x",
|
||||
conn, st, params, nparams, cookiein, cookieinlen,
|
||||
cookieout, cookieoutlen, flags);
|
||||
VIR_TYPED_PARAMS_DEBUG(params, nparams);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (!VIR_IS_CONNECT(conn)) {
|
||||
virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
|
||||
virDispatchError(NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (conn->flags & VIR_CONNECT_RO) {
|
||||
virLibConnError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (conn != st->conn) {
|
||||
virReportInvalidArg(conn,
|
||||
_("conn in %s must match stream connection"),
|
||||
__FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (conn->driver->domainMigratePrepareTunnel3Params) {
|
||||
int rv;
|
||||
rv = conn->driver->domainMigratePrepareTunnel3Params(
|
||||
conn, st, params, nparams, cookiein, cookieinlen,
|
||||
cookieout, cookieoutlen, flags);
|
||||
if (rv < 0)
|
||||
goto error;
|
||||
return rv;
|
||||
}
|
||||
|
||||
virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
|
||||
error:
|
||||
virDispatchError(conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Not for public use. This function is part of the internal
|
||||
* implementation of migration in the remote case.
|
||||
*/
|
||||
int
|
||||
virDomainMigratePerform3Params(virDomainPtr domain,
|
||||
const char *dconnuri,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(domain, "dconnuri=%s, params=%p, nparams=%d, cookiein=%p, "
|
||||
"cookieinlen=%d, cookieout=%p, cookieoutlen=%p, flags=%x",
|
||||
NULLSTR(dconnuri), params, nparams, cookiein,
|
||||
cookieinlen, cookieout, cookieoutlen, flags);
|
||||
VIR_TYPED_PARAMS_DEBUG(params, nparams);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
||||
virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||
virDispatchError(NULL);
|
||||
return -1;
|
||||
}
|
||||
conn = domain->conn;
|
||||
|
||||
if (domain->conn->flags & VIR_CONNECT_RO) {
|
||||
virLibDomainError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (conn->driver->domainMigratePerform3Params) {
|
||||
int ret;
|
||||
ret = conn->driver->domainMigratePerform3Params(
|
||||
domain, dconnuri, params, nparams, cookiein, cookieinlen,
|
||||
cookieout, cookieoutlen, flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virLibDomainError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
|
||||
error:
|
||||
virDispatchError(domain->conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Not for public use. This function is part of the internal
|
||||
* implementation of migration in the remote case.
|
||||
*/
|
||||
virDomainPtr
|
||||
virDomainMigrateFinish3Params(virConnectPtr dconn,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned int flags,
|
||||
int cancelled)
|
||||
{
|
||||
VIR_DEBUG("dconn=%p, params=%p, nparams=%d, cookiein=%p, cookieinlen=%d, "
|
||||
"cookieout=%p, cookieoutlen=%p, flags=%x, cancelled=%d",
|
||||
dconn, params, nparams, cookiein, cookieinlen, cookieout,
|
||||
cookieoutlen, flags, cancelled);
|
||||
VIR_TYPED_PARAMS_DEBUG(params, nparams);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (!VIR_IS_CONNECT(dconn)) {
|
||||
virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
|
||||
virDispatchError(NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (dconn->flags & VIR_CONNECT_RO) {
|
||||
virLibConnError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (dconn->driver->domainMigrateFinish3Params) {
|
||||
virDomainPtr ret;
|
||||
ret = dconn->driver->domainMigrateFinish3Params(
|
||||
dconn, params, nparams, cookiein, cookieinlen,
|
||||
cookieout, cookieoutlen, flags, cancelled);
|
||||
if (!ret)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
|
||||
error:
|
||||
virDispatchError(dconn);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Not for public use. This function is part of the internal
|
||||
* implementation of migration in the remote case.
|
||||
*/
|
||||
int
|
||||
virDomainMigrateConfirm3Params(virDomainPtr domain,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
unsigned int flags,
|
||||
int cancelled)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%d, cookiein=%p, "
|
||||
"cookieinlen=%d, flags=%x, cancelled=%d",
|
||||
params, nparams, cookiein, cookieinlen, flags, cancelled);
|
||||
VIR_TYPED_PARAMS_DEBUG(params, nparams);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
||||
virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||
virDispatchError(NULL);
|
||||
return -1;
|
||||
}
|
||||
conn = domain->conn;
|
||||
|
||||
if (domain->conn->flags & VIR_CONNECT_RO) {
|
||||
virLibDomainError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (conn->driver->domainMigrateConfirm3Params) {
|
||||
int ret;
|
||||
ret = conn->driver->domainMigrateConfirm3Params(
|
||||
domain, params, nparams,
|
||||
cookiein, cookieinlen, flags, cancelled);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virLibDomainError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
|
||||
error:
|
||||
virDispatchError(domain->conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virNodeGetInfo:
|
||||
* @conn: pointer to the hypervisor connection
|
||||
|
|
|
@ -110,6 +110,11 @@ enum {
|
|||
* Support for offline migration.
|
||||
*/
|
||||
VIR_DRV_FEATURE_MIGRATION_OFFLINE = 12,
|
||||
|
||||
/*
|
||||
* Support for migration parameters.
|
||||
*/
|
||||
VIR_DRV_FEATURE_MIGRATION_PARAMS = 13,
|
||||
};
|
||||
|
||||
|
||||
|
@ -221,4 +226,58 @@ int virDomainMigrateConfirm3(virDomainPtr domain,
|
|||
unsigned long flags,
|
||||
int restart); /* Restart the src VM */
|
||||
|
||||
char *virDomainMigrateBegin3Params(virDomainPtr domain,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned int flags);
|
||||
|
||||
int virDomainMigratePrepare3Params(virConnectPtr dconn,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
char **uri_out,
|
||||
unsigned int flags);
|
||||
|
||||
int virDomainMigratePrepareTunnel3Params(virConnectPtr conn,
|
||||
virStreamPtr st,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned int flags);
|
||||
|
||||
int virDomainMigratePerform3Params(virDomainPtr domain,
|
||||
const char *dconnuri,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned int flags);
|
||||
|
||||
virDomainPtr virDomainMigrateFinish3Params(virConnectPtr dconn,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned int flags,
|
||||
int cancelled);
|
||||
|
||||
int virDomainMigrateConfirm3Params(virDomainPtr domain,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
unsigned int flags,
|
||||
int cancelled);
|
||||
#endif
|
||||
|
|
|
@ -746,17 +746,23 @@ virFDStreamSetIOHelper;
|
|||
# libvirt_internal.h
|
||||
virConnectSupportsFeature;
|
||||
virDomainMigrateBegin3;
|
||||
virDomainMigrateBegin3Params;
|
||||
virDomainMigrateConfirm3;
|
||||
virDomainMigrateConfirm3Params;
|
||||
virDomainMigrateFinish;
|
||||
virDomainMigrateFinish2;
|
||||
virDomainMigrateFinish3;
|
||||
virDomainMigrateFinish3Params;
|
||||
virDomainMigratePerform;
|
||||
virDomainMigratePerform3;
|
||||
virDomainMigratePerform3Params;
|
||||
virDomainMigratePrepare;
|
||||
virDomainMigratePrepare2;
|
||||
virDomainMigratePrepare3;
|
||||
virDomainMigratePrepare3Params;
|
||||
virDomainMigratePrepareTunnel;
|
||||
virDomainMigratePrepareTunnel3;
|
||||
virDomainMigratePrepareTunnel3Params;
|
||||
virRegisterDriver;
|
||||
virRegisterInterfaceDriver;
|
||||
virRegisterNetworkDriver;
|
||||
|
|
|
@ -2744,6 +2744,70 @@ struct remote_domain_fstrim_args {
|
|||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_begin3_params_args {
|
||||
remote_nonnull_domain dom;
|
||||
remote_typed_param params<>;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_begin3_params_ret {
|
||||
opaque cookie_out<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
remote_nonnull_string xml;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_prepare3_params_args {
|
||||
remote_typed_param params<>;
|
||||
opaque cookie_in<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_prepare3_params_ret {
|
||||
opaque cookie_out<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
remote_string uri_out;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_prepare_tunnel3_params_args {
|
||||
remote_typed_param params<>;
|
||||
opaque cookie_in<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_prepare_tunnel3_params_ret {
|
||||
opaque cookie_out<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_perform3_params_args {
|
||||
remote_nonnull_domain dom;
|
||||
remote_string dconnuri;
|
||||
remote_typed_param params<>;
|
||||
opaque cookie_in<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_perform3_params_ret {
|
||||
opaque cookie_out<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_finish3_params_args {
|
||||
remote_typed_param params<>;
|
||||
opaque cookie_in<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
unsigned int flags;
|
||||
int cancelled;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_finish3_params_ret {
|
||||
remote_nonnull_domain dom;
|
||||
opaque cookie_out<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_confirm3_params_args {
|
||||
remote_nonnull_domain dom;
|
||||
remote_typed_param params<>;
|
||||
opaque cookie_in<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
unsigned int flags;
|
||||
int cancelled;
|
||||
};
|
||||
|
||||
/*----- Protocol. -----*/
|
||||
|
||||
/* Define the program number, protocol version and procedure numbers here. */
|
||||
|
@ -4840,6 +4904,46 @@ enum remote_procedure {
|
|||
* @generate: server
|
||||
* @acl: node_device:dettach
|
||||
*/
|
||||
REMOTE_PROC_NODE_DEVICE_DETACH_FLAGS = 301
|
||||
REMOTE_PROC_NODE_DEVICE_DETACH_FLAGS = 301,
|
||||
|
||||
/**
|
||||
* @generate: none
|
||||
* @acl: domain:migrate
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3_PARAMS = 302,
|
||||
|
||||
/**
|
||||
* @generate: none
|
||||
* @acl: domain:migrate
|
||||
* @acl: domain:start
|
||||
* @acl: domain:write
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3_PARAMS = 303,
|
||||
|
||||
/**
|
||||
* @generate: none
|
||||
* @acl: domain:migrate
|
||||
* @acl: domain:start
|
||||
* @acl: domain:write
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3_PARAMS = 304,
|
||||
|
||||
/**
|
||||
* @generate: none
|
||||
* @acl: domain:migrate
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3_PARAMS = 305,
|
||||
|
||||
/**
|
||||
* @generate: none
|
||||
* @acl: domain:migrate
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_FINISH3_PARAMS = 306,
|
||||
|
||||
/**
|
||||
* @generate: none
|
||||
* @acl: domain:migrate
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3_PARAMS = 307
|
||||
|
||||
};
|
||||
|
|
|
@ -2192,6 +2192,107 @@ struct remote_domain_fstrim_args {
|
|||
uint64_t minimum;
|
||||
u_int flags;
|
||||
};
|
||||
struct remote_domain_migrate_begin3_params_args {
|
||||
remote_nonnull_domain dom;
|
||||
struct {
|
||||
u_int params_len;
|
||||
remote_typed_param * params_val;
|
||||
} params;
|
||||
u_int flags;
|
||||
};
|
||||
struct remote_domain_migrate_begin3_params_ret {
|
||||
struct {
|
||||
u_int cookie_out_len;
|
||||
char * cookie_out_val;
|
||||
} cookie_out;
|
||||
remote_nonnull_string xml;
|
||||
};
|
||||
struct remote_domain_migrate_prepare3_params_args {
|
||||
struct {
|
||||
u_int params_len;
|
||||
remote_typed_param * params_val;
|
||||
} params;
|
||||
struct {
|
||||
u_int cookie_in_len;
|
||||
char * cookie_in_val;
|
||||
} cookie_in;
|
||||
u_int flags;
|
||||
};
|
||||
struct remote_domain_migrate_prepare3_params_ret {
|
||||
struct {
|
||||
u_int cookie_out_len;
|
||||
char * cookie_out_val;
|
||||
} cookie_out;
|
||||
remote_string uri_out;
|
||||
};
|
||||
struct remote_domain_migrate_prepare_tunnel3_params_args {
|
||||
struct {
|
||||
u_int params_len;
|
||||
remote_typed_param * params_val;
|
||||
} params;
|
||||
struct {
|
||||
u_int cookie_in_len;
|
||||
char * cookie_in_val;
|
||||
} cookie_in;
|
||||
u_int flags;
|
||||
};
|
||||
struct remote_domain_migrate_prepare_tunnel3_params_ret {
|
||||
struct {
|
||||
u_int cookie_out_len;
|
||||
char * cookie_out_val;
|
||||
} cookie_out;
|
||||
};
|
||||
struct remote_domain_migrate_perform3_params_args {
|
||||
remote_nonnull_domain dom;
|
||||
remote_string dconnuri;
|
||||
struct {
|
||||
u_int params_len;
|
||||
remote_typed_param * params_val;
|
||||
} params;
|
||||
struct {
|
||||
u_int cookie_in_len;
|
||||
char * cookie_in_val;
|
||||
} cookie_in;
|
||||
u_int flags;
|
||||
};
|
||||
struct remote_domain_migrate_perform3_params_ret {
|
||||
struct {
|
||||
u_int cookie_out_len;
|
||||
char * cookie_out_val;
|
||||
} cookie_out;
|
||||
};
|
||||
struct remote_domain_migrate_finish3_params_args {
|
||||
struct {
|
||||
u_int params_len;
|
||||
remote_typed_param * params_val;
|
||||
} params;
|
||||
struct {
|
||||
u_int cookie_in_len;
|
||||
char * cookie_in_val;
|
||||
} cookie_in;
|
||||
u_int flags;
|
||||
int cancelled;
|
||||
};
|
||||
struct remote_domain_migrate_finish3_params_ret {
|
||||
remote_nonnull_domain dom;
|
||||
struct {
|
||||
u_int cookie_out_len;
|
||||
char * cookie_out_val;
|
||||
} cookie_out;
|
||||
};
|
||||
struct remote_domain_migrate_confirm3_params_args {
|
||||
remote_nonnull_domain dom;
|
||||
struct {
|
||||
u_int params_len;
|
||||
remote_typed_param * params_val;
|
||||
} params;
|
||||
struct {
|
||||
u_int cookie_in_len;
|
||||
char * cookie_in_val;
|
||||
} cookie_in;
|
||||
u_int flags;
|
||||
int cancelled;
|
||||
};
|
||||
enum remote_procedure {
|
||||
REMOTE_PROC_CONNECT_OPEN = 1,
|
||||
REMOTE_PROC_CONNECT_CLOSE = 2,
|
||||
|
@ -2494,4 +2595,10 @@ enum remote_procedure {
|
|||
REMOTE_PROC_DOMAIN_MIGRATE_GET_COMPRESSION_CACHE = 299,
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_SET_COMPRESSION_CACHE = 300,
|
||||
REMOTE_PROC_NODE_DEVICE_DETACH_FLAGS = 301,
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3_PARAMS = 302,
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3_PARAMS = 303,
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3_PARAMS = 304,
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3_PARAMS = 305,
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_FINISH3_PARAMS = 306,
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3_PARAMS = 307,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue