Copilot commented on code in PR #13857:
URL: https://github.com/apache/cloudstack/pull/13857#discussion_r3765982904
##########
plugins/hypervisors/vmware/src/main/java/com/cloud/storage/resource/VmwareStorageProcessor.java:
##########
@@ -2066,7 +2081,11 @@ private Answer attachVolume(Command cmd, DiskTO disk,
boolean isAttach, boolean
if (dsMo.getDatastoreType().equalsIgnoreCase("VVOL")) {
datastoreVolumePath =
VmwareStorageLayoutHelper.getDatastoreVolumePath(dsMo, vmName, volumePath);
} else {
- datastoreVolumePath =
VmwareStorageLayoutHelper.syncVolumeToVmDefaultFolder(dsMo.getOwnerDatacenter().first(),
vmName, dsMo, volumePath, VmwareManager.s_vmwareSearchExcludeFolder.value());
+ VmdkAdapterType targetAdapterType =
VmdkAdapterType.getAdapterType(DiskControllerType.getType(diskController));
+ Pair<String, Boolean> syncResult =
VmwareStorageLayoutHelper.syncVolumeToVmDefaultFolder(dsMo.getOwnerDatacenter().first(),
vmName, dsMo,
+ volumePath,
VmwareManager.s_vmwareSearchExcludeFolder.value(), targetAdapterType,
volumeTO.getProvisioningType());
+ datastoreVolumePath = syncResult.first();
+ updateVmdkAdapter = !syncResult.second();
Review Comment:
`updateVmdkAdapter` is only disabled when
`syncVolumeToVmDefaultFolder(...).second()` is true (i.e. the sync path
performed a copy+delete). If the volume is already in the VM folder (no legacy
path hit), `syncResult.second()` remains false and `vmMo.attachDisk(...,
updateVmdkAdapter)` will still call `VirtualMachineMO.updateVmdkAdapter()`,
which fetches the VMDK descriptor via the vCenter datastore browser
(`composeDatastoreBrowseUrl`/HTTP). That appears to reintroduce the same
datastore-browser dependency this PR is trying to avoid for running VMs.
Consider making the decision to skip `updateVmdkAdapter` independent of
whether a copy was performed (e.g., disable it for this attach flow on VMware 8
builds, or introduce a clearer signal from the sync step that indicates "avoid
datastore browser" even when no migration/copy was needed).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]