c480ed
From 6402d8133b33af901247afccdc78b332b453ff11 Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <6402d8133b33af901247afccdc78b332b453ff11@dist-git>
c480ed
From: Michal Privoznik <mprivozn@redhat.com>
c480ed
Date: Thu, 18 Apr 2019 19:36:33 +0200
c480ed
Subject: [PATCH] qemu_hotplug: Check for duplicate drive addresses
c480ed
c480ed
RHEL-7.7: https://bugzilla.redhat.com/show_bug.cgi?id=1692296
c480ed
RHEL-8.1.0: https://bugzilla.redhat.com/show_bug.cgi?id=1692354
c480ed
c480ed
This tries to fix the same problem as f1d65853000 but it's doing
c480ed
so in a less invasive way.
c480ed
c480ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c480ed
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
c480ed
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
c480ed
(cherry picked from commit ddc72f99027b063feaf34e5fda89916b6b2c8943)
c480ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c480ed
Message-Id: <a40b26d1696401699fae7aeea2714f8b51935766.1555608962.git.mprivozn@redhat.com>
c480ed
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
c480ed
---
c480ed
 src/qemu/qemu_hotplug.c | 6 ++++++
c480ed
 1 file changed, 6 insertions(+)
c480ed
c480ed
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
c480ed
index 397a2bdde2..776cd75474 100644
c480ed
--- a/src/qemu/qemu_hotplug.c
c480ed
+++ b/src/qemu/qemu_hotplug.c
c480ed
@@ -612,6 +612,12 @@ qemuDomainAttachSCSIDisk(virQEMUDriverPtr driver,
c480ed
         return -1;
c480ed
     }
c480ed
 
c480ed
+    if (virDomainSCSIDriveAddressIsUsed(vm->def, &disk->info.addr.drive)) {
c480ed
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
c480ed
+                       _("Domain already contains a disk with that address"));
c480ed
+        return -1;
c480ed
+    }
c480ed
+
c480ed
     /* Let's make sure the disk has a controller defined and loaded before
c480ed
      * trying to add it. The controller used by the disk must exist before a
c480ed
      * qemu command line string is generated.
c480ed
-- 
c480ed
2.21.0
c480ed