[libvirt PATCH 4/5] qemu: Validate the kvm-no-adjvtime CPU feature

Ján Tomko jtomko at redhat.com
Sun Feb 2 13:32:02 UTC 2020


On Fri, Jan 31, 2020 at 05:39:51PM +0100, Andrea Bolognani wrote:
>Error out if the QEMU binary doesn't support it.
>
>Signed-off-by: Andrea Bolognani <abologna at redhat.com>
>---
> src/qemu/qemu_domain.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
>diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
>index d3045b4bcd..8b0c91d6c1 100644
>--- a/src/qemu/qemu_domain.c
>+++ b/src/qemu/qemu_domain.c
>@@ -4625,7 +4625,8 @@ qemuDomainDefSetDefaultCPU(virDomainDefPtr def,
>
>
> static int
>-qemuDomainDefCPUPostParse(virDomainDefPtr def)
>+qemuDomainDefCPUPostParse(virDomainDefPtr def,
>+                          virQEMUCapsPtr qemuCaps)
> {
>     virCPUFeatureDefPtr sveFeature = NULL;
>     bool sveVectorLengthsProvided = false;
>@@ -4696,6 +4697,15 @@ qemuDomainDefCPUPostParse(virDomainDefPtr def)
>         } else if (STRPREFIX(feature->name, "sve")) {
>             sveVectorLengthsProvided = true;
>         }
>+
>+        if (STREQ(feature->name, "kvm-no-adjvtime") &&
>+            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_KVM_NO_ADJVTIME))
>+        {
>+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
>+                           _("The '%s' feature is not supported by this "
>+                             "QEMU binary"), feature->name);
>+            return -1;

Either qemuDomain.*Validate or qemuProcessVerifyCPU would be a better
place for this check.

Jano

>+        }
>     }
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200202/9863e74e/attachment-0001.sig>


More information about the libvir-list mailing list