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