[libvirt] [PATCH] tools: virt-host-validate: fix KVM check on s390

Andrea Bolognani abologna at redhat.com
Tue Mar 29 13:33:33 UTC 2016


On Tue, 2016-03-29 at 14:01 +0100, Daniel P. Berrange wrote:
> > >      virHostMsgCheck("QEMU", "%s", ("for hardware virtualization"));
> > >      if (virHostValidateHasCPUFlag("svm") ||
> > > -        virHostValidateHasCPUFlag("vmx")) {
> > > +        virHostValidateHasCPUFlag("vmx") ||
> > > +        virHostValidateHasCPUFlag("sie")) {
> > >          virHostMsgPass();
> > >          if (virHostValidateDeviceExists("QEMU", "/dev/kvm",
> > >                                          VIR_HOST_VALIDATE_FAIL,
> 
> What we should do here though is check the host architecture before
> checking CPU flags.
> 
> eg you'll want to make this code do something like this
> 
>        bool hasHWVirt = false;
>        switch (virArchFromHost()) {
>            case VIR_ARCH_I686:
>            case VIR_ARCH_X86_64:
>              if (virHostValidateHasCPUFlag("svm") ||
>                  virHostValidateHasCPUFlag("vmx"))
>        hasHWVirt = true;
>              break;
>            case VIR_ARCH_S390:
>            case VIR_ARCH_S390X:
>              if (virHostValidateHasCPUFlag("sie"))
>            hasHWVirt = true;
>        }
>        if (hasHWVirt) {
>        ....do the /dev/kvm check...
>        }

... And I guess I should come up with suitable checks for
ppc64 and aarch64 as well :)

Cheers.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team




More information about the libvir-list mailing list