On 7/25/19 8:26 PM, Collin Walling wrote:
[...]
>> +
>> +virCPUCompareResult
>> +virQEMUCapsCPUModelComparison(virQEMUCapsPtr qemuCaps,
>> + const char *libDir,
>> + uid_t runUid,
>> + gid_t runGid,
>> + virCPUDefPtr cpu_a,
>> + virCPUDefPtr cpu_b,
>> + bool failIncompatible)
>> +{
>> + qemuProcessQMPPtr proc = NULL;
>> + qemuMonitorCPUModelInfoPtr result = NULL;
Set ret = VIR_CPU_COMPARE_INCOMPATIBLE
>> + int ret = -1;
>> +
>> + if (!(proc = qemuProcessQMPNew(qemuCaps->binary, libDir,
>> + runUid, runGid, false)))
>> + goto cleanup;
>> +
>> + if (qemuProcessQMPStart(proc) < 0)
>> + goto cleanup;
>> +
>> + if (qemuMonitorGetCPUModelComparison(proc->mon, cpu_a->model,
>> + cpu_a->nfeatures,
>> cpu_a->features,
>> + cpu_b->model,
>> cpu_b->nfeatures,
>> + cpu_b->features, &result) <
0)
>> + goto cleanup;
>> +
>> + if (STREQ(result->name, "incompatible") ||
>> + STREQ(result->name, "subset"))
>> + ret = VIR_CPU_COMPARE_INCOMPATIBLE;
>> + else if (STREQ(result->name, "identical"))
>> + ret = VIR_CPU_COMPARE_IDENTICAL;
>> + else if (STREQ(result->name, "superset"))
>> + ret = VIR_CPU_COMPARE_SUPERSET;
and change this:
>> +
>> + if (failIncompatible && ret == VIR_CPU_COMPARE_INCOMPATIBLE) {
>> + ret = VIR_CPU_COMPARE_ERROR;
>> + virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL);
>> + }
>> +
>> + cleanup:
>> + if (ret < 0)
>> + virQEMUCapsLogProbeFailure(qemuCaps->binary);
To this:
cleanup:
if (failIncompatible && ret == VIR_CPU_COMPARE_INCOMPATIBLE) {
ret = VIR_CPU_COMPARE_ERROR;
virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL);
virQEMUCapsLogProbeFailure(qemuCaps->binary);
}
>> +
>> + qemuMonitorCPUModelInfoFree(result);
>> + qemuProcessQMPFree(proc);
>> + return ret;
>> +}
And now the output will look like this when the xml contains an
erroneous CPU model or feature:
virsh hypervisor-cpu-compare cpufail.xml
CPU described in cpufail.xml is incompatible with the CPU provided by
hypervisor on the host
virsh hypervisor-cpu-compare cpufail.xml --error
error: Failed to compare hypervisor CPU with cpufail.xml
error: the CPU is incompatible with host CPU
If this output is not acceptable, then perhaps we should further explore
option 2 that I described on patch 5.
[...]
Please see my response in patch 5.
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
--
Mit freundlichen Grüßen/Kind regards
Boris Fiuczynski
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Matthias Hartmann
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294