mirror of https://gitee.com/openkylin/libvirt.git
libxl: capsInitCPU: fail if we can't initialize host features
Introduced by:
commit 17322e5518
libxl: describe host cpu features based on hwcaps
with the justification that libxl_hwcaps does not have a stable
format across all version.
Even though the code would return '0' in the case of such failure,
it frees the 'cpu' pointer, while keeping it in caps->host.
Based on that, assume it does not happen in current usage.
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
parent
6b08d4b37d
commit
5f5d698053
|
@ -166,16 +166,17 @@ libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_info)
|
|||
cpu->threads = phy_info->threads_per_core;
|
||||
cpu->dies = 1;
|
||||
cpu->sockets = phy_info->nr_cpus / (cpu->cores * cpu->threads);
|
||||
caps->host.cpu = cpu;
|
||||
|
||||
ret = 0;
|
||||
|
||||
if (!(data = libxlCapsNodeData(cpu, phy_info->hw_cap)) ||
|
||||
cpuDecode(cpu, data, NULL) < 0) {
|
||||
VIR_WARN("Failed to initialize host cpu features");
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Failed to initialize host cpu features"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
caps->host.cpu = cpu;
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
virCPUDataFree(data);
|
||||
|
||||
|
|
Loading…
Reference in New Issue