qemuCheckDiskConfigAgainstDomain: Validate disk's SCSI address iff disk is SCSI

Check the disk SCSI address only when the disk actually is of
SCSI type.

Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Xu Yandong 2019-09-19 04:02:36 -04:00 committed by Michal Privoznik
parent 5f646ffda0
commit d72ed16ba7

View File

@ -8314,7 +8314,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;