mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
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: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
7f091cb6ed
commit
b3ef7efaa5
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user