harikrishna-patnala commented on a change in pull request #5539:
URL: https://github.com/apache/cloudstack/pull/5539#discussion_r721301734
##########
File path:
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -892,6 +860,53 @@ private Answer execute(ResizeVolumeCommand cmd) {
_storageProcessor.expandDatastore(hostDatastoreSystem, dsMo);
}
+ boolean datastoreChangeObserved = false;
+ boolean volumePathChangeObserved = false;
+
+ if (cmd.getContextParam(DiskTO.PROTOCOL_TYPE) != null &&
cmd.getContextParam(DiskTO.PROTOCOL_TYPE).equalsIgnoreCase(Storage.StoragePoolType.DatastoreCluster.toString()))
{
+ VirtualMachineDiskInfoBuilder diskInfoBuilder =
vmMo.getDiskInfoBuilder();
+ VirtualMachineDiskInfo matchingExistingDisk =
getMatchingExistingDiskWithVolumeDetails(diskInfoBuilder, path, chainInfo,
managed, cmd.get_iScsiName(), poolUUID, hyperHost, context);
+ if (diskInfoBuilder != null && matchingExistingDisk != null) {
+ String[] diskChain = matchingExistingDisk.getDiskChain();
+ DatastoreFile file = new DatastoreFile(diskChain[0]);
+ if (!file.getFileBaseName().equalsIgnoreCase(path)) {
+ if (s_logger.isInfoEnabled())
+ s_logger.info("Detected disk-chain top file change
on volume: " + path + " -> " + file.getFileBaseName());
+ path = file.getFileBaseName();
+ volumePathChangeObserved = true;
+ chainInfo = _gson.toJson(matchingExistingDisk);
+ }
+ DatacenterMO dcMo = new
DatacenterMO(hyperHost.getContext(), hyperHost.getHyperHostDatacenter());
+ DatastoreMO diskDatastoreMofromVM = new
DatastoreMO(context, dcMo.findDatastore(file.getDatastoreName()));
+ if (diskDatastoreMofromVM != null) {
+ String actualPoolUuid =
diskDatastoreMofromVM.getCustomFieldValue(CustomFieldConstants.CLOUD_UUID);
+ if (!actualPoolUuid.equalsIgnoreCase(poolUUID)) {
+ s_logger.warn(String.format("Volume %s found to be
in a different storage pool %s", path, actualPoolUuid));
+ datastoreChangeObserved = true;
+ poolUUID = actualPoolUuid;
+ chainInfo = _gson.toJson(matchingExistingDisk);
+ }
+ }
+ }
+ }
Review comment:
Moved to two methods
--
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]