Wire protocol format and dispatcher for virConnectBaselineCPU

This commit is contained in:
Jiri Denemark 2010-02-02 14:39:05 +01:00
parent 387941fb62
commit a3d22efd77
8 changed files with 99 additions and 1 deletions

View File

@ -5365,6 +5365,31 @@ remoteDispatchCpuCompare(struct qemud_server *server ATTRIBUTE_UNUSED,
}
static int
remoteDispatchCpuBaseline(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *err,
remote_cpu_baseline_args *args,
remote_cpu_baseline_ret *ret)
{
char *cpu;
cpu = virConnectBaselineCPU(conn,
(const char **) args->xmlCPUs.xmlCPUs_val,
args->xmlCPUs.xmlCPUs_len,
args->flags);
if (cpu == NULL) {
remoteDispatchConnError(err, conn);
return -1;
}
ret->cpu = cpu;
return 0;
}
/*----- Helpers. -----*/
/* get_nonnull_domain and get_nonnull_network turn an on-wire

View File

@ -137,3 +137,4 @@
remote_domain_memory_stats_args val_remote_domain_memory_stats_args;
remote_domain_attach_device_flags_args val_remote_domain_attach_device_flags_args;
remote_domain_detach_device_flags_args val_remote_domain_detach_device_flags_args;
remote_cpu_baseline_args val_remote_cpu_baseline_args;

View File

@ -50,6 +50,14 @@ static int remoteDispatchClose(
remote_error *err,
void *args,
void *ret);
static int remoteDispatchCpuBaseline(
struct qemud_server *server,
struct qemud_client *client,
virConnectPtr conn,
remote_message_header *hdr,
remote_error *err,
remote_cpu_baseline_args *args,
remote_cpu_baseline_ret *ret);
static int remoteDispatchCpuCompare(
struct qemud_server *server,
struct qemud_client *client,

View File

@ -117,3 +117,4 @@
remote_get_lib_version_ret val_remote_get_lib_version_ret;
remote_cpu_compare_ret val_remote_cpu_compare_ret;
remote_domain_memory_stats_ret val_remote_domain_memory_stats_ret;
remote_cpu_baseline_ret val_remote_cpu_baseline_ret;

View File

@ -812,3 +812,8 @@
.args_filter = (xdrproc_t) xdr_remote_domain_detach_device_flags_args,
.ret_filter = (xdrproc_t) xdr_void,
},
{ /* CpuBaseline => 162 */
.fn = (dispatch_fn) remoteDispatchCpuBaseline,
.args_filter = (xdrproc_t) xdr_remote_cpu_baseline_args,
.ret_filter = (xdrproc_t) xdr_remote_cpu_baseline_ret,
},

View File

@ -2937,6 +2937,28 @@ xdr_remote_cpu_compare_ret (XDR *xdrs, remote_cpu_compare_ret *objp)
return TRUE;
}
bool_t
xdr_remote_cpu_baseline_args (XDR *xdrs, remote_cpu_baseline_args *objp)
{
char **objp_cpp0 = (char **) (void *) &objp->xmlCPUs.xmlCPUs_val;
if (!xdr_array (xdrs, objp_cpp0, (u_int *) &objp->xmlCPUs.xmlCPUs_len, REMOTE_CPU_BASELINE_MAX,
sizeof (remote_nonnull_string), (xdrproc_t) xdr_remote_nonnull_string))
return FALSE;
if (!xdr_u_int (xdrs, &objp->flags))
return FALSE;
return TRUE;
}
bool_t
xdr_remote_cpu_baseline_ret (XDR *xdrs, remote_cpu_baseline_ret *objp)
{
if (!xdr_remote_nonnull_string (xdrs, &objp->cpu))
return FALSE;
return TRUE;
}
bool_t
xdr_remote_procedure (XDR *xdrs, remote_procedure *objp)
{

View File

@ -48,6 +48,7 @@ typedef remote_nonnull_string *remote_string;
#define REMOTE_SECURITY_DOI_MAX VIR_SECURITY_DOI_BUFLEN
#define REMOTE_SECRET_VALUE_MAX 65536
#define REMOTE_SECRET_UUID_LIST_MAX 16384
#define REMOTE_CPU_BASELINE_MAX 256
typedef char remote_uuid[VIR_UUID_BUFLEN];
@ -1663,6 +1664,20 @@ struct remote_cpu_compare_ret {
int result;
};
typedef struct remote_cpu_compare_ret remote_cpu_compare_ret;
struct remote_cpu_baseline_args {
struct {
u_int xmlCPUs_len;
remote_nonnull_string *xmlCPUs_val;
} xmlCPUs;
u_int flags;
};
typedef struct remote_cpu_baseline_args remote_cpu_baseline_args;
struct remote_cpu_baseline_ret {
remote_nonnull_string cpu;
};
typedef struct remote_cpu_baseline_ret remote_cpu_baseline_ret;
#define REMOTE_PROGRAM 0x20008086
#define REMOTE_PROTOCOL_VERSION 1
@ -1828,6 +1843,7 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_MEMORY_STATS = 159,
REMOTE_PROC_DOMAIN_ATTACH_DEVICE_FLAGS = 160,
REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS = 161,
REMOTE_PROC_CPU_BASELINE = 162,
};
typedef enum remote_procedure remote_procedure;
@ -2132,6 +2148,8 @@ extern bool_t xdr_remote_interface_is_active_args (XDR *, remote_interface_is_a
extern bool_t xdr_remote_interface_is_active_ret (XDR *, remote_interface_is_active_ret*);
extern bool_t xdr_remote_cpu_compare_args (XDR *, remote_cpu_compare_args*);
extern bool_t xdr_remote_cpu_compare_ret (XDR *, remote_cpu_compare_ret*);
extern bool_t xdr_remote_cpu_baseline_args (XDR *, remote_cpu_baseline_args*);
extern bool_t xdr_remote_cpu_baseline_ret (XDR *, remote_cpu_baseline_ret*);
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*);
@ -2410,6 +2428,8 @@ extern bool_t xdr_remote_interface_is_active_args ();
extern bool_t xdr_remote_interface_is_active_ret ();
extern bool_t xdr_remote_cpu_compare_args ();
extern bool_t xdr_remote_cpu_compare_ret ();
extern bool_t xdr_remote_cpu_baseline_args ();
extern bool_t xdr_remote_cpu_baseline_ret ();
extern bool_t xdr_remote_procedure ();
extern bool_t xdr_remote_message_type ();
extern bool_t xdr_remote_message_status ();

View File

@ -155,6 +155,11 @@ const REMOTE_SECRET_VALUE_MAX = 65536;
*/
const REMOTE_SECRET_UUID_LIST_MAX = 16384;
/*
* Upper limit on list of CPUs accepted when computing a baseline CPU.
*/
const REMOTE_CPU_BASELINE_MAX = 256;
/* UUID. VIR_UUID_BUFLEN definition comes from libvirt.h */
typedef opaque remote_uuid[VIR_UUID_BUFLEN];
@ -1473,6 +1478,16 @@ struct remote_cpu_compare_ret {
};
struct remote_cpu_baseline_args {
remote_nonnull_string xmlCPUs<REMOTE_CPU_BASELINE_MAX>;
unsigned flags;
};
struct remote_cpu_baseline_ret {
remote_nonnull_string cpu;
};
/*----- Protocol. -----*/
/* Define the program number, protocol version and procedure numbers here. */
@ -1656,7 +1671,8 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_MEMORY_STATS = 159,
REMOTE_PROC_DOMAIN_ATTACH_DEVICE_FLAGS = 160,
REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS = 161
REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS = 161,
REMOTE_PROC_CPU_BASELINE = 162
/*
* Notice how the entries are grouped in sets of 10 ?