On 3/22/19 7:39 AM, Peter Krempa wrote:
On Thu, Mar 21, 2019 at 18:28:54 -0400, Laine Stump wrote:
qemuDomainDetachDeviceControllerLive() just checks if the controller
type is SCSI, and then either returns failure, or calls
qemuDomainDetachControllerDevice().

Instead, lets just check for type != SCSI at the top of the latter
function, and call it directly.

Signed-off-by: Laine Stump <la...@laine.org>
---
  src/qemu/qemu_hotplug.c | 42 ++++++++++++++---------------------------
  1 file changed, 14 insertions(+), 28 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index c7aba74c6b..6b713e1c27 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
[...]

@@ -5561,6 +5568,12 @@ qemuDomainDetachControllerDevice(virQEMUDriverPtr driver,
detach = vm->def->controllers[idx]; + if (qemuDomainControllerIsBusy(vm, detach)) {
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                       _("device cannot be detached: device is busy"));
+        goto cleanup;
+    }
+
      if (qemuIsMultiFunctionDevice(vm->def, &detach->info)) {
          virReportError(VIR_ERR_OPERATION_FAILED,
                         _("cannot hot unplug multifunction PCI device: %s"),
@@ -5568,12 +5581,6 @@ qemuDomainDetachControllerDevice(virQEMUDriverPtr driver,
          goto cleanup;
      }
- if (qemuDomainControllerIsBusy(vm, detach)) {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                       _("device cannot be detached: device is busy"));
-        goto cleanup;
-    }
-
This change is not mentioned in the commit message. Also it's not really
functionally important.


Yeah, I was just moving things around in the functions to separate "find the device", "do type-specific checking", and "do general checking". I can skip that movement though, and just go directly to the "remove general checking" in the penultimate patch.


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

Reply via email to