vmx: Support super wide SCSI bus

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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2021-07-29 16:09:58 +02:00
parent 5c254bb541
commit 32f7db0989
3 changed files with 14 additions and 5 deletions

View File

@ -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

View File

@ -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) {
@ -2164,7 +2166,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,
@ -2230,10 +2233,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;
}

View File

@ -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'/>