Re: [PATCH 14/21] qemu_hotplug: remove extra function in middle of DetachController call chain

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

 



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 <laine@xxxxxxxxx>
---
  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@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