On 09/12/2016 11:50 AM, Michal Privoznik wrote: > On 20.07.2016 21:08, Joao Martins wrote: >> Implement support for "virsh cpu-compare" so that we can calculate >> common cpu element between a pool of hosts, which had a requirement >> of providing host cpu description. >> >> Signed-off-by: Joao Martins <joao.m.mart...@oracle.com> >> --- >> src/libxl/libxl_driver.c | 38 ++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 38 insertions(+) >> >> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c >> index f153f69..977e9b5 100644 >> --- a/src/libxl/libxl_driver.c >> +++ b/src/libxl/libxl_driver.c >> @@ -5770,6 +5770,43 @@ libxlConnectGetDomainCapabilities(virConnectPtr conn, >> } >> > > You need to include cpu.h in this patch otherwise cpuCompareXML() which > is used below is left undefined. Before submission I always compile and test plus make {syntax-,}check. Wonder why I haven't noticed this :(
>> +static int >> +libxlConnectCompareCPU(virConnectPtr conn, >> + const char *xmlDesc, >> + unsigned int flags) >> +{ >> + libxlDriverPrivatePtr driver = conn->privateData; >> + libxlDriverConfigPtr cfg; >> + int ret = VIR_CPU_COMPARE_ERROR; >> + bool failIncompatible; >> + >> + virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE, >> + VIR_CPU_COMPARE_ERROR); >> + >> + if (virConnectCompareCPUEnsureACL(conn) < 0) >> + return ret; >> + >> + failIncompatible = !!(flags & >> VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE); >> + >> + cfg = libxlDriverConfigGet(driver); >> + >> + if (!cfg->caps->host.cpu || >> + !cfg->caps->host.cpu->model) { >> + if (failIncompatible) { >> + virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", >> + _("cannot get host CPU capabilities")); >> + } else { >> + VIR_WARN("cannot get host CPU capabilities"); >> + ret = VIR_CPU_COMPARE_INCOMPATIBLE; >> + } >> + } else { >> + ret = cpuCompareXML(cfg->caps->host.cpu, xmlDesc, failIncompatible); >> + } >> + >> + virObjectUnref(cfg); >> + return ret; >> +} >> + >> static virHypervisorDriver libxlHypervisorDriver = { >> .name = LIBXL_DRIVER_NAME, >> .connectOpen = libxlConnectOpen, /* 0.9.0 */ >> @@ -5872,6 +5909,7 @@ static virHypervisorDriver libxlHypervisorDriver = { >> .nodeGetSecurityModel = libxlNodeGetSecurityModel, /* 1.2.16 */ >> .domainInterfaceAddresses = libxlDomainInterfaceAddresses, /* 1.3.5 */ >> .connectGetDomainCapabilities = libxlConnectGetDomainCapabilities, /* >> 2.0.0 */ >> + .connectCompareCPU = libxlConnectCompareCPU, /* 2.1.0 */ >> }; > > Actually, 2.3.0 now, sorry for such delay. Thanks again! Joao -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list