提交 5641222e 编写于 作者: M Matthias Bolte

remote generator, daemon: Handle the CPU functions

They require additional special cases.
上级 900b18f4
......@@ -3064,70 +3064,6 @@ cleanup:
return rv;
}
static int
remoteDispatchCpuCompare(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_cpu_compare_args *args,
remote_cpu_compare_ret *ret)
{
int result;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if ((result = virConnectCompareCPU(conn, args->xml, args->flags)) == VIR_CPU_COMPARE_ERROR)
goto cleanup;
ret->result = result;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
return rv;
}
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 *rerr,
remote_cpu_baseline_args *args,
remote_cpu_baseline_ret *ret)
{
char *cpu;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(cpu = virConnectBaselineCPU(conn,
(const char **) args->xmlCPUs.xmlCPUs_val,
args->xmlCPUs.xmlCPUs_len,
args->flags)))
goto cleanup;
ret->cpu = cpu;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
return rv;
}
static int
remoteDispatchDomainGetJobInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......
......@@ -15,9 +15,65 @@
/* remoteDispatchClose has to be implemented manually */
/* remoteDispatchCpuBaseline has to be implemented manually */
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 *rerr,
remote_cpu_baseline_args *args,
remote_cpu_baseline_ret *ret)
{
int rv = -1;
char *cpu;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if ((cpu = virConnectBaselineCPU(conn, (const char **)args->xmlCPUs.xmlCPUs_val, args->xmlCPUs.xmlCPUs_len, args->flags)) == NULL)
goto cleanup;
ret->cpu = cpu;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
return rv;
}
static int
remoteDispatchCPUCompare(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_cpu_compare_args *args,
remote_cpu_compare_ret *ret)
{
int rv = -1;
int result;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if ((result = virConnectCompareCPU(conn, args->xml, args->flags)) == VIR_CPU_COMPARE_ERROR)
goto cleanup;
ret->result = result;
rv = 0;
/* remoteDispatchCpuCompare has to be implemented manually */
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
return rv;
}
static int
remoteDispatchDomainAbortJob(
......@@ -524,7 +580,7 @@ cleanup:
/* remoteDispatchDomainGetMemoryParameters has to be implemented manually */
static int
remoteDispatchDomainGetOsType(
remoteDispatchDomainGetOSType(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
......
......@@ -50,7 +50,7 @@ static int remoteDispatchClose(
remote_error *rerr,
void *args,
void *ret);
static int remoteDispatchCpuBaseline(
static int remoteDispatchCPUBaseline(
struct qemud_server *server,
struct qemud_client *client,
virConnectPtr conn,
......@@ -58,7 +58,7 @@ static int remoteDispatchCpuBaseline(
remote_error *rerr,
remote_cpu_baseline_args *args,
remote_cpu_baseline_ret *ret);
static int remoteDispatchCpuCompare(
static int remoteDispatchCPUCompare(
struct qemud_server *server,
struct qemud_client *client,
virConnectPtr conn,
......@@ -274,7 +274,7 @@ static int remoteDispatchDomainGetMemoryParameters(
remote_error *rerr,
remote_domain_get_memory_parameters_args *args,
remote_domain_get_memory_parameters_ret *ret);
static int remoteDispatchDomainGetOsType(
static int remoteDispatchDomainGetOSType(
struct qemud_server *server,
struct qemud_client *client,
virConnectPtr conn,
......
......@@ -97,8 +97,8 @@
.args_filter = (xdrproc_t) xdr_remote_domain_get_max_vcpus_args,
.ret_filter = (xdrproc_t) xdr_remote_domain_get_max_vcpus_ret,
},
{ /* DomainGetOsType => 19 */
.fn = (dispatch_fn) remoteDispatchDomainGetOsType,
{ /* DomainGetOSType => 19 */
.fn = (dispatch_fn) remoteDispatchDomainGetOSType,
.args_filter = (xdrproc_t) xdr_remote_domain_get_os_type_args,
.ret_filter = (xdrproc_t) xdr_remote_domain_get_os_type_ret,
},
......@@ -792,8 +792,8 @@
.args_filter = (xdrproc_t) xdr_void,
.ret_filter = (xdrproc_t) xdr_remote_get_lib_version_ret,
},
{ /* CpuCompare => 158 */
.fn = (dispatch_fn) remoteDispatchCpuCompare,
{ /* CPUCompare => 158 */
.fn = (dispatch_fn) remoteDispatchCPUCompare,
.args_filter = (xdrproc_t) xdr_remote_cpu_compare_args,
.ret_filter = (xdrproc_t) xdr_remote_cpu_compare_ret,
},
......@@ -812,8 +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,
{ /* CPUBaseline => 162 */
.fn = (dispatch_fn) remoteDispatchCPUBaseline,
.args_filter = (xdrproc_t) xdr_remote_cpu_baseline_args,
.ret_filter = (xdrproc_t) xdr_remote_cpu_baseline_ret,
},
......
......@@ -34,7 +34,8 @@ sub name_to_ProcName {
@elems = map ucfirst, @elems;
@elems = map { $_ =~ s/Nwfilter/NWFilter/; $_ =~ s/Xml/XML/;
$_ =~ s/Uri/URI/; $_ =~ s/Uuid/UUID/; $_ =~ s/Id/ID/;
$_ =~ s/Mac/MAC/; $_ } @elems;
$_ =~ s/Mac/MAC/; $_ =~ s/Cpu/CPU/; $_ =~ s/Os/OS/;
$_ } @elems;
join "", @elems
}
......@@ -257,8 +258,6 @@ elsif ($opt_b) {
"AuthSaslStep",
"AuthPolkit",
"CpuBaseline",
"CpuCompare",
"DomainBlockPeek",
"DomainBlockStats",
"DomainCreateWithFlags",
......@@ -388,6 +387,8 @@ elsif ($opt_b) {
if ($calls{$_}->{ProcName} eq "SecretSetValue") {
push(@args_list, "(const unsigned char *)args->$1.$1_val");
} elsif ($calls{$_}->{ProcName} eq "CPUBaseline") {
push(@args_list, "(const char **)args->$1.$1_val");
} else {
push(@args_list, "args->$1.$1_val");
}
......@@ -491,8 +492,13 @@ elsif ($opt_b) {
$single_ret_by_ref = 1;
} else {
$single_ret_by_ref = 0;
if ($calls{$_}->{ProcName} eq "CPUCompare") {
$single_ret_check = " == VIR_CPU_COMPARE_ERROR";
} else {
$single_ret_check = " < 0";
}
}
} elsif ($ret_member =~ m/hyper (\S+)<(\S+)>;/) {
push(@vars_list, "int len");
push(@ret_list, "ret->$1.$1_len = len;");
......@@ -597,8 +603,10 @@ elsif ($opt_b) {
$prefix = "Drv"
} elsif ($calls{$_}->{ProcName} =~ m/^(\S+)DumpXML$/) {
$proc_name = "${1}GetXMLDesc"
} elsif ($calls{$_}->{ProcName} eq "DomainGetOsType") {
$proc_name = "DomainGetOSType"
} elsif ($calls{$_}->{ProcName} eq "CPUBaseline") {
$proc_name = "ConnectBaselineCPU"
} elsif ($calls{$_}->{ProcName} eq "CPUCompare") {
$proc_name = "ConnectCompareCPU"
}
if ($single_ret_as_list) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册