mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 09:14:57 +00:00
setmem: implement the remote protocol to address the new API
This patch implements the remote protocol to address the new API. Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
This commit is contained in:
parent
cad769001c
commit
55141abf9d
@ -2383,6 +2383,32 @@ remoteDispatchDomainSetMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteDispatchDomainSetMemoryFlags (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_set_memory_flags_args *args,
|
||||||
|
void *ret ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
virDomainPtr dom;
|
||||||
|
|
||||||
|
dom = get_nonnull_domain (conn, args->dom);
|
||||||
|
if (dom == NULL) {
|
||||||
|
remoteDispatchConnError(rerr, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (virDomainSetMemoryFlags (dom, args->memory, args->flags) == -1) {
|
||||||
|
virDomainFree(dom);
|
||||||
|
remoteDispatchConnError(rerr, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
virDomainFree(dom);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteDispatchDomainSetMemoryParameters(struct qemud_server *server
|
remoteDispatchDomainSetMemoryParameters(struct qemud_server *server
|
||||||
ATTRIBUTE_UNUSED,
|
ATTRIBUTE_UNUSED,
|
||||||
|
@ -172,3 +172,4 @@
|
|||||||
remote_domain_open_console_args val_remote_domain_open_console_args;
|
remote_domain_open_console_args val_remote_domain_open_console_args;
|
||||||
remote_domain_is_updated_args val_remote_domain_is_updated_args;
|
remote_domain_is_updated_args val_remote_domain_is_updated_args;
|
||||||
remote_get_sysinfo_args val_remote_get_sysinfo_args;
|
remote_get_sysinfo_args val_remote_get_sysinfo_args;
|
||||||
|
remote_domain_set_memory_flags_args val_remote_domain_set_memory_flags_args;
|
||||||
|
@ -554,6 +554,14 @@ static int remoteDispatchDomainSetMemory(
|
|||||||
remote_error *err,
|
remote_error *err,
|
||||||
remote_domain_set_memory_args *args,
|
remote_domain_set_memory_args *args,
|
||||||
void *ret);
|
void *ret);
|
||||||
|
static int remoteDispatchDomainSetMemoryFlags(
|
||||||
|
struct qemud_server *server,
|
||||||
|
struct qemud_client *client,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr,
|
||||||
|
remote_error *err,
|
||||||
|
remote_domain_set_memory_flags_args *args,
|
||||||
|
void *ret);
|
||||||
static int remoteDispatchDomainSetMemoryParameters(
|
static int remoteDispatchDomainSetMemoryParameters(
|
||||||
struct qemud_server *server,
|
struct qemud_server *server,
|
||||||
struct qemud_client *client,
|
struct qemud_client *client,
|
||||||
|
@ -1022,3 +1022,8 @@
|
|||||||
.args_filter = (xdrproc_t) xdr_remote_get_sysinfo_args,
|
.args_filter = (xdrproc_t) xdr_remote_get_sysinfo_args,
|
||||||
.ret_filter = (xdrproc_t) xdr_remote_get_sysinfo_ret,
|
.ret_filter = (xdrproc_t) xdr_remote_get_sysinfo_ret,
|
||||||
},
|
},
|
||||||
|
{ /* DomainSetMemoryFlags => 204 */
|
||||||
|
.fn = (dispatch_fn) remoteDispatchDomainSetMemoryFlags,
|
||||||
|
.args_filter = (xdrproc_t) xdr_remote_domain_set_memory_flags_args,
|
||||||
|
.ret_filter = (xdrproc_t) xdr_void,
|
||||||
|
},
|
||||||
|
@ -2450,6 +2450,33 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteDomainSetMemoryFlags (virDomainPtr domain, unsigned long memory, unsigned int flags)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
remote_domain_set_memory_flags_args args;
|
||||||
|
struct private_data *priv = domain->conn->privateData;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_domain (&args.dom, domain);
|
||||||
|
args.memory = memory;
|
||||||
|
args.flags = flags;
|
||||||
|
|
||||||
|
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS,
|
||||||
|
(xdrproc_t) xdr_remote_domain_set_memory_flags_args,
|
||||||
|
(char *) &args,
|
||||||
|
(xdrproc_t) xdr_void,
|
||||||
|
(char *) NULL) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteDomainSetMemoryParameters (virDomainPtr domain,
|
remoteDomainSetMemoryParameters (virDomainPtr domain,
|
||||||
virMemoryParameterPtr params,
|
virMemoryParameterPtr params,
|
||||||
@ -10876,7 +10903,7 @@ static virDriver remote_driver = {
|
|||||||
remoteDomainGetMaxMemory, /* domainGetMaxMemory */
|
remoteDomainGetMaxMemory, /* domainGetMaxMemory */
|
||||||
remoteDomainSetMaxMemory, /* domainSetMaxMemory */
|
remoteDomainSetMaxMemory, /* domainSetMaxMemory */
|
||||||
remoteDomainSetMemory, /* domainSetMemory */
|
remoteDomainSetMemory, /* domainSetMemory */
|
||||||
NULL, /* domainSetMemoryFlags */
|
remoteDomainSetMemoryFlags, /* domainSetMemoryFlags */
|
||||||
remoteDomainGetInfo, /* domainGetInfo */
|
remoteDomainGetInfo, /* domainGetInfo */
|
||||||
remoteDomainSave, /* domainSave */
|
remoteDomainSave, /* domainSave */
|
||||||
remoteDomainRestore, /* domainRestore */
|
remoteDomainRestore, /* domainRestore */
|
||||||
|
@ -1069,6 +1069,19 @@ xdr_remote_domain_set_memory_args (XDR *xdrs, remote_domain_set_memory_args *obj
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_domain_set_memory_flags_args (XDR *xdrs, remote_domain_set_memory_flags_args *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
|
||||||
|
return FALSE;
|
||||||
|
if (!xdr_uint64_t (xdrs, &objp->memory))
|
||||||
|
return FALSE;
|
||||||
|
if (!xdr_u_int (xdrs, &objp->flags))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
bool_t
|
bool_t
|
||||||
xdr_remote_domain_get_info_args (XDR *xdrs, remote_domain_get_info_args *objp)
|
xdr_remote_domain_get_info_args (XDR *xdrs, remote_domain_get_info_args *objp)
|
||||||
{
|
{
|
||||||
|
@ -581,6 +581,13 @@ struct remote_domain_set_memory_args {
|
|||||||
};
|
};
|
||||||
typedef struct remote_domain_set_memory_args remote_domain_set_memory_args;
|
typedef struct remote_domain_set_memory_args remote_domain_set_memory_args;
|
||||||
|
|
||||||
|
struct remote_domain_set_memory_flags_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
uint64_t memory;
|
||||||
|
u_int flags;
|
||||||
|
};
|
||||||
|
typedef struct remote_domain_set_memory_flags_args remote_domain_set_memory_flags_args;
|
||||||
|
|
||||||
struct remote_domain_get_info_args {
|
struct remote_domain_get_info_args {
|
||||||
remote_nonnull_domain dom;
|
remote_nonnull_domain dom;
|
||||||
};
|
};
|
||||||
@ -2331,6 +2338,7 @@ enum remote_procedure {
|
|||||||
REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201,
|
REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201,
|
||||||
REMOTE_PROC_DOMAIN_IS_UPDATED = 202,
|
REMOTE_PROC_DOMAIN_IS_UPDATED = 202,
|
||||||
REMOTE_PROC_GET_SYSINFO = 203,
|
REMOTE_PROC_GET_SYSINFO = 203,
|
||||||
|
REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS = 204,
|
||||||
};
|
};
|
||||||
typedef enum remote_procedure remote_procedure;
|
typedef enum remote_procedure remote_procedure;
|
||||||
|
|
||||||
@ -2448,6 +2456,7 @@ extern bool_t xdr_remote_domain_get_max_memory_args (XDR *, remote_domain_get_m
|
|||||||
extern bool_t xdr_remote_domain_get_max_memory_ret (XDR *, remote_domain_get_max_memory_ret*);
|
extern bool_t xdr_remote_domain_get_max_memory_ret (XDR *, remote_domain_get_max_memory_ret*);
|
||||||
extern bool_t xdr_remote_domain_set_max_memory_args (XDR *, remote_domain_set_max_memory_args*);
|
extern bool_t xdr_remote_domain_set_max_memory_args (XDR *, remote_domain_set_max_memory_args*);
|
||||||
extern bool_t xdr_remote_domain_set_memory_args (XDR *, remote_domain_set_memory_args*);
|
extern bool_t xdr_remote_domain_set_memory_args (XDR *, remote_domain_set_memory_args*);
|
||||||
|
extern bool_t xdr_remote_domain_set_memory_flags_args (XDR *, remote_domain_set_memory_flags_args*);
|
||||||
extern bool_t xdr_remote_domain_get_info_args (XDR *, remote_domain_get_info_args*);
|
extern bool_t xdr_remote_domain_get_info_args (XDR *, remote_domain_get_info_args*);
|
||||||
extern bool_t xdr_remote_domain_get_info_ret (XDR *, remote_domain_get_info_ret*);
|
extern bool_t xdr_remote_domain_get_info_ret (XDR *, remote_domain_get_info_ret*);
|
||||||
extern bool_t xdr_remote_domain_save_args (XDR *, remote_domain_save_args*);
|
extern bool_t xdr_remote_domain_save_args (XDR *, remote_domain_save_args*);
|
||||||
@ -2796,6 +2805,7 @@ extern bool_t xdr_remote_domain_get_max_memory_args ();
|
|||||||
extern bool_t xdr_remote_domain_get_max_memory_ret ();
|
extern bool_t xdr_remote_domain_get_max_memory_ret ();
|
||||||
extern bool_t xdr_remote_domain_set_max_memory_args ();
|
extern bool_t xdr_remote_domain_set_max_memory_args ();
|
||||||
extern bool_t xdr_remote_domain_set_memory_args ();
|
extern bool_t xdr_remote_domain_set_memory_args ();
|
||||||
|
extern bool_t xdr_remote_domain_set_memory_flags_args ();
|
||||||
extern bool_t xdr_remote_domain_get_info_args ();
|
extern bool_t xdr_remote_domain_get_info_args ();
|
||||||
extern bool_t xdr_remote_domain_get_info_ret ();
|
extern bool_t xdr_remote_domain_get_info_ret ();
|
||||||
extern bool_t xdr_remote_domain_save_args ();
|
extern bool_t xdr_remote_domain_save_args ();
|
||||||
|
@ -641,6 +641,12 @@ struct remote_domain_set_memory_args {
|
|||||||
unsigned hyper memory;
|
unsigned hyper memory;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct remote_domain_set_memory_flags_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
unsigned hyper memory;
|
||||||
|
unsigned int flags;
|
||||||
|
};
|
||||||
|
|
||||||
struct remote_domain_get_info_args {
|
struct remote_domain_get_info_args {
|
||||||
remote_nonnull_domain dom;
|
remote_nonnull_domain dom;
|
||||||
};
|
};
|
||||||
@ -2103,7 +2109,8 @@ enum remote_procedure {
|
|||||||
|
|
||||||
REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201,
|
REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201,
|
||||||
REMOTE_PROC_DOMAIN_IS_UPDATED = 202,
|
REMOTE_PROC_DOMAIN_IS_UPDATED = 202,
|
||||||
REMOTE_PROC_GET_SYSINFO = 203
|
REMOTE_PROC_GET_SYSINFO = 203,
|
||||||
|
REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS = 204
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Notice how the entries are grouped in sets of 10 ?
|
* Notice how the entries are grouped in sets of 10 ?
|
||||||
|
@ -340,6 +340,11 @@ struct remote_domain_set_memory_args {
|
|||||||
remote_nonnull_domain dom;
|
remote_nonnull_domain dom;
|
||||||
uint64_t memory;
|
uint64_t memory;
|
||||||
};
|
};
|
||||||
|
struct remote_domain_set_memory_flags_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
uint64_t memory;
|
||||||
|
u_int flags;
|
||||||
|
};
|
||||||
struct remote_domain_get_info_args {
|
struct remote_domain_get_info_args {
|
||||||
remote_nonnull_domain dom;
|
remote_nonnull_domain dom;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user