From dcbbbce1a1315b8baf85e10f43ee8355b34314cf Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Tue, 15 Jul 2014 15:54:03 -0500 Subject: [CHANGE 24/29] scsi: Report error when lun number is in use To: rhvirt-patches@redhat.com, jen@redhat.com RH-Author: Fam Zheng Message-id: <1405439643-14545-1-git-send-email-famz@redhat.com> Patchwork-id: 59914 O-Subject: [RHEL-7 qemu-kvm PATCH] scsi: Report error when lun number is in use Bugzilla: 1096576 RH-Acked-by: Markus Armbruster RH-Acked-by: Paolo Bonzini RH-Acked-by: Amos Kong Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1096576 Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7702061 In the case that the lun number is taken by another scsi device, don't release the existing device siliently, but report an error to user. Signed-off-by: Fam Zheng Signed-off-by: Paolo Bonzini (cherry picked from commit 2039511b8f573165420c86380762ae829dc398d9) Signed-off-by: Fam Zheng --- hw/scsi/scsi-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Signed-off-by: jen --- hw/scsi/scsi-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 77e0c10..7e25c62 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -178,7 +178,8 @@ static int scsi_qdev_init(DeviceState *qdev) d = scsi_device_find(bus, dev->channel, dev->id, dev->lun); assert(d); if (d->lun == dev->lun && dev != d) { - object_unparent(OBJECT(d)); + error_report("lun already used by '%s'", d->qdev.id); + goto err; } } -- 1.9.3