Github user jburwell commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/1365#discussion_r58780935
--- Diff:
plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
---
@@ -1363,24 +1363,17 @@ private Answer attachVolume(Command cmd, DiskTO
disk, boolean isAttach, boolean
AttachAnswer answer = new AttachAnswer(disk);
if (isAttach) {
- String dataDiskController =
controllerInfo.get(VmDetailConstants.DATA_DISK_CONTROLLER);
- String rootDiskController =
controllerInfo.get(VmDetailConstants.ROOK_DISK_CONTROLLER);
- DiskControllerType rootDiskControllerType =
DiskControllerType.getType(rootDiskController);
-
- if (dataDiskController == null) {
- dataDiskController = getLegacyVmDataDiskController();
- } else if ((rootDiskControllerType ==
DiskControllerType.lsilogic) ||
- (rootDiskControllerType ==
DiskControllerType.lsisas1068) ||
- (rootDiskControllerType ==
DiskControllerType.pvscsi) ||
- (rootDiskControllerType ==
DiskControllerType.buslogic)) {
- //TODO: Support mix of SCSI controller types for
single VM. If root disk is already over
- //a SCSI controller then use the same for data volume
as well. This limitation will go once mix
- //of SCSI controller types for single VM.
- dataDiskController = rootDiskController;
- } else if (DiskControllerType.getType(dataDiskController)
== DiskControllerType.osdefault) {
- dataDiskController =
vmMo.getRecommendedDiskController(null);
+ String diskController = null;
+ if (controllerInfo != null) {
+ diskController =
controllerInfo.get(VmDetailConstants.DATA_DISK_CONTROLLER);
}
- vmMo.attachDisk(new String[] {datastoreVolumePath}, morDs,
dataDiskController);
+ if (diskController == null) {
+ diskController = getLegacyVmDataDiskController();
+ }
+ if (DiskControllerType.getType(diskController) ==
DiskControllerType.osdefault) {
+ diskController =
vmMo.getRecommendedDiskController(null);
+ }
--- End diff --
Lines 1366-1375 seem ripe to extraction to a method with package default
visibility and a set of unit tests.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---