render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Pablo Greco 40546a
From d2ef598bb59e613ce4a8b969ab9836604bd72727 Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <d2ef598bb59e613ce4a8b969ab9836604bd72727@dist-git>
Pablo Greco 40546a
From: Jiri Denemark <jdenemar@redhat.com>
Pablo Greco 40546a
Date: Fri, 21 Jun 2019 09:25:54 +0200
Pablo Greco 40546a
Subject: [PATCH] qemu: Probe host CPU after capabilities
Pablo Greco 40546a
MIME-Version: 1.0
Pablo Greco 40546a
Content-Type: text/plain; charset=UTF-8
Pablo Greco 40546a
Content-Transfer-Encoding: 8bit
Pablo Greco 40546a
Pablo Greco 40546a
The way we call query-cpu-model-expansion will rely on some capabilities
Pablo Greco 40546a
bits. Let's make sure all capabilities are set before probing host CPU.
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
(cherry picked from commit 6f6401fbae384c66ce6043ced30591050729a4ac)
Pablo Greco 40546a
Pablo Greco 40546a
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
Pablo Greco 40546a
Pablo Greco 40546a
Conflicts:
Pablo Greco 40546a
	src/qemu/qemu_capabilities.c
Pablo Greco 40546a
            - various refactors were not backported
Pablo Greco 40546a
Pablo Greco 40546a
	tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies
Pablo Greco 40546a
	tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies
Pablo Greco 40546a
            - QMP message IDs are different
Pablo Greco 40546a
Pablo Greco 40546a
	tests/qemucapabilitiesdata/caps_3.1.0.x86_64.replies
Pablo Greco 40546a
	tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies
Pablo Greco 40546a
            - missing
Pablo Greco 40546a
Pablo Greco 40546a
	tests/qemucapabilitiesdata/caps_4.1.0.x86_64.replies
Pablo Greco 40546a
            - QMP message IDs are different
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Pablo Greco 40546a
Message-Id: <cea249ba54be2d9dca6f523a14b0af608163323f.1561068591.git.jdenemar@redhat.com>
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 src/qemu/qemu_capabilities.c                  |  8 +++-
Pablo Greco 40546a
 .../caps_2.12.0.x86_64.replies                | 44 +++++++++----------
Pablo Greco 40546a
 .../caps_3.0.0.x86_64.replies                 | 40 ++++++++---------
Pablo Greco 40546a
 .../caps_4.1.0.x86_64.replies                 | 40 ++++++++---------
Pablo Greco 40546a
 4 files changed, 68 insertions(+), 64 deletions(-)
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
Pablo Greco 40546a
index beec9d1497..fb260eae96 100644
Pablo Greco 40546a
--- a/src/qemu/qemu_capabilities.c
Pablo Greco 40546a
+++ b/src/qemu/qemu_capabilities.c
Pablo Greco 40546a
@@ -4343,8 +4343,6 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
Pablo Greco 40546a
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_QMP_SCHEMA) &&
Pablo Greco 40546a
         virQEMUCapsProbeQMPSchemaCapabilities(qemuCaps, mon) < 0)
Pablo Greco 40546a
         goto cleanup;
Pablo Greco 40546a
-    if (virQEMUCapsProbeQMPHostCPU(qemuCaps, mon, false) < 0)
Pablo Greco 40546a
-        goto cleanup;
Pablo Greco 40546a
 
Pablo Greco 40546a
     /* 'intel-iommu' shows up as a device since 2.2.0, but can
Pablo Greco 40546a
      * not be used with -device until 2.7.0. Before that it
Pablo Greco 40546a
@@ -4394,6 +4392,12 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
Pablo Greco 40546a
             virQEMUCapsClear(qemuCaps, QEMU_CAPS_SEV_GUEST);
Pablo Greco 40546a
     }
Pablo Greco 40546a
 
Pablo Greco 40546a
+    /* The following probes rely on other previously probed capabilities.
Pablo Greco 40546a
+     * No capabilities bits should be set below this point. */
Pablo Greco 40546a
+
Pablo Greco 40546a
+    if (virQEMUCapsProbeQMPHostCPU(qemuCaps, mon, false) < 0)
Pablo Greco 40546a
+        goto cleanup;
Pablo Greco 40546a
+
Pablo Greco 40546a
     ret = 0;
Pablo Greco 40546a
  cleanup:
Pablo Greco 40546a
     return ret;
Pablo Greco 40546a
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies
Pablo Greco 40546a
index 66a5577e5e..ecfe3386c4 100644
Pablo Greco 40546a
--- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies
Pablo Greco 40546a
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies
Pablo Greco 40546a
@@ -19521,6 +19521,21 @@
Pablo Greco 40546a
   "id": "libvirt-50"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
+{
Pablo Greco 40546a
+  "execute": "query-sev-capabilities",
Pablo Greco 40546a
+  "id": "libvirt-51"
Pablo Greco 40546a
+}
Pablo Greco 40546a
+
Pablo Greco 40546a
+{
Pablo Greco 40546a
+  "return": {
Pablo Greco 40546a
+    "reduced-phys-bits": 1,
Pablo Greco 40546a
+    "cbitpos": 47,
Pablo Greco 40546a
+    "cert-chain": "AQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAA",
Pablo Greco 40546a
+    "pdh": "AQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAA"
Pablo Greco 40546a
+  },
Pablo Greco 40546a
+  "id": "libvirt-51"
Pablo Greco 40546a
+}
Pablo Greco 40546a
+
Pablo Greco 40546a
 {
Pablo Greco 40546a
   "execute": "query-cpu-model-expansion",
Pablo Greco 40546a
   "arguments": {
Pablo Greco 40546a
@@ -19529,7 +19544,7 @@
Pablo Greco 40546a
       "name": "host"
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-51"
Pablo Greco 40546a
+  "id": "libvirt-52"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -19719,7 +19734,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-51"
Pablo Greco 40546a
+  "id": "libvirt-52"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -19911,7 +19926,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-52"
Pablo Greco 40546a
+  "id": "libvirt-53"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -20166,7 +20181,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-52"
Pablo Greco 40546a
+  "id": "libvirt-53"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -20180,7 +20195,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-53"
Pablo Greco 40546a
+  "id": "libvirt-54"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -20370,7 +20385,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-53"
Pablo Greco 40546a
+  "id": "libvirt-54"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -20562,7 +20577,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-54"
Pablo Greco 40546a
+  "id": "libvirt-55"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -20817,21 +20832,6 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-54"
Pablo Greco 40546a
-}
Pablo Greco 40546a
-
Pablo Greco 40546a
-{
Pablo Greco 40546a
-  "execute": "query-sev-capabilities",
Pablo Greco 40546a
-  "id": "libvirt-55"
Pablo Greco 40546a
-}
Pablo Greco 40546a
-
Pablo Greco 40546a
-{
Pablo Greco 40546a
-  "return": {
Pablo Greco 40546a
-    "reduced-phys-bits": 1,
Pablo Greco 40546a
-    "cbitpos": 47,
Pablo Greco 40546a
-    "cert-chain": "AQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAA",
Pablo Greco 40546a
-    "pdh": "AQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAA"
Pablo Greco 40546a
-  },
Pablo Greco 40546a
   "id": "libvirt-55"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies
Pablo Greco 40546a
index 9f44eb4fae..7fea8587fd 100644
Pablo Greco 40546a
--- a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies
Pablo Greco 40546a
+++ b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies
Pablo Greco 40546a
@@ -20490,6 +20490,19 @@
Pablo Greco 40546a
   "id": "libvirt-50"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
+{
Pablo Greco 40546a
+  "execute": "query-sev-capabilities",
Pablo Greco 40546a
+  "id": "libvirt-51"
Pablo Greco 40546a
+}
Pablo Greco 40546a
+
Pablo Greco 40546a
+{
Pablo Greco 40546a
+  "id": "libvirt-51",
Pablo Greco 40546a
+  "error": {
Pablo Greco 40546a
+    "class": "GenericError",
Pablo Greco 40546a
+    "desc": "SEV feature is not available"
Pablo Greco 40546a
+  }
Pablo Greco 40546a
+}
Pablo Greco 40546a
+
Pablo Greco 40546a
 {
Pablo Greco 40546a
   "execute": "query-cpu-model-expansion",
Pablo Greco 40546a
   "arguments": {
Pablo Greco 40546a
@@ -20498,7 +20511,7 @@
Pablo Greco 40546a
       "name": "host"
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-51"
Pablo Greco 40546a
+  "id": "libvirt-52"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -20691,7 +20704,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-51"
Pablo Greco 40546a
+  "id": "libvirt-52"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -20886,7 +20899,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-52"
Pablo Greco 40546a
+  "id": "libvirt-53"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -21148,7 +21161,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-52"
Pablo Greco 40546a
+  "id": "libvirt-53"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -21162,7 +21175,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-53"
Pablo Greco 40546a
+  "id": "libvirt-54"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -21355,7 +21368,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-53"
Pablo Greco 40546a
+  "id": "libvirt-54"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -21550,7 +21563,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-54"
Pablo Greco 40546a
+  "id": "libvirt-55"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -21812,22 +21825,9 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-54"
Pablo Greco 40546a
-}
Pablo Greco 40546a
-
Pablo Greco 40546a
-{
Pablo Greco 40546a
-  "execute": "query-sev-capabilities",
Pablo Greco 40546a
   "id": "libvirt-55"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
-{
Pablo Greco 40546a
-  "id": "libvirt-55",
Pablo Greco 40546a
-  "error": {
Pablo Greco 40546a
-    "class": "GenericError",
Pablo Greco 40546a
-    "desc": "SEV feature is not available"
Pablo Greco 40546a
-  }
Pablo Greco 40546a
-}
Pablo Greco 40546a
-
Pablo Greco 40546a
 {
Pablo Greco 40546a
   "execute": "qmp_capabilities",
Pablo Greco 40546a
   "id": "libvirt-1"
Pablo Greco 40546a
diff --git a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.replies
Pablo Greco 40546a
index 82b320b1d0..5b4d7a8484 100644
Pablo Greco 40546a
--- a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.replies
Pablo Greco 40546a
+++ b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.replies
Pablo Greco 40546a
@@ -21315,6 +21315,19 @@
Pablo Greco 40546a
   "id": "libvirt-50"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
+{
Pablo Greco 40546a
+  "execute": "query-sev-capabilities",
Pablo Greco 40546a
+  "id": "libvirt-51"
Pablo Greco 40546a
+}
Pablo Greco 40546a
+
Pablo Greco 40546a
+{
Pablo Greco 40546a
+  "id": "libvirt-51",
Pablo Greco 40546a
+  "error": {
Pablo Greco 40546a
+    "class": "GenericError",
Pablo Greco 40546a
+    "desc": "SEV feature is not available"
Pablo Greco 40546a
+  }
Pablo Greco 40546a
+}
Pablo Greco 40546a
+
Pablo Greco 40546a
 {
Pablo Greco 40546a
   "execute": "query-cpu-model-expansion",
Pablo Greco 40546a
   "arguments": {
Pablo Greco 40546a
@@ -21323,7 +21336,7 @@
Pablo Greco 40546a
       "name": "host"
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-51"
Pablo Greco 40546a
+  "id": "libvirt-52"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -21529,7 +21542,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-51"
Pablo Greco 40546a
+  "id": "libvirt-52"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -21737,7 +21750,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-52"
Pablo Greco 40546a
+  "id": "libvirt-53"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -22018,7 +22031,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-52"
Pablo Greco 40546a
+  "id": "libvirt-53"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -22032,7 +22045,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-53"
Pablo Greco 40546a
+  "id": "libvirt-54"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -22238,7 +22251,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-53"
Pablo Greco 40546a
+  "id": "libvirt-54"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -22446,7 +22459,7 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-54"
Pablo Greco 40546a
+  "id": "libvirt-55"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 {
Pablo Greco 40546a
@@ -22727,22 +22740,9 @@
Pablo Greco 40546a
       }
Pablo Greco 40546a
     }
Pablo Greco 40546a
   },
Pablo Greco 40546a
-  "id": "libvirt-54"
Pablo Greco 40546a
-}
Pablo Greco 40546a
-
Pablo Greco 40546a
-{
Pablo Greco 40546a
-  "execute": "query-sev-capabilities",
Pablo Greco 40546a
   "id": "libvirt-55"
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
-{
Pablo Greco 40546a
-  "id": "libvirt-55",
Pablo Greco 40546a
-  "error": {
Pablo Greco 40546a
-    "class": "GenericError",
Pablo Greco 40546a
-    "desc": "SEV feature is not available"
Pablo Greco 40546a
-  }
Pablo Greco 40546a
-}
Pablo Greco 40546a
-
Pablo Greco 40546a
 {
Pablo Greco 40546a
   "execute": "qmp_capabilities",
Pablo Greco 40546a
   "id": "libvirt-1"
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.22.0
Pablo Greco 40546a