From 04c959123d238c5922389381b02155bc8b66dc6c Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Fri, 16 Aug 2019 21:00:10 +0800
Subject: [PATCH] qemu: fix Validate scsi disk against domain def on coldplug

Check the disk scsi address only when the disk is scsi type.

Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
 src/qemu/qemu_driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f80bdeb..617d7d5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8083,7 +8083,8 @@ static int
 qemuCheckDiskConfigAgainstDomain(const virDomainDef *def,
                                  const virDomainDiskDef *disk)
 {
-    if (virDomainSCSIDriveAddressIsUsed(def, &disk->info.addr.drive)) {
+    if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI &&
+        virDomainSCSIDriveAddressIsUsed(def, &disk->info.addr.drive)) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("Domain already contains a disk with that address"));
         return -1;
-- 
2.19.1

