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@xxxxxxxxxx> --- Notes: Version 3: - new patch src/qemu/qemu_capabilities.c | 11 +++-------- src/qemu/qemu_monitor.h | 2 +- src/qemu/qemu_monitor_json.c | 4 ++-- tests/qemumonitorjsontest.c | 4 ++-- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 5136fe9202..2a93488520 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2486,14 +2486,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; } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 629379802c..0eed8b3f9e 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1107,7 +1107,7 @@ typedef struct _qemuMonitorCPUDefInfo qemuMonitorCPUDefInfo; typedef qemuMonitorCPUDefInfo *qemuMonitorCPUDefInfoPtr; struct _qemuMonitorCPUDefInfo { - virTristateBool usable; + virDomainCapsCPUUsable usable; char *name; char **blockers; /* NULL-terminated string list */ }; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a6cf70c70a..54963233e6 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5638,11 +5638,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; diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 81680d97f8..16a1d40a56 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -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); -- 2.23.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list