Since its 6.7 release, vSphere allows up to 64 units on a SCSI bus [1]. The release version translates to virtualHW_version 13 and thus if we are dealing with sufficiently new version we can enable the feature. 1: https://configmax.vmware.com/guest?vmwareproduct=vSphere&release=vSphere%206.7&categories=1-0 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1738392 Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/conf/domain_conf.h | 1 + src/vmx/vmx.c | 13 ++++++++----- tests/vmx2xmldata/vmx2xml-esx-in-the-wild-11.xml | 5 +++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 80dd1b96a4..c57b77a59c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2727,6 +2727,7 @@ struct _virDomainVirtioOptions { }; +#define SCSI_SUPER_WIDE_BUS_MAX_CONT_UNIT 64 #define SCSI_WIDE_BUS_MAX_CONT_UNIT 16 #define SCSI_NARROW_BUS_MAX_CONT_UNIT 7 diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 192f1bd252..f706e2023a 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1476,6 +1476,8 @@ virVMXParseConfig(virVMXContext *ctx, "4 or higher but found %lld"), virtualHW_version); goto cleanup; + } else if (virtualHW_version >= 13) { + def->scsiBusMaxUnit = SCSI_SUPER_WIDE_BUS_MAX_CONT_UNIT; } /* vmx:uuid.bios -> def:uuid */ @@ -1729,7 +1731,7 @@ virVMXParseConfig(virVMXContext *ctx, if (! present) continue; - for (unit = 0; unit < 16; ++unit) { + for (unit = 0; unit < def->scsiBusMaxUnit; unit++) { g_autoptr(virDomainDiskDef) disk = NULL; if (unit == 7) { @@ -2169,7 +2171,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOption *xmlopt, virConf *conf, * VIR_DOMAIN_DISK_DEVICE_LUN} * busType = VIR_DOMAIN_DISK_BUS_SCSI * controllerOrBus = [0..3] -> controller - * unit = [0..6,8..15] + * unit = [0..6,8..15] for virtualHW_version < 13 + * unit = [0..6,8..64] for virtualHW_version >= 13 * * device = {VIR_DOMAIN_DISK_DEVICE_DISK, * VIR_DOMAIN_DISK_DEVICE_CDROM, @@ -2235,10 +2238,10 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOption *xmlopt, virConf *conf, goto cleanup; } - if (unit < 0 || unit > 15 || unit == 7) { + if (unit < 0 || unit > vmdef->scsiBusMaxUnit || unit == 7) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("SCSI unit index %d out of [0..6,8..15] range"), - unit); + _("SCSI unit index %d out of [0..6,8..%u] range"), + unit, vmdef->scsiBusMaxUnit); goto cleanup; } diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-11.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-11.xml index cf414975b3..8807a057d7 100644 --- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-11.xml +++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-11.xml @@ -20,6 +20,11 @@ <target dev='sda' bus='scsi'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> + <disk type='file' device='disk'> + <source file='[datastore] directory/esx6.7-rhel7.7-x86_64_3.vmdk'/> + <target dev='sdp' bus='scsi'/> + <address type='drive' controller='0' bus='0' target='0' unit='16'/> + </disk> <controller type='scsi' index='0' model='vmpvscsi'/> <interface type='bridge'> <mac address='00:50:56:ac:3e:a1' type='generated'/> -- 2.31.1