3e5111
From 552fbd4c0707d08e4b67b64a462f0d1609a5ac38 Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <552fbd4c0707d08e4b67b64a462f0d1609a5ac38@dist-git>
3e5111
From: Jiri Denemark <jdenemar@redhat.com>
3e5111
Date: Thu, 6 Apr 2017 13:52:30 +0200
3e5111
Subject: [PATCH] qemu: Fix regression when hyperv/vendor_id feature is used
3e5111
3e5111
qemuProcessVerifyHypervFeatures is supposed to check whether all
3e5111
requested hyperv features were actually honored by QEMU/KVM. This is
3e5111
done by checking the corresponding CPUID bits reported by the virtual
3e5111
CPU. In other words, it doesn't work for string properties, such as
3e5111
VIR_DOMAIN_HYPERV_VENDOR_ID (there is no CPUID bit we could check). We
3e5111
could theoretically check all 96 bits corresponding to the vendor
3e5111
string, but luckily we don't have to check the feature at all. If QEMU
3e5111
is too old to support hyperv features, the domain won't even start.
3e5111
Otherwise, it is always supported.
3e5111
3e5111
Without this patch, libvirt refuses to start a domain which contains
3e5111
3e5111
  <features>
3e5111
    <hyperv>
3e5111
      <vendor_id state='on' value='...'/>
3e5111
    </hyperv>
3e5111
  </features>
3e5111
3e5111
reporting internal error: "unknown CPU feature __kvm_hv_vendor_id.
3e5111
3e5111
This regression was introduced by commit v3.1.0-186-ge9dbe7011, which
3e5111
(by fixing the virCPUDataCheckFeature condition in
3e5111
qemuProcessVerifyHypervFeatures) revealed an old bug in the feature
3e5111
verification code. It's been there ever since the verification was
3e5111
implemented by commit v1.3.3-rc1-5-g95bbe4bf5, which effectively did not
3e5111
check VIR_DOMAIN_HYPERV_VENDOR_ID at all.
3e5111
3e5111
https://bugzilla.redhat.com/show_bug.cgi?id=1439424
3e5111
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
(cherry picked from commit ae102b5d7bccd29bc6015a3e0acefeaa90d097ac)
3e5111
3e5111
https://bugzilla.redhat.com/show_bug.cgi?id=1439736
3e5111
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
---
3e5111
 src/qemu/qemu_process.c | 6 +++++-
3e5111
 1 file changed, 5 insertions(+), 1 deletion(-)
3e5111
3e5111
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
3e5111
index a20beb13c..039b3911c 100644
3e5111
--- a/src/qemu/qemu_process.c
3e5111
+++ b/src/qemu/qemu_process.c
3e5111
@@ -3793,6 +3793,10 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
3e5111
     int rc;
3e5111
 
3e5111
     for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
3e5111
+        /* always supported string property */
3e5111
+        if (i == VIR_DOMAIN_HYPERV_VENDOR_ID)
3e5111
+            continue;
3e5111
+
3e5111
         if (def->hyperv_features[i] != VIR_TRISTATE_SWITCH_ON)
3e5111
             continue;
3e5111
 
3e5111
@@ -3821,13 +3825,13 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
3e5111
         case VIR_DOMAIN_HYPERV_SYNIC:
3e5111
         case VIR_DOMAIN_HYPERV_STIMER:
3e5111
         case VIR_DOMAIN_HYPERV_RESET:
3e5111
-        case VIR_DOMAIN_HYPERV_VENDOR_ID:
3e5111
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
3e5111
                            _("host doesn't support hyperv '%s' feature"),
3e5111
                            virDomainHypervTypeToString(i));
3e5111
             return -1;
3e5111
 
3e5111
         /* coverity[dead_error_begin] */
3e5111
+        case VIR_DOMAIN_HYPERV_VENDOR_ID:
3e5111
         case VIR_DOMAIN_HYPERV_LAST:
3e5111
             break;
3e5111
         }
3e5111
-- 
3e5111
2.12.2
3e5111