render / rpms / libvirt

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