Blame SOURCES/libvirt-qemu_hotplug-move-almost-all-qemuDomainDetach-functions-together.patch

99cbc7
From efbfb47fa2b48ea4879a8897a2613963658adb89 Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <efbfb47fa2b48ea4879a8897a2613963658adb89@dist-git>
99cbc7
From: Laine Stump <laine@laine.org>
99cbc7
Date: Thu, 11 Apr 2019 15:14:38 -0400
99cbc7
Subject: [PATCH] qemu_hotplug: move (almost) all qemuDomainDetach*() functions
99cbc7
 together
99cbc7
99cbc7
There were two outliers at the end of the file beyond the Vcpu
99cbc7
functions.
99cbc7
99cbc7
Signed-off-by: Laine Stump <laine@laine.org>
99cbc7
ACKed-by: Peter Krempa <pkrempa@redhat.com>
99cbc7
(cherry picked from commit 5a8ffaec768ce25ef74eb398968e0b84b878a249)
99cbc7
99cbc7
Partially-Resolves: https://bugzilla.redhat.com/1658198
99cbc7
Signed-off-by: Laine Stump <laine@redhat.com>
99cbc7
Signed-off-by: Laine Stump <laine@laine.org>
99cbc7
Message-Id: <20190411191453.24055-27-laine@redhat.com>
99cbc7
Acked-by: Michal Privoznik <mprivozn@redhat.com>
99cbc7
---
99cbc7
 src/qemu/qemu_hotplug.c | 174 ++++++++++++++++++++--------------------
99cbc7
 1 file changed, 87 insertions(+), 87 deletions(-)
99cbc7
99cbc7
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
99cbc7
index d80b9b005b..77237a895e 100644
99cbc7
--- a/src/qemu/qemu_hotplug.c
99cbc7
+++ b/src/qemu/qemu_hotplug.c
99cbc7
@@ -5547,6 +5547,93 @@ qemuDomainDetachMemoryDevice(virQEMUDriverPtr driver,
99cbc7
 }
99cbc7
 
99cbc7
 
99cbc7
+int
99cbc7
+qemuDomainDetachInputDevice(virDomainObjPtr vm,
99cbc7
+                            virDomainInputDefPtr def,
99cbc7
+                            bool async)
99cbc7
+{
99cbc7
+    virDomainInputDefPtr input;
99cbc7
+    int ret = -1;
99cbc7
+    int idx;
99cbc7
+
99cbc7
+    if ((idx = virDomainInputDefFind(vm->def, def)) < 0) {
99cbc7
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
99cbc7
+                       _("matching input device not found"));
99cbc7
+        return -1;
99cbc7
+    }
99cbc7
+    input = vm->def->inputs[idx];
99cbc7
+
99cbc7
+    switch ((virDomainInputBus) input->bus) {
99cbc7
+    case VIR_DOMAIN_INPUT_BUS_PS2:
99cbc7
+    case VIR_DOMAIN_INPUT_BUS_XEN:
99cbc7
+    case VIR_DOMAIN_INPUT_BUS_PARALLELS:
99cbc7
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
99cbc7
+                       _("input device on bus '%s' cannot be detached"),
99cbc7
+                       virDomainInputBusTypeToString(input->bus));
99cbc7
+        return -1;
99cbc7
+
99cbc7
+    case VIR_DOMAIN_INPUT_BUS_LAST:
99cbc7
+    case VIR_DOMAIN_INPUT_BUS_USB:
99cbc7
+    case VIR_DOMAIN_INPUT_BUS_VIRTIO:
99cbc7
+        break;
99cbc7
+    }
99cbc7
+
99cbc7
+    if (!async)
99cbc7
+        qemuDomainMarkDeviceForRemoval(vm, &input->info);
99cbc7
+
99cbc7
+    if (qemuDomainDeleteDevice(vm, input->info.alias) < 0)
99cbc7
+        goto cleanup;
99cbc7
+
99cbc7
+    if (async) {
99cbc7
+        ret = 0;
99cbc7
+    } else {
99cbc7
+        if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
99cbc7
+            ret = qemuDomainRemoveInputDevice(vm, input);
99cbc7
+    }
99cbc7
+
99cbc7
+ cleanup:
99cbc7
+    if (!async)
99cbc7
+        qemuDomainResetDeviceRemoval(vm);
99cbc7
+    return ret;
99cbc7
+}
99cbc7
+
99cbc7
+
99cbc7
+int
99cbc7
+qemuDomainDetachVsockDevice(virDomainObjPtr vm,
99cbc7
+                            virDomainVsockDefPtr dev,
99cbc7
+                            bool async)
99cbc7
+{
99cbc7
+    virDomainVsockDefPtr vsock = vm->def->vsock;
99cbc7
+    int ret = -1;
99cbc7
+
99cbc7
+
99cbc7
+    if (!vsock ||
99cbc7
+        !virDomainVsockDefEquals(dev, vsock)) {
99cbc7
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
99cbc7
+                       _("matching vsock device not found"));
99cbc7
+        return -1;
99cbc7
+    }
99cbc7
+
99cbc7
+    if (!async)
99cbc7
+        qemuDomainMarkDeviceForRemoval(vm, &vsock->info);
99cbc7
+
99cbc7
+    if (qemuDomainDeleteDevice(vm, vsock->info.alias) < 0)
99cbc7
+        goto cleanup;
99cbc7
+
99cbc7
+    if (async) {
99cbc7
+        ret = 0;
99cbc7
+    } else {
99cbc7
+        if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
99cbc7
+            ret = qemuDomainRemoveVsockDevice(vm, vsock);
99cbc7
+    }
99cbc7
+
99cbc7
+ cleanup:
99cbc7
+    if (!async)
99cbc7
+        qemuDomainResetDeviceRemoval(vm);
99cbc7
+    return ret;
99cbc7
+}
99cbc7
+
99cbc7
+
99cbc7
 static int
99cbc7
 qemuDomainRemoveVcpu(virQEMUDriverPtr driver,
99cbc7
                      virDomainObjPtr vm,
99cbc7
@@ -6200,90 +6287,3 @@ qemuDomainSetVcpuInternal(virQEMUDriverPtr driver,
99cbc7
     virObjectUnref(cfg);
99cbc7
     return ret;
99cbc7
 }
99cbc7
-
99cbc7
-
99cbc7
-int
99cbc7
-qemuDomainDetachInputDevice(virDomainObjPtr vm,
99cbc7
-                            virDomainInputDefPtr def,
99cbc7
-                            bool async)
99cbc7
-{
99cbc7
-    virDomainInputDefPtr input;
99cbc7
-    int ret = -1;
99cbc7
-    int idx;
99cbc7
-
99cbc7
-    if ((idx = virDomainInputDefFind(vm->def, def)) < 0) {
99cbc7
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
99cbc7
-                       _("matching input device not found"));
99cbc7
-        return -1;
99cbc7
-    }
99cbc7
-    input = vm->def->inputs[idx];
99cbc7
-
99cbc7
-    switch ((virDomainInputBus) input->bus) {
99cbc7
-    case VIR_DOMAIN_INPUT_BUS_PS2:
99cbc7
-    case VIR_DOMAIN_INPUT_BUS_XEN:
99cbc7
-    case VIR_DOMAIN_INPUT_BUS_PARALLELS:
99cbc7
-        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
99cbc7
-                       _("input device on bus '%s' cannot be detached"),
99cbc7
-                       virDomainInputBusTypeToString(input->bus));
99cbc7
-        return -1;
99cbc7
-
99cbc7
-    case VIR_DOMAIN_INPUT_BUS_LAST:
99cbc7
-    case VIR_DOMAIN_INPUT_BUS_USB:
99cbc7
-    case VIR_DOMAIN_INPUT_BUS_VIRTIO:
99cbc7
-        break;
99cbc7
-    }
99cbc7
-
99cbc7
-    if (!async)
99cbc7
-        qemuDomainMarkDeviceForRemoval(vm, &input->info);
99cbc7
-
99cbc7
-    if (qemuDomainDeleteDevice(vm, input->info.alias) < 0)
99cbc7
-        goto cleanup;
99cbc7
-
99cbc7
-    if (async) {
99cbc7
-        ret = 0;
99cbc7
-    } else {
99cbc7
-        if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
99cbc7
-            ret = qemuDomainRemoveInputDevice(vm, input);
99cbc7
-    }
99cbc7
-
99cbc7
- cleanup:
99cbc7
-    if (!async)
99cbc7
-        qemuDomainResetDeviceRemoval(vm);
99cbc7
-    return ret;
99cbc7
-}
99cbc7
-
99cbc7
-
99cbc7
-int
99cbc7
-qemuDomainDetachVsockDevice(virDomainObjPtr vm,
99cbc7
-                            virDomainVsockDefPtr dev,
99cbc7
-                            bool async)
99cbc7
-{
99cbc7
-    virDomainVsockDefPtr vsock = vm->def->vsock;
99cbc7
-    int ret = -1;
99cbc7
-
99cbc7
-
99cbc7
-    if (!vsock ||
99cbc7
-        !virDomainVsockDefEquals(dev, vsock)) {
99cbc7
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
99cbc7
-                       _("matching vsock device not found"));
99cbc7
-        return -1;
99cbc7
-    }
99cbc7
-
99cbc7
-    if (!async)
99cbc7
-        qemuDomainMarkDeviceForRemoval(vm, &vsock->info);
99cbc7
-
99cbc7
-    if (qemuDomainDeleteDevice(vm, vsock->info.alias) < 0)
99cbc7
-        goto cleanup;
99cbc7
-
99cbc7
-    if (async) {
99cbc7
-        ret = 0;
99cbc7
-    } else {
99cbc7
-        if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
99cbc7
-            ret = qemuDomainRemoveVsockDevice(vm, vsock);
99cbc7
-    }
99cbc7
-
99cbc7
- cleanup:
99cbc7
-    if (!async)
99cbc7
-        qemuDomainResetDeviceRemoval(vm);
99cbc7
-    return ret;
99cbc7
-}
99cbc7
-- 
99cbc7
2.21.0
99cbc7