code: func (vm *VirtualMachine) createAndAttachSCSIController(ctx context.Context, diskControllerType string) (types.BaseVirtualDevice, error) {
  	// Get VM device list
  	vmDevices, err := vm.Device(ctx)
  	if err != nil {
  		klog.Errorf("Failed to retrieve VM devices for VM: %q. err: %+v", vm.InventoryPath, err)
  		return nil, err
  	}
  	allSCSIControllers := getSCSIControllers(vmDevices)
  	if len(allSCSIControllers) >= SCSIControllerLimit {
  		// we reached the maximum number of controllers we can attach
  		klog.Errorf("SCSI Controller Limit of %d has been reached, cannot create another SCSI controller", SCSIControllerLimit)
  		return nil, fmt.Errorf("SCSI Controller Limit of %d has been reached, cannot create another SCSI controller", SCSIControllerLimit)
  	}
  	newSCSIController, err := vmDevices.CreateSCSIController(diskControllerType)
  	if err != nil {
  		klog.Errorf("Failed to create new SCSI controller on VM: %q. err: %+v", vm.InventoryPath, err)
  		return nil, err
  	}
  	configNewSCSIController := newSCSIController.(types.BaseVirtualSCSIController).GetVirtualSCSIController()
  	hotAndRemove := true
  	configNewSCSIController.HotAddRemove = &hotAndRemove
  	configNewSCSIController.SharedBus = types.VirtualSCSISharing(types.VirtualSCSISharingNoSharing)
  
  	// add the scsi controller to virtual machine
  	err = vm.AddDevice(context.TODO(), newSCSIController)
  	if err != nil {
  		klog.V(LogLevel).Infof("Cannot add SCSI controller to VM: %q. err: %+v", vm.InventoryPath, err)
  		// attempt clean up of scsi controller
  		nestedErr := vm.deleteController(ctx, newSCSIController, vmDevices)
  		if nestedErr != nil {
  			return nil, fmt.Errorf("failed to delete SCSI controller after failing to add it to vm with err='%v': %v", err, nestedErr)
  		}
  		return nil, err
  	}
  	return newSCSIController, nil
  }
docs: // createAndAttachSCSIController creates and attachs the SCSI controller to the VM.