render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
6ae9ed
From 3c9f94b784cfffdb2419ccef90cd1c8d22150e8f Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <3c9f94b784cfffdb2419ccef90cd1c8d22150e8f@dist-git>
6ae9ed
From: John Ferlan <jferlan@redhat.com>
6ae9ed
Date: Tue, 2 Aug 2016 12:04:40 -0400
6ae9ed
Subject: [PATCH] qemu: Use the hostdev alias in qemuDomainAttachHostSCSIDevice
6ae9ed
 error path
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1289391
6ae9ed
6ae9ed
Rather than pass the whole drive string (which contained the alias),
6ae9ed
pass only the alias for the qemuMonitorDriveDel call in the error
6ae9ed
path when adding a host device in the monitor fails.
6ae9ed
6ae9ed
(cherry picked from commit 1149fe4c15feba1a2970bd69c3d3d2884cd72938)
6ae9ed
Signed-off-by: John Ferlan <jferlan@redhat.com>
6ae9ed
---
6ae9ed
 src/qemu/qemu_hotplug.c | 7 ++++++-
6ae9ed
 1 file changed, 6 insertions(+), 1 deletion(-)
6ae9ed
6ae9ed
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
6ae9ed
index f9ded35..51ab7c9 100644
6ae9ed
--- a/src/qemu/qemu_hotplug.c
6ae9ed
+++ b/src/qemu/qemu_hotplug.c
6ae9ed
@@ -1968,6 +1968,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
6ae9ed
     virErrorPtr orig_err;
6ae9ed
     char *devstr = NULL;
6ae9ed
     char *drvstr = NULL;
6ae9ed
+    char *drivealias = NULL;
6ae9ed
     bool teardowncgroup = false;
6ae9ed
     bool teardownlabel = false;
6ae9ed
     bool driveAdded = false;
6ae9ed
@@ -2026,6 +2027,9 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
6ae9ed
     if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev)))
6ae9ed
         goto cleanup;
6ae9ed
 
6ae9ed
+    if (!(drivealias = qemuAliasFromHostdev(hostdev)))
6ae9ed
+        goto cleanup;
6ae9ed
+
6ae9ed
     if (!(devstr = qemuBuildSCSIHostdevDevStr(vm->def, hostdev, priv->qemuCaps)))
6ae9ed
         goto cleanup;
6ae9ed
 
6ae9ed
@@ -2061,13 +2065,14 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
6ae9ed
                                                   vm->def, hostdev, NULL) < 0)
6ae9ed
             VIR_WARN("Unable to restore host device labelling on hotplug fail");
6ae9ed
     }
6ae9ed
+    VIR_FREE(drivealias);
6ae9ed
     VIR_FREE(drvstr);
6ae9ed
     VIR_FREE(devstr);
6ae9ed
     return ret;
6ae9ed
 
6ae9ed
  exit_monitor:
6ae9ed
     orig_err = virSaveLastError();
6ae9ed
-    if (driveAdded && qemuMonitorDriveDel(priv->mon, drvstr) < 0) {
6ae9ed
+    if (driveAdded && qemuMonitorDriveDel(priv->mon, drivealias) < 0) {
6ae9ed
         VIR_WARN("Unable to remove drive %s (%s) after failed "
6ae9ed
                  "qemuMonitorAddDevice",
6ae9ed
                  drvstr, devstr);
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed