提交 b3ef7efa 编写于 作者: J Jiri Denemark

qemu: Use virDomainCapsCPUUsable in qemuMonitorCPUDefInfo

While virDomainCapsCPUModel structure contains 'usable' field with
virDomainCapsCPUUsable type, the lower level structure specific to QEMU
driver used virTriStateBool for the same thing and we had to translate
between them.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 7f091cb6
......@@ -2485,14 +2485,9 @@ virQEMUCapsFetchCPUDefinitions(qemuMonitorPtr mon,
goto cleanup;
for (i = 0; i < defs->ncpus; i++) {
virDomainCapsCPUUsable usable = VIR_DOMCAPS_CPU_USABLE_UNKNOWN;
if (defs->cpus[i].usable == VIR_TRISTATE_BOOL_YES)
usable = VIR_DOMCAPS_CPU_USABLE_YES;
else if (defs->cpus[i].usable == VIR_TRISTATE_BOOL_NO)
usable = VIR_DOMCAPS_CPU_USABLE_NO;
if (virDomainCapsCPUModelsAddSteal(models, &defs->cpus[i].name, usable,
if (virDomainCapsCPUModelsAddSteal(models,
&defs->cpus[i].name,
defs->cpus[i].usable,
&defs->cpus[i].blockers) < 0)
goto cleanup;
}
......
......@@ -1088,7 +1088,7 @@ typedef struct _qemuMonitorCPUDefInfo qemuMonitorCPUDefInfo;
typedef qemuMonitorCPUDefInfo *qemuMonitorCPUDefInfoPtr;
struct _qemuMonitorCPUDefInfo {
virTristateBool usable;
virDomainCapsCPUUsable usable;
char *name;
char **blockers; /* NULL-terminated string list */
};
......
......@@ -5634,11 +5634,11 @@ qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon,
len = virJSONValueArraySize(blockers);
if (len == 0) {
cpu->usable = VIR_TRISTATE_BOOL_YES;
cpu->usable = VIR_DOMCAPS_CPU_USABLE_YES;
continue;
}
cpu->usable = VIR_TRISTATE_BOOL_NO;
cpu->usable = VIR_DOMCAPS_CPU_USABLE_NO;
if (VIR_ALLOC_N(cpu->blockers, len + 1) < 0)
return -1;
......
......@@ -478,11 +478,11 @@ testQemuMonitorJSONGetCPUDefinitions(const void *opaque)
} while (0)
#define CHECK(i, wantname) \
CHECK_FULL(i, wantname, VIR_TRISTATE_BOOL_ABSENT)
CHECK_FULL(i, wantname, VIR_DOMCAPS_CPU_USABLE_UNKNOWN)
#define CHECK_USABLE(i, wantname, usable) \
CHECK_FULL(i, wantname, \
usable ? VIR_TRISTATE_BOOL_YES : VIR_TRISTATE_BOOL_NO)
usable ? VIR_DOMCAPS_CPU_USABLE_YES : VIR_DOMCAPS_CPU_USABLE_NO)
CHECK(0, "qemu64");
CHECK_USABLE(1, "Opteron_G4", false);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册