mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
Implement remote protocol for managed save
* src/remote/remote_protocol.x src/remote/remote_protocol.h src/remote/remote_protocol.c src/remote/remote_driver.c: add the entry points in the remote driver * daemon/remote.c daemon/remote_dispatch_args.h daemon/remote_dispatch_prototypes.h daemon/remote_dispatch_table.h: and implement the daemon counterpart
This commit is contained in:
parent
15c647a91e
commit
7a3da17a58
@ -2415,6 +2415,85 @@ remoteDispatchListDomains (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDispatchDomainManagedSave (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_managed_save_args *args,
|
||||
void *ret ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virDomainPtr dom;
|
||||
|
||||
dom = get_nonnull_domain (conn, args->dom);
|
||||
if (dom == NULL) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainManagedSave (dom, args->flags) == -1) {
|
||||
virDomainFree(dom);
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
return -1;
|
||||
}
|
||||
virDomainFree(dom);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDispatchDomainHasManagedSaveImage (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_has_managed_save_image_args *args,
|
||||
remote_domain_has_managed_save_image_ret *ret)
|
||||
{
|
||||
virDomainPtr dom;
|
||||
|
||||
dom = get_nonnull_domain (conn, args->dom);
|
||||
if (dom == NULL) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret->ret = virDomainHasManagedSaveImage (dom, args->flags);
|
||||
if (ret->ret == -1) {
|
||||
virDomainFree(dom);
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
return -1;
|
||||
}
|
||||
virDomainFree(dom);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDispatchDomainManagedSaveRemove (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_managed_save_remove_args *args,
|
||||
void *ret ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virDomainPtr dom;
|
||||
|
||||
dom = get_nonnull_domain (conn, args->dom);
|
||||
if (dom == NULL) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainManagedSaveRemove (dom, args->flags) == -1) {
|
||||
virDomainFree(dom);
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
return -1;
|
||||
}
|
||||
virDomainFree(dom);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDispatchListNetworks (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||
|
@ -151,3 +151,6 @@
|
||||
remote_list_nwfilters_args val_remote_list_nwfilters_args;
|
||||
remote_nwfilter_define_xml_args val_remote_nwfilter_define_xml_args;
|
||||
remote_nwfilter_undefine_args val_remote_nwfilter_undefine_args;
|
||||
remote_domain_managed_save_args val_remote_domain_managed_save_args;
|
||||
remote_domain_has_managed_save_image_args val_remote_domain_has_managed_save_image_args;
|
||||
remote_domain_managed_save_remove_args val_remote_domain_managed_save_remove_args;
|
||||
|
@ -282,6 +282,14 @@ static int remoteDispatchDomainGetVcpus(
|
||||
remote_error *err,
|
||||
remote_domain_get_vcpus_args *args,
|
||||
remote_domain_get_vcpus_ret *ret);
|
||||
static int remoteDispatchDomainHasManagedSaveImage(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr,
|
||||
remote_error *err,
|
||||
remote_domain_has_managed_save_image_args *args,
|
||||
remote_domain_has_managed_save_image_ret *ret);
|
||||
static int remoteDispatchDomainInterfaceStats(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
@ -330,6 +338,22 @@ static int remoteDispatchDomainLookupByUuid(
|
||||
remote_error *err,
|
||||
remote_domain_lookup_by_uuid_args *args,
|
||||
remote_domain_lookup_by_uuid_ret *ret);
|
||||
static int remoteDispatchDomainManagedSave(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr,
|
||||
remote_error *err,
|
||||
remote_domain_managed_save_args *args,
|
||||
void *ret);
|
||||
static int remoteDispatchDomainManagedSaveRemove(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr,
|
||||
remote_error *err,
|
||||
remote_domain_managed_save_remove_args *args,
|
||||
void *ret);
|
||||
static int remoteDispatchDomainMemoryPeek(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
|
@ -125,3 +125,4 @@
|
||||
remote_num_of_nwfilters_ret val_remote_num_of_nwfilters_ret;
|
||||
remote_list_nwfilters_ret val_remote_list_nwfilters_ret;
|
||||
remote_nwfilter_define_xml_ret val_remote_nwfilter_define_xml_ret;
|
||||
remote_domain_has_managed_save_image_ret val_remote_domain_has_managed_save_image_ret;
|
||||
|
@ -912,3 +912,18 @@
|
||||
.args_filter = (xdrproc_t) xdr_remote_nwfilter_undefine_args,
|
||||
.ret_filter = (xdrproc_t) xdr_void,
|
||||
},
|
||||
{ /* DomainManagedSave => 182 */
|
||||
.fn = (dispatch_fn) remoteDispatchDomainManagedSave,
|
||||
.args_filter = (xdrproc_t) xdr_remote_domain_managed_save_args,
|
||||
.ret_filter = (xdrproc_t) xdr_void,
|
||||
},
|
||||
{ /* DomainHasManagedSaveImage => 183 */
|
||||
.fn = (dispatch_fn) remoteDispatchDomainHasManagedSaveImage,
|
||||
.args_filter = (xdrproc_t) xdr_remote_domain_has_managed_save_image_args,
|
||||
.ret_filter = (xdrproc_t) xdr_remote_domain_has_managed_save_image_ret,
|
||||
},
|
||||
{ /* DomainManagedSaveRemove => 184 */
|
||||
.fn = (dispatch_fn) remoteDispatchDomainManagedSaveRemove,
|
||||
.args_filter = (xdrproc_t) xdr_remote_domain_managed_save_remove_args,
|
||||
.ret_filter = (xdrproc_t) xdr_void,
|
||||
},
|
||||
|
@ -3616,6 +3616,79 @@ done:
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDomainManagedSave (virDomainPtr domain, unsigned int flags)
|
||||
{
|
||||
int rv = -1;
|
||||
remote_domain_managed_save_args args;
|
||||
struct private_data *priv = domain->conn->privateData;
|
||||
|
||||
remoteDriverLock(priv);
|
||||
|
||||
make_nonnull_domain (&args.dom, domain);
|
||||
args.flags = flags;
|
||||
|
||||
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MANAGED_SAVE,
|
||||
(xdrproc_t) xdr_remote_domain_managed_save_args, (char *) &args,
|
||||
(xdrproc_t) xdr_void, (char *) NULL) == -1)
|
||||
goto done;
|
||||
|
||||
rv = 0;
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDomainHasManagedSaveImage (virDomainPtr domain, unsigned int flags)
|
||||
{
|
||||
int rv = -1;
|
||||
remote_domain_has_managed_save_image_args args;
|
||||
remote_domain_has_managed_save_image_ret ret;
|
||||
struct private_data *priv = domain->conn->privateData;
|
||||
|
||||
remoteDriverLock(priv);
|
||||
|
||||
make_nonnull_domain (&args.dom, domain);
|
||||
args.flags = flags;
|
||||
|
||||
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_HAS_MANAGED_SAVE_IMAGE,
|
||||
(xdrproc_t) xdr_remote_domain_has_managed_save_image_args, (char *) &args,
|
||||
(xdrproc_t) xdr_remote_domain_has_managed_save_image_ret, (char *) &ret) == -1)
|
||||
goto done;
|
||||
|
||||
rv = ret.ret;
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDomainManagedSaveRemove (virDomainPtr domain, unsigned int flags)
|
||||
{
|
||||
int rv = -1;
|
||||
remote_domain_managed_save_remove_args args;
|
||||
struct private_data *priv = domain->conn->privateData;
|
||||
|
||||
remoteDriverLock(priv);
|
||||
|
||||
make_nonnull_domain (&args.dom, domain);
|
||||
args.flags = flags;
|
||||
|
||||
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MANAGED_SAVE_REMOVE,
|
||||
(xdrproc_t) xdr_remote_domain_managed_save_remove_args, (char *) &args,
|
||||
(xdrproc_t) xdr_void, (char *) NULL) == -1)
|
||||
goto done;
|
||||
|
||||
rv = 0;
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
static virDrvOpenStatus ATTRIBUTE_NONNULL (1)
|
||||
@ -9818,9 +9891,9 @@ static virDriver remote_driver = {
|
||||
remoteDomainMigrateSetMaxDowntime, /* domainMigrateSetMaxDowntime */
|
||||
remoteDomainEventRegisterAny, /* domainEventRegisterAny */
|
||||
remoteDomainEventDeregisterAny, /* domainEventDeregisterAny */
|
||||
NULL, /* domainManagedSave */
|
||||
NULL, /* domainHasManagedSaveImage */
|
||||
NULL, /* domainManagedSaveRemove */
|
||||
remoteDomainManagedSave, /* domainManagedSave */
|
||||
remoteDomainHasManagedSaveImage, /* domainHasManagedSaveImage */
|
||||
remoteDomainManagedSaveRemove, /* domainManagedSaveRemove */
|
||||
};
|
||||
|
||||
static virNetworkDriver network_driver = {
|
||||
|
@ -3288,6 +3288,48 @@ xdr_remote_domain_event_graphics_msg (XDR *xdrs, remote_domain_event_graphics_ms
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_remote_domain_managed_save_args (XDR *xdrs, remote_domain_managed_save_args *objp)
|
||||
{
|
||||
|
||||
if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
|
||||
return FALSE;
|
||||
if (!xdr_u_int (xdrs, &objp->flags))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_remote_domain_has_managed_save_image_args (XDR *xdrs, remote_domain_has_managed_save_image_args *objp)
|
||||
{
|
||||
|
||||
if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
|
||||
return FALSE;
|
||||
if (!xdr_u_int (xdrs, &objp->flags))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_remote_domain_has_managed_save_image_ret (XDR *xdrs, remote_domain_has_managed_save_image_ret *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int (xdrs, &objp->ret))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_remote_domain_managed_save_remove_args (XDR *xdrs, remote_domain_managed_save_remove_args *objp)
|
||||
{
|
||||
|
||||
if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
|
||||
return FALSE;
|
||||
if (!xdr_u_int (xdrs, &objp->flags))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_remote_procedure (XDR *xdrs, remote_procedure *objp)
|
||||
{
|
||||
|
@ -1860,6 +1860,29 @@ struct remote_domain_event_graphics_msg {
|
||||
} subject;
|
||||
};
|
||||
typedef struct remote_domain_event_graphics_msg remote_domain_event_graphics_msg;
|
||||
|
||||
struct remote_domain_managed_save_args {
|
||||
remote_nonnull_domain dom;
|
||||
u_int flags;
|
||||
};
|
||||
typedef struct remote_domain_managed_save_args remote_domain_managed_save_args;
|
||||
|
||||
struct remote_domain_has_managed_save_image_args {
|
||||
remote_nonnull_domain dom;
|
||||
u_int flags;
|
||||
};
|
||||
typedef struct remote_domain_has_managed_save_image_args remote_domain_has_managed_save_image_args;
|
||||
|
||||
struct remote_domain_has_managed_save_image_ret {
|
||||
int ret;
|
||||
};
|
||||
typedef struct remote_domain_has_managed_save_image_ret remote_domain_has_managed_save_image_ret;
|
||||
|
||||
struct remote_domain_managed_save_remove_args {
|
||||
remote_nonnull_domain dom;
|
||||
u_int flags;
|
||||
};
|
||||
typedef struct remote_domain_managed_save_remove_args remote_domain_managed_save_remove_args;
|
||||
#define REMOTE_PROGRAM 0x20008086
|
||||
#define REMOTE_PROTOCOL_VERSION 1
|
||||
|
||||
@ -2045,6 +2068,9 @@ enum remote_procedure {
|
||||
REMOTE_PROC_LIST_NWFILTERS = 179,
|
||||
REMOTE_PROC_NWFILTER_DEFINE_XML = 180,
|
||||
REMOTE_PROC_NWFILTER_UNDEFINE = 181,
|
||||
REMOTE_PROC_DOMAIN_MANAGED_SAVE = 182,
|
||||
REMOTE_PROC_DOMAIN_HAS_MANAGED_SAVE_IMAGE = 183,
|
||||
REMOTE_PROC_DOMAIN_MANAGED_SAVE_REMOVE = 184,
|
||||
};
|
||||
typedef enum remote_procedure remote_procedure;
|
||||
|
||||
@ -2380,6 +2406,10 @@ extern bool_t xdr_remote_domain_event_io_error_msg (XDR *, remote_domain_event_
|
||||
extern bool_t xdr_remote_domain_event_graphics_address (XDR *, remote_domain_event_graphics_address*);
|
||||
extern bool_t xdr_remote_domain_event_graphics_identity (XDR *, remote_domain_event_graphics_identity*);
|
||||
extern bool_t xdr_remote_domain_event_graphics_msg (XDR *, remote_domain_event_graphics_msg*);
|
||||
extern bool_t xdr_remote_domain_managed_save_args (XDR *, remote_domain_managed_save_args*);
|
||||
extern bool_t xdr_remote_domain_has_managed_save_image_args (XDR *, remote_domain_has_managed_save_image_args*);
|
||||
extern bool_t xdr_remote_domain_has_managed_save_image_ret (XDR *, remote_domain_has_managed_save_image_ret*);
|
||||
extern bool_t xdr_remote_domain_managed_save_remove_args (XDR *, remote_domain_managed_save_remove_args*);
|
||||
extern bool_t xdr_remote_procedure (XDR *, remote_procedure*);
|
||||
extern bool_t xdr_remote_message_type (XDR *, remote_message_type*);
|
||||
extern bool_t xdr_remote_message_status (XDR *, remote_message_status*);
|
||||
@ -2689,6 +2719,10 @@ extern bool_t xdr_remote_domain_event_io_error_msg ();
|
||||
extern bool_t xdr_remote_domain_event_graphics_address ();
|
||||
extern bool_t xdr_remote_domain_event_graphics_identity ();
|
||||
extern bool_t xdr_remote_domain_event_graphics_msg ();
|
||||
extern bool_t xdr_remote_domain_managed_save_args ();
|
||||
extern bool_t xdr_remote_domain_has_managed_save_image_args ();
|
||||
extern bool_t xdr_remote_domain_has_managed_save_image_ret ();
|
||||
extern bool_t xdr_remote_domain_managed_save_remove_args ();
|
||||
extern bool_t xdr_remote_procedure ();
|
||||
extern bool_t xdr_remote_message_type ();
|
||||
extern bool_t xdr_remote_message_status ();
|
||||
|
@ -1647,6 +1647,25 @@ struct remote_domain_event_graphics_msg {
|
||||
remote_domain_event_graphics_identity subject<REMOTE_DOMAIN_EVENT_GRAPHICS_IDENTITY_MAX>;
|
||||
};
|
||||
|
||||
struct remote_domain_managed_save_args {
|
||||
remote_nonnull_domain dom;
|
||||
unsigned flags;
|
||||
};
|
||||
|
||||
struct remote_domain_has_managed_save_image_args {
|
||||
remote_nonnull_domain dom;
|
||||
unsigned flags;
|
||||
};
|
||||
|
||||
struct remote_domain_has_managed_save_image_ret {
|
||||
int ret;
|
||||
};
|
||||
|
||||
struct remote_domain_managed_save_remove_args {
|
||||
remote_nonnull_domain dom;
|
||||
unsigned flags;
|
||||
};
|
||||
|
||||
/*----- Protocol. -----*/
|
||||
|
||||
/* Define the program number, protocol version and procedure numbers here. */
|
||||
@ -1852,7 +1871,10 @@ enum remote_procedure {
|
||||
REMOTE_PROC_LIST_NWFILTERS = 179,
|
||||
REMOTE_PROC_NWFILTER_DEFINE_XML = 180,
|
||||
|
||||
REMOTE_PROC_NWFILTER_UNDEFINE = 181
|
||||
REMOTE_PROC_NWFILTER_UNDEFINE = 181,
|
||||
REMOTE_PROC_DOMAIN_MANAGED_SAVE = 182,
|
||||
REMOTE_PROC_DOMAIN_HAS_MANAGED_SAVE_IMAGE = 183,
|
||||
REMOTE_PROC_DOMAIN_MANAGED_SAVE_REMOVE = 184
|
||||
|
||||
/*
|
||||
* Notice how the entries are grouped in sets of 10 ?
|
||||
|
Loading…
Reference in New Issue
Block a user