render / rpms / libvirt

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