mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-10-23 23:34:16 +03:00
virt-host-validate: warn if kvm_hv is not loaded for POWER hosts
POWER hosts does not implement CPU virtualization extensions like x86 or s390x. Instead, all bare-metal POWER hosts are considered to be virtualization ready. For POWER, the validation is done by checking if the virtualization module kvm_hv is loaded in the host. If not, we should warn the user about it. Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
committed by
Michal Privoznik
parent
1cf2f412ed
commit
4653a5194c
@@ -412,3 +412,30 @@ int virHostValidateIOMMU(const char *hvname,
|
|||||||
virHostMsgPass();
|
virHostMsgPass();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool virHostKernelModuleIsLoaded(const char *module)
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
bool ret = false;
|
||||||
|
|
||||||
|
if (!(fp = fopen("/proc/modules", "r")))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
do {
|
||||||
|
char line[1024];
|
||||||
|
|
||||||
|
if (!fgets(line, sizeof(line), fp))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (STRPREFIX(line, module)) {
|
||||||
|
ret = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} while (1);
|
||||||
|
|
||||||
|
VIR_FORCE_FCLOSE(fp);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|||||||
@@ -82,3 +82,5 @@ int virHostValidateCGroupControllers(const char *hvname,
|
|||||||
|
|
||||||
int virHostValidateIOMMU(const char *hvname,
|
int virHostValidateIOMMU(const char *hvname,
|
||||||
virHostValidateLevel level);
|
virHostValidateLevel level);
|
||||||
|
|
||||||
|
bool virHostKernelModuleIsLoaded(const char *module);
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ int virHostValidateQEMU(void)
|
|||||||
if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SIE))
|
if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SIE))
|
||||||
hasHwVirt = true;
|
hasHwVirt = true;
|
||||||
break;
|
break;
|
||||||
|
case VIR_ARCH_PPC64:
|
||||||
|
case VIR_ARCH_PPC64LE:
|
||||||
|
hasVirtFlag = true;
|
||||||
|
hasHwVirt = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
hasHwVirt = false;
|
hasHwVirt = false;
|
||||||
}
|
}
|
||||||
@@ -84,6 +89,16 @@ int virHostValidateQEMU(void)
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (arch == VIR_ARCH_PPC64 || arch == VIR_ARCH_PPC64LE) {
|
||||||
|
virHostMsgCheck("QEMU", "%s", _("for PowerPC KVM module loaded"));
|
||||||
|
|
||||||
|
if (!virHostKernelModuleIsLoaded("kvm_hv"))
|
||||||
|
virHostMsgFail(VIR_HOST_VALIDATE_WARN,
|
||||||
|
_("Load kvm_hv for better performance"));
|
||||||
|
else
|
||||||
|
virHostMsgPass();
|
||||||
|
}
|
||||||
|
|
||||||
virBitmapFree(flags);
|
virBitmapFree(flags);
|
||||||
|
|
||||||
if (virHostValidateDeviceExists("QEMU", "/dev/vhost-net",
|
if (virHostValidateDeviceExists("QEMU", "/dev/vhost-net",
|
||||||
|
|||||||
Reference in New Issue
Block a user