[PATCH 1/5] qemu: remove qemuBuildObsoleteAccelArg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since we started assuming QEMU_CAPS_MACHINE_OPT in
commit <69420756>, this function can only be reached
for unsupported virt types.

Replace the call with a virReportError.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/qemu/qemu_command.c | 61 +++++++------------------------------------------
 1 file changed, 8 insertions(+), 53 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 418729b988..80135ee498 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6894,50 +6894,6 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
 }
 
 
-static int
-qemuBuildObsoleteAccelArg(virCommandPtr cmd,
-                          const virDomainDef *def,
-                          virQEMUCapsPtr qemuCaps)
-{
-    bool disableKVM = false;
-    bool enableKVM = false;
-
-    switch ((int)def->virtType) {
-    case VIR_DOMAIN_VIRT_QEMU:
-        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
-            disableKVM = true;
-        break;
-
-    case VIR_DOMAIN_VIRT_KQEMU:
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("the QEMU binary does not support kqemu"));
-        break;
-
-    case VIR_DOMAIN_VIRT_KVM:
-        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ENABLE_KVM)) {
-            enableKVM = true;
-        } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("the QEMU binary does not support kvm"));
-            return -1;
-        }
-        break;
-
-    default:
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("the QEMU binary does not support %s"),
-                       virDomainVirtTypeToString(def->virtType));
-        return -1;
-    }
-
-    if (disableKVM)
-        virCommandAddArg(cmd, "-no-kvm");
-    if (enableKVM)
-        virCommandAddArg(cmd, "-enable-kvm");
-
-    return 0;
-}
-
 static bool
 qemuAppendKeyWrapMachineParm(virBuffer *buf, virQEMUCapsPtr qemuCaps,
                              int flag, const char *pname, int pstate)
@@ -7036,7 +6992,6 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
     virTristateSwitch smm = def->features[VIR_DOMAIN_FEATURE_SMM];
     virCPUDefPtr cpu = def->cpu;
     virBuffer buf = VIR_BUFFER_INITIALIZER;
-    bool obsoleteAccel = false;
     size_t i;
     int ret = -1;
 
@@ -7050,12 +7005,16 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
     virCommandAddArg(cmd, "-machine");
     virBufferAdd(&buf, def->os.machine, -1);
 
-    if (def->virtType == VIR_DOMAIN_VIRT_QEMU)
+    if (def->virtType == VIR_DOMAIN_VIRT_QEMU) {
         virBufferAddLit(&buf, ",accel=tcg");
-    else if (def->virtType == VIR_DOMAIN_VIRT_KVM)
+    } else if (def->virtType == VIR_DOMAIN_VIRT_KVM) {
         virBufferAddLit(&buf, ",accel=kvm");
-    else
-        obsoleteAccel = true;
+    } else {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("the QEMU binary does not support %s"),
+                       virDomainVirtTypeToString(def->virtType));
+        return -1;
+    }
 
     /* To avoid the collision of creating USB controllers when calling
      * machine->init in QEMU, it needs to set usb=off
@@ -7235,10 +7194,6 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
 
     virCommandAddArgBuffer(cmd, &buf);
 
-    if (obsoleteAccel &&
-        qemuBuildObsoleteAccelArg(cmd, def, qemuCaps) < 0)
-        goto cleanup;
-
     ret = 0;
  cleanup:
     virBufferFreeAndReset(&buf);
-- 
2.16.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux