mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
Remote driver implementation of new migration API
* src/remote/remote_protocol.x: Define wire protocol for migration protocol v3 * daemon/remote.c: Server side dispatch * src/remote/remote_driver.c: Client side serialization * src/remote/remote_protocol.c, src/remote/remote_protocol.h, daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h, daemon/remote_dispatch_ret.h, daemon/remote_dispatch_table.h: Re-generate files * src/remote_protocol-structs: Declare new ABIs
This commit is contained in:
parent
65043d2dff
commit
d59e14a1a2
315
daemon/remote.c
315
daemon/remote.c
@ -76,6 +76,7 @@ static virStorageVolPtr get_nonnull_storage_vol(virConnectPtr conn, remote_nonnu
|
||||
static virSecretPtr get_nonnull_secret(virConnectPtr conn, remote_nonnull_secret secret);
|
||||
static virNWFilterPtr get_nonnull_nwfilter(virConnectPtr conn, remote_nonnull_nwfilter nwfilter);
|
||||
static virDomainSnapshotPtr get_nonnull_domain_snapshot(virDomainPtr dom, remote_nonnull_domain_snapshot snapshot);
|
||||
static int make_domain(remote_domain *dom_dst, virDomainPtr dom_src);
|
||||
static void make_nonnull_domain(remote_nonnull_domain *dom_dst, virDomainPtr dom_src);
|
||||
static void make_nonnull_network(remote_nonnull_network *net_dst, virNetworkPtr net_src);
|
||||
static void make_nonnull_interface(remote_nonnull_interface *interface_dst, virInterfacePtr interface_src);
|
||||
@ -3079,6 +3080,305 @@ cleanup:
|
||||
#include "qemu_dispatch_bodies.h"
|
||||
|
||||
|
||||
static int
|
||||
remoteDispatchDomainMigrateBegin3(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||
remote_error *rerr,
|
||||
remote_domain_migrate_begin3_args *args,
|
||||
remote_domain_migrate_begin3_ret *ret)
|
||||
{
|
||||
char *xml = NULL;
|
||||
virDomainPtr dom = NULL;
|
||||
char *dname;
|
||||
char *cookieout = NULL;
|
||||
int cookieoutlen = 0;
|
||||
int rv = -1;
|
||||
|
||||
if (!conn) {
|
||||
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
||||
goto cleanup;
|
||||
|
||||
dname = args->dname == NULL ? NULL : *args->dname;
|
||||
|
||||
if (!(xml = virDomainMigrateBegin3(dom,
|
||||
&cookieout, &cookieoutlen,
|
||||
args->flags, dname, args->resource)))
|
||||
goto cleanup;
|
||||
|
||||
/* remoteDispatchClientRequest will free cookie and
|
||||
* the xml string if there is one.
|
||||
*/
|
||||
ret->cookie_out.cookie_out_len = cookieoutlen;
|
||||
ret->cookie_out.cookie_out_val = cookieout;
|
||||
ret->xml = xml;
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
remoteDispatchError(rerr);
|
||||
if (dom)
|
||||
virDomainFree(dom);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDispatchDomainMigratePrepare3(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||
remote_error *rerr,
|
||||
remote_domain_migrate_prepare3_args *args,
|
||||
remote_domain_migrate_prepare3_ret *ret)
|
||||
{
|
||||
char *cookieout = NULL;
|
||||
int cookieoutlen = 0;
|
||||
char *uri_in;
|
||||
char **uri_out;
|
||||
char *dname;
|
||||
int rv = -1;
|
||||
|
||||
if (!conn) {
|
||||
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
uri_in = args->uri_in == NULL ? NULL : *args->uri_in;
|
||||
dname = args->dname == NULL ? NULL : *args->dname;
|
||||
|
||||
/* Wacky world of XDR ... */
|
||||
if (VIR_ALLOC(uri_out) < 0) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virDomainMigratePrepare3(conn,
|
||||
args->cookie_in.cookie_in_val,
|
||||
args->cookie_in.cookie_in_len,
|
||||
&cookieout, &cookieoutlen,
|
||||
uri_in, uri_out,
|
||||
args->flags, dname, args->resource,
|
||||
args->dom_xml) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* remoteDispatchClientRequest will free cookie, uri_out and
|
||||
* the string if there is one.
|
||||
*/
|
||||
ret->cookie_out.cookie_out_len = cookieoutlen;
|
||||
ret->cookie_out.cookie_out_val = cookieout;
|
||||
ret->uri_out = *uri_out == NULL ? NULL : uri_out;
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
if (rv < 0) {
|
||||
remoteDispatchError(rerr);
|
||||
VIR_FREE(uri_out);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDispatchDomainMigratePrepareTunnel3(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr,
|
||||
remote_error *rerr,
|
||||
remote_domain_migrate_prepare_tunnel3_args *args,
|
||||
remote_domain_migrate_prepare_tunnel3_ret *ret)
|
||||
{
|
||||
char *dname;
|
||||
char *cookieout = NULL;
|
||||
int cookieoutlen = 0;
|
||||
struct qemud_client_stream *stream = NULL;
|
||||
int rv = -1;
|
||||
|
||||
if (!conn) {
|
||||
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
dname = args->dname == NULL ? NULL : *args->dname;
|
||||
|
||||
if (!(stream = remoteCreateClientStream(conn, hdr))) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virDomainMigratePrepareTunnel3(conn, stream->st,
|
||||
args->cookie_in.cookie_in_val,
|
||||
args->cookie_in.cookie_in_len,
|
||||
&cookieout, &cookieoutlen,
|
||||
args->flags, dname, args->resource,
|
||||
args->dom_xml) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (remoteAddClientStream(client, stream, 0) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* remoteDispatchClientRequest will free cookie
|
||||
*/
|
||||
ret->cookie_out.cookie_out_len = cookieoutlen;
|
||||
ret->cookie_out.cookie_out_val = cookieout;
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
if (rv < 0) {
|
||||
remoteDispatchError(rerr);
|
||||
VIR_FREE(cookieout);
|
||||
}
|
||||
if (stream && rv < 0) {
|
||||
virStreamAbort(stream->st);
|
||||
remoteFreeClientStream(client, stream);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDispatchDomainMigratePerform3(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||
remote_error *rerr,
|
||||
remote_domain_migrate_perform3_args *args,
|
||||
remote_domain_migrate_perform3_ret *ret)
|
||||
{
|
||||
virDomainPtr dom = NULL;
|
||||
char *dname;
|
||||
char *cookieout = NULL;
|
||||
int cookieoutlen = 0;
|
||||
int rv = -1;
|
||||
|
||||
if (!conn) {
|
||||
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
||||
goto cleanup;
|
||||
|
||||
dname = args->dname == NULL ? NULL : *args->dname;
|
||||
|
||||
if (virDomainMigratePerform3(dom,
|
||||
args->cookie_in.cookie_in_val,
|
||||
args->cookie_in.cookie_in_len,
|
||||
&cookieout, &cookieoutlen,
|
||||
args->uri,
|
||||
args->flags, dname, args->resource) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* remoteDispatchClientRequest will free cookie
|
||||
*/
|
||||
ret->cookie_out.cookie_out_len = cookieoutlen;
|
||||
ret->cookie_out.cookie_out_val = cookieout;
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
remoteDispatchError(rerr);
|
||||
if (dom)
|
||||
virDomainFree(dom);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDispatchDomainMigrateFinish3(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||
remote_error *rerr,
|
||||
remote_domain_migrate_finish3_args *args,
|
||||
remote_domain_migrate_finish3_ret *ret)
|
||||
{
|
||||
virDomainPtr dom = NULL;
|
||||
char *cookieout = NULL;
|
||||
int cookieoutlen = 0;
|
||||
int rv = -1;
|
||||
|
||||
if (!conn) {
|
||||
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virDomainMigrateFinish3(conn, args->dname,
|
||||
args->cookie_in.cookie_in_val,
|
||||
args->cookie_in.cookie_in_len,
|
||||
&cookieout, &cookieoutlen,
|
||||
args->uri,
|
||||
args->flags,
|
||||
args->cancelled,
|
||||
&dom) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (dom &&
|
||||
make_domain(&ret->ddom, dom) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* remoteDispatchClientRequest will free cookie
|
||||
*/
|
||||
ret->cookie_out.cookie_out_len = cookieoutlen;
|
||||
ret->cookie_out.cookie_out_val = cookieout;
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
if (rv < 0) {
|
||||
remoteDispatchError(rerr);
|
||||
VIR_FREE(cookieout);
|
||||
}
|
||||
if (dom)
|
||||
virDomainFree(dom);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDispatchDomainMigrateConfirm3(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||
remote_error *rerr,
|
||||
remote_domain_migrate_confirm3_args *args,
|
||||
void *ret ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virDomainPtr dom = NULL;
|
||||
int rv = -1;
|
||||
|
||||
if (!conn) {
|
||||
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainMigrateConfirm3(dom,
|
||||
args->cookie_in.cookie_in_val,
|
||||
args->cookie_in.cookie_in_len,
|
||||
args->flags, args->cancelled) < 0)
|
||||
goto cleanup;
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
remoteDispatchError(rerr);
|
||||
if (dom)
|
||||
virDomainFree(dom);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/*----- Helpers. -----*/
|
||||
|
||||
/* get_nonnull_domain and get_nonnull_network turn an on-wire
|
||||
@ -3144,6 +3444,21 @@ get_nonnull_domain_snapshot(virDomainPtr dom, remote_nonnull_domain_snapshot sna
|
||||
}
|
||||
|
||||
/* Make remote_nonnull_domain and remote_nonnull_network. */
|
||||
static int
|
||||
make_domain(remote_domain *dom_dst, virDomainPtr dom_src)
|
||||
{
|
||||
remote_domain rdom;
|
||||
if (VIR_ALLOC(rdom) < 0)
|
||||
return -1;
|
||||
|
||||
rdom->id = dom_src->id;
|
||||
rdom->name = strdup(dom_src->name);
|
||||
memcpy(rdom->uuid, dom_src->uuid, VIR_UUID_BUFLEN);
|
||||
|
||||
*dom_dst = rdom;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
make_nonnull_domain(remote_nonnull_domain *dom_dst, virDomainPtr dom_src)
|
||||
{
|
||||
|
@ -238,6 +238,7 @@ static int remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int
|
||||
virReportErrorHelper(VIR_FROM_REMOTE, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
static virDomainPtr get_domain (virConnectPtr conn, remote_domain domain);
|
||||
static virDomainPtr get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain);
|
||||
static virNetworkPtr get_nonnull_network (virConnectPtr conn, remote_nonnull_network network);
|
||||
static virNWFilterPtr get_nonnull_nwfilter (virConnectPtr conn, remote_nonnull_nwfilter nwfilter);
|
||||
@ -4991,9 +4992,350 @@ done:
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
remoteDomainMigrateBegin3(virDomainPtr domain,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned long flags,
|
||||
const char *dname,
|
||||
unsigned long resource)
|
||||
{
|
||||
char *rv = NULL;
|
||||
remote_domain_migrate_begin3_args args;
|
||||
remote_domain_migrate_begin3_ret ret;
|
||||
struct private_data *priv = domain->conn->privateData;
|
||||
|
||||
remoteDriverLock(priv);
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
memset(&ret, 0, sizeof(ret));
|
||||
|
||||
make_nonnull_domain (&args.dom, domain);
|
||||
args.flags = flags;
|
||||
args.dname = dname == NULL ? NULL : (char **) &dname;
|
||||
args.resource = resource;
|
||||
|
||||
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3,
|
||||
(xdrproc_t) xdr_remote_domain_migrate_begin3_args, (char *) &args,
|
||||
(xdrproc_t) xdr_remote_domain_migrate_begin3_ret, (char *) &ret) == -1)
|
||||
goto done;
|
||||
|
||||
if (ret.cookie_out.cookie_out_len > 0) {
|
||||
if (!cookieout || !cookieoutlen) {
|
||||
remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("caller ignores cookieout or cookieoutlen"));
|
||||
goto error;
|
||||
}
|
||||
*cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */
|
||||
*cookieoutlen = ret.cookie_out.cookie_out_len;
|
||||
}
|
||||
|
||||
rv = ret.xml; /* caller frees */
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
|
||||
error:
|
||||
VIR_FREE(ret.cookie_out.cookie_out_val);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDomainMigratePrepare3(virConnectPtr dconn,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
const char *uri_in,
|
||||
char **uri_out,
|
||||
unsigned long flags,
|
||||
const char *dname,
|
||||
unsigned long resource,
|
||||
const char *dom_xml)
|
||||
{
|
||||
int rv = -1;
|
||||
remote_domain_migrate_prepare3_args args;
|
||||
remote_domain_migrate_prepare3_ret ret;
|
||||
struct private_data *priv = dconn->privateData;
|
||||
|
||||
remoteDriverLock(priv);
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
memset(&ret, 0, sizeof(ret));
|
||||
|
||||
args.cookie_in.cookie_in_val = (char *)cookiein;
|
||||
args.cookie_in.cookie_in_len = cookieinlen;
|
||||
args.uri_in = uri_in == NULL ? NULL : (char **) &uri_in;
|
||||
args.flags = flags;
|
||||
args.dname = dname == NULL ? NULL : (char **) &dname;
|
||||
args.resource = resource;
|
||||
args.dom_xml = (char *) dom_xml;
|
||||
|
||||
memset (&ret, 0, sizeof ret);
|
||||
if (call (dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3,
|
||||
(xdrproc_t) xdr_remote_domain_migrate_prepare3_args, (char *) &args,
|
||||
(xdrproc_t) xdr_remote_domain_migrate_prepare3_ret, (char *) &ret) == -1)
|
||||
goto done;
|
||||
|
||||
if (ret.cookie_out.cookie_out_len > 0) {
|
||||
if (!cookieout || !cookieoutlen) {
|
||||
remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("caller ignores cookieout or cookieoutlen"));
|
||||
goto error;
|
||||
}
|
||||
*cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */
|
||||
*cookieoutlen = ret.cookie_out.cookie_out_len;
|
||||
}
|
||||
if (ret.uri_out) {
|
||||
if (!uri_out) {
|
||||
remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("caller ignores uri_out"));
|
||||
goto error;
|
||||
}
|
||||
*uri_out = *ret.uri_out; /* Caller frees. */
|
||||
}
|
||||
|
||||
rv = 0;
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
error:
|
||||
VIR_FREE(ret.cookie_out.cookie_out_val);
|
||||
if (ret.uri_out)
|
||||
VIR_FREE(*ret.uri_out);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDomainMigratePrepareTunnel3(virConnectPtr dconn,
|
||||
virStreamPtr st,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned long flags,
|
||||
const char *dname,
|
||||
unsigned long resource,
|
||||
const char *dom_xml)
|
||||
{
|
||||
struct private_data *priv = dconn->privateData;
|
||||
struct private_stream_data *privst = NULL;
|
||||
int rv = -1;
|
||||
remote_domain_migrate_prepare_tunnel3_args args;
|
||||
remote_domain_migrate_prepare_tunnel3_ret ret;
|
||||
|
||||
remoteDriverLock(priv);
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
memset(&ret, 0, sizeof(ret));
|
||||
|
||||
if (!(privst = remoteStreamOpen(st,
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3,
|
||||
priv->counter)))
|
||||
goto done;
|
||||
|
||||
st->driver = &remoteStreamDrv;
|
||||
st->privateData = privst;
|
||||
|
||||
args.cookie_in.cookie_in_val = (char *)cookiein;
|
||||
args.cookie_in.cookie_in_len = cookieinlen;
|
||||
args.flags = flags;
|
||||
args.dname = dname == NULL ? NULL : (char **) &dname;
|
||||
args.resource = resource;
|
||||
args.dom_xml = (char *) dom_xml;
|
||||
|
||||
if (call(dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3,
|
||||
(xdrproc_t) xdr_remote_domain_migrate_prepare_tunnel3_args, (char *) &args,
|
||||
(xdrproc_t) xdr_remote_domain_migrate_prepare_tunnel3_ret, (char *) &ret) == -1) {
|
||||
remoteStreamRelease(st);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ret.cookie_out.cookie_out_len > 0) {
|
||||
if (!cookieout || !cookieoutlen) {
|
||||
remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("caller ignores cookieout or cookieoutlen"));
|
||||
goto error;
|
||||
}
|
||||
*cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */
|
||||
*cookieoutlen = ret.cookie_out.cookie_out_len;
|
||||
}
|
||||
|
||||
rv = 0;
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
|
||||
error:
|
||||
VIR_FREE(ret.cookie_out.cookie_out_val);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDomainMigratePerform3(virDomainPtr dom,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
const char *uri,
|
||||
unsigned long flags,
|
||||
const char *dname,
|
||||
unsigned long resource)
|
||||
{
|
||||
int rv = -1;
|
||||
remote_domain_migrate_perform3_args args;
|
||||
remote_domain_migrate_perform3_ret ret;
|
||||
struct private_data *priv = dom->conn->privateData;
|
||||
|
||||
remoteDriverLock(priv);
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
memset(&ret, 0, sizeof(ret));
|
||||
|
||||
make_nonnull_domain(&args.dom, dom);
|
||||
|
||||
args.cookie_in.cookie_in_val = (char *)cookiein;
|
||||
args.cookie_in.cookie_in_len = cookieinlen;
|
||||
args.uri = (char *) uri;
|
||||
args.flags = flags;
|
||||
args.dname = dname == NULL ? NULL : (char **) &dname;
|
||||
args.resource = resource;
|
||||
|
||||
if (call (dom->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3,
|
||||
(xdrproc_t) xdr_remote_domain_migrate_perform3_args, (char *) &args,
|
||||
(xdrproc_t) xdr_remote_domain_migrate_perform3_ret, (char *) &ret) == -1)
|
||||
goto done;
|
||||
|
||||
if (ret.cookie_out.cookie_out_len > 0) {
|
||||
if (!cookieout || !cookieoutlen) {
|
||||
remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("caller ignores cookieout or cookieoutlen"));
|
||||
goto error;
|
||||
}
|
||||
*cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */
|
||||
*cookieoutlen = ret.cookie_out.cookie_out_len;
|
||||
}
|
||||
|
||||
rv = 0;
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
|
||||
error:
|
||||
VIR_FREE(ret.cookie_out.cookie_out_val);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDomainMigrateFinish3(virConnectPtr dconn,
|
||||
const char *dname,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
const char *uri,
|
||||
unsigned long flags,
|
||||
int cancelled,
|
||||
virDomainPtr *ddom)
|
||||
{
|
||||
remote_domain_migrate_finish3_args args;
|
||||
remote_domain_migrate_finish3_ret ret;
|
||||
struct private_data *priv = dconn->privateData;
|
||||
int rv = -1;
|
||||
|
||||
remoteDriverLock(priv);
|
||||
|
||||
*ddom = NULL;
|
||||
memset(&args, 0, sizeof(args));
|
||||
memset(&ret, 0, sizeof(ret));
|
||||
|
||||
args.cookie_in.cookie_in_val = (char *)cookiein;
|
||||
args.cookie_in.cookie_in_len = cookieinlen;
|
||||
args.dname = (char *) dname;
|
||||
args.uri = (char *) uri;
|
||||
args.flags = flags;
|
||||
args.cancelled = cancelled;
|
||||
|
||||
if (call (dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_FINISH3,
|
||||
(xdrproc_t) xdr_remote_domain_migrate_finish3_args, (char *) &args,
|
||||
(xdrproc_t) xdr_remote_domain_migrate_finish3_ret, (char *) &ret) == -1)
|
||||
goto done;
|
||||
|
||||
*ddom = get_domain(dconn, ret.ddom);
|
||||
|
||||
if (ret.cookie_out.cookie_out_len > 0) {
|
||||
if (!cookieout || !cookieoutlen) {
|
||||
remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("caller ignores cookieout or cookieoutlen"));
|
||||
goto error;
|
||||
}
|
||||
*cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */
|
||||
*cookieoutlen = ret.cookie_out.cookie_out_len;
|
||||
ret.cookie_out.cookie_out_val = NULL;
|
||||
ret.cookie_out.cookie_out_len = 0;
|
||||
}
|
||||
|
||||
xdr_free ((xdrproc_t) &xdr_remote_domain_migrate_finish3_ret, (char *) &ret);
|
||||
|
||||
rv = 0;
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
|
||||
error:
|
||||
VIR_FREE(ret.cookie_out.cookie_out_val);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDomainMigrateConfirm3(virDomainPtr domain,
|
||||
const char *cookiein,
|
||||
int cookieinlen,
|
||||
unsigned long flags,
|
||||
int cancelled)
|
||||
{
|
||||
int rv = -1;
|
||||
remote_domain_migrate_confirm3_args args;
|
||||
struct private_data *priv = domain->conn->privateData;
|
||||
|
||||
remoteDriverLock(priv);
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
|
||||
make_nonnull_domain (&args.dom, domain);
|
||||
args.cookie_in.cookie_in_len = cookieinlen;
|
||||
args.cookie_in.cookie_in_val = (char *) cookiein;
|
||||
args.flags = flags;
|
||||
args.cancelled = cancelled;
|
||||
|
||||
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3,
|
||||
(xdrproc_t) xdr_remote_domain_migrate_confirm3_args, (char *) &args,
|
||||
(xdrproc_t) xdr_void, (char *) NULL) == -1)
|
||||
goto done;
|
||||
|
||||
rv = 0;
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
#include "remote_client_bodies.h"
|
||||
#include "qemu_client_bodies.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
static struct remote_thread_call *
|
||||
@ -6265,6 +6607,22 @@ remoteDomainEventQueue(struct private_data *priv, virDomainEventPtr event)
|
||||
virDomainEventStateQueue(priv->domainEventState, event);
|
||||
}
|
||||
|
||||
/* get_nonnull_domain and get_nonnull_network turn an on-wire
|
||||
* (name, uuid) pair into virDomainPtr or virNetworkPtr object.
|
||||
* These can return NULL if underlying memory allocations fail,
|
||||
* but if they do then virterror_internal.has been set.
|
||||
*/
|
||||
static virDomainPtr
|
||||
get_domain (virConnectPtr conn, remote_domain domain)
|
||||
{
|
||||
virDomainPtr dom = NULL;
|
||||
if (domain) {
|
||||
dom = virGetDomain (conn, domain->name, BAD_CAST domain->uuid);
|
||||
if (dom) dom->id = domain->id;
|
||||
}
|
||||
return dom;
|
||||
}
|
||||
|
||||
/* get_nonnull_domain and get_nonnull_network turn an on-wire
|
||||
* (name, uuid) pair into virDomainPtr or virNetworkPtr object.
|
||||
* These can return NULL if underlying memory allocations fail,
|
||||
@ -6510,6 +6868,12 @@ static virDriver remote_driver = {
|
||||
.qemuDomainMonitorCommand = remoteQemuDomainMonitorCommand, /* 0.8.3 */
|
||||
.domainOpenConsole = remoteDomainOpenConsole, /* 0.8.6 */
|
||||
.domainInjectNMI = remoteDomainInjectNMI, /* 0.9.2 */
|
||||
.domainMigrateBegin3 = remoteDomainMigrateBegin3, /* 0.9.2 */
|
||||
.domainMigratePrepare3 = remoteDomainMigratePrepare3, /* 0.9.2 */
|
||||
.domainMigratePrepareTunnel3 = remoteDomainMigratePrepareTunnel3, /* 0.9.2 */
|
||||
.domainMigratePerform3 = remoteDomainMigratePerform3, /* 0.9.2 */
|
||||
.domainMigrateFinish3 = remoteDomainMigrateFinish3, /* 0.9.2 */
|
||||
.domainMigrateConfirm3 = remoteDomainMigrateConfirm3, /* 0.9.2 */
|
||||
};
|
||||
|
||||
static virNetworkDriver network_driver = {
|
||||
|
@ -1965,6 +1965,76 @@ struct remote_domain_get_state_ret {
|
||||
int reason;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_begin3_args {
|
||||
remote_nonnull_domain dom;
|
||||
unsigned hyper flags;
|
||||
remote_string dname;
|
||||
unsigned hyper resource;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_begin3_ret {
|
||||
opaque cookie_out<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
remote_nonnull_string xml;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_prepare3_args {
|
||||
opaque cookie_in<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
remote_string uri_in;
|
||||
unsigned hyper flags;
|
||||
remote_string dname;
|
||||
unsigned hyper resource;
|
||||
remote_nonnull_string dom_xml;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_prepare3_ret {
|
||||
opaque cookie_out<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
remote_string uri_out;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_prepare_tunnel3_args {
|
||||
opaque cookie_in<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
unsigned hyper flags;
|
||||
remote_string dname;
|
||||
unsigned hyper resource;
|
||||
remote_nonnull_string dom_xml;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_prepare_tunnel3_ret {
|
||||
opaque cookie_out<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_perform3_args {
|
||||
remote_nonnull_domain dom;
|
||||
opaque cookie_in<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
remote_nonnull_string uri;
|
||||
unsigned hyper flags;
|
||||
remote_string dname;
|
||||
unsigned hyper resource;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_perform3_ret {
|
||||
opaque cookie_out<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_finish3_args {
|
||||
remote_nonnull_string dname;
|
||||
opaque cookie_in<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
remote_nonnull_string uri;
|
||||
unsigned hyper flags;
|
||||
int cancelled;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_finish3_ret {
|
||||
remote_domain ddom;
|
||||
opaque cookie_out<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
};
|
||||
|
||||
struct remote_domain_migrate_confirm3_args {
|
||||
remote_nonnull_domain dom;
|
||||
opaque cookie_in<REMOTE_MIGRATE_COOKIE_MAX>;
|
||||
unsigned hyper flags;
|
||||
int cancelled;
|
||||
};
|
||||
|
||||
/*----- Protocol. -----*/
|
||||
|
||||
@ -2208,7 +2278,13 @@ enum remote_procedure {
|
||||
REMOTE_PROC_DOMAIN_INJECT_NMI = 210, /* autogen autogen */
|
||||
|
||||
REMOTE_PROC_DOMAIN_SCREENSHOT = 211, /* skipgen skipgen */
|
||||
REMOTE_PROC_DOMAIN_GET_STATE = 212 /* skipgen skipgen */
|
||||
REMOTE_PROC_DOMAIN_GET_STATE = 212, /* skipgen skipgen */
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3 = 213, /* skipgen skipgen */
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3 = 214, /* skipgen skipgen */
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3 = 215, /* skipgen skipgen */
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3 = 216, /* skipgen skipgen */
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_FINISH3 = 217, /* skipgen skipgen */
|
||||
REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3 = 218 /* skipgen skipgen */
|
||||
|
||||
/*
|
||||
* Notice how the entries are grouped in sets of 10 ?
|
||||
|
@ -1447,6 +1447,96 @@ struct remote_domain_get_state_ret {
|
||||
int state;
|
||||
int reason;
|
||||
};
|
||||
struct remote_domain_migrate_begin3_args {
|
||||
remote_nonnull_domain dom;
|
||||
uint64_t flags;
|
||||
remote_string dname;
|
||||
uint64_t resource;
|
||||
};
|
||||
struct remote_domain_migrate_begin3_ret {
|
||||
struct {
|
||||
u_int cookie_out_len;
|
||||
char * cookie_out_val;
|
||||
} cookie_out;
|
||||
remote_nonnull_string xml;
|
||||
};
|
||||
struct remote_domain_migrate_prepare3_args {
|
||||
struct {
|
||||
u_int cookie_in_len;
|
||||
char * cookie_in_val;
|
||||
} cookie_in;
|
||||
remote_string uri_in;
|
||||
uint64_t flags;
|
||||
remote_string dname;
|
||||
uint64_t resource;
|
||||
remote_nonnull_string dom_xml;
|
||||
};
|
||||
struct remote_domain_migrate_prepare3_ret {
|
||||
struct {
|
||||
u_int cookie_out_len;
|
||||
char * cookie_out_val;
|
||||
} cookie_out;
|
||||
remote_string uri_out;
|
||||
};
|
||||
struct remote_domain_migrate_prepare_tunnel3_args {
|
||||
struct {
|
||||
u_int cookie_in_len;
|
||||
char * cookie_in_val;
|
||||
} cookie_in;
|
||||
uint64_t flags;
|
||||
remote_string dname;
|
||||
uint64_t resource;
|
||||
remote_nonnull_string dom_xml;
|
||||
};
|
||||
struct remote_domain_migrate_prepare_tunnel3_ret {
|
||||
struct {
|
||||
u_int cookie_out_len;
|
||||
char * cookie_out_val;
|
||||
} cookie_out;
|
||||
};
|
||||
struct remote_domain_migrate_perform3_args {
|
||||
remote_nonnull_domain dom;
|
||||
struct {
|
||||
u_int cookie_in_len;
|
||||
char * cookie_in_val;
|
||||
} cookie_in;
|
||||
remote_nonnull_string uri;
|
||||
uint64_t flags;
|
||||
remote_string dname;
|
||||
uint64_t resource;
|
||||
};
|
||||
struct remote_domain_migrate_perform3_ret {
|
||||
struct {
|
||||
u_int cookie_out_len;
|
||||
char * cookie_out_val;
|
||||
} cookie_out;
|
||||
};
|
||||
struct remote_domain_migrate_finish3_args {
|
||||
remote_nonnull_string dname;
|
||||
struct {
|
||||
u_int cookie_in_len;
|
||||
char * cookie_in_val;
|
||||
} cookie_in;
|
||||
remote_nonnull_string uri;
|
||||
uint64_t flags;
|
||||
int cancelled;
|
||||
};
|
||||
struct remote_domain_migrate_finish3_ret {
|
||||
remote_domain ddom;
|
||||
struct {
|
||||
u_int cookie_out_len;
|
||||
char * cookie_out_val;
|
||||
} cookie_out;
|
||||
};
|
||||
struct remote_domain_migrate_confirm3_args {
|
||||
remote_nonnull_domain dom;
|
||||
struct {
|
||||
u_int cookie_in_len;
|
||||
char * cookie_in_val;
|
||||
} cookie_in;
|
||||
uint64_t flags;
|
||||
int cancelled;
|
||||
};
|
||||
struct remote_message_header {
|
||||
u_int prog;
|
||||
u_int vers;
|
||||
|
Loading…
Reference in New Issue
Block a user