mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fixing an issue related to figuring out the name of a datastore that is backed by managed storage
This commit is contained in:
parent
dd700be263
commit
3ac8f8d601
@ -2035,15 +2035,31 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||||||
if (diskInfoBuilder != null) {
|
if (diskInfoBuilder != null) {
|
||||||
VolumeObjectTO volume = (VolumeObjectTO)vol.getData();
|
VolumeObjectTO volume = (VolumeObjectTO)vol.getData();
|
||||||
|
|
||||||
ManagedObjectReference morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, volume.getDataStore().getUuid());
|
String dsName = null;
|
||||||
DatastoreMO dsMo = new DatastoreMO(context, morDs);
|
String diskBackingFileBaseName= null;
|
||||||
String dsName = dsMo.getName();
|
|
||||||
|
|
||||||
Map<String, String> details = vol.getDetails();
|
Map<String, String> details = vol.getDetails();
|
||||||
boolean isManaged = details != null && Boolean.parseBoolean(details.get(DiskTO.MANAGED));
|
boolean isManaged = details != null && Boolean.parseBoolean(details.get(DiskTO.MANAGED));
|
||||||
|
|
||||||
|
if (isManaged) {
|
||||||
|
String iScsiName = details.get(DiskTO.IQN);
|
||||||
|
|
||||||
|
// if the storage is managed, iScsiName should not be null
|
||||||
|
dsName = VmwareResource.getDatastoreName(iScsiName);
|
||||||
|
|
||||||
|
diskBackingFileBaseName = new DatastoreFile(volume.getPath()).getFileBaseName();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ManagedObjectReference morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, volume.getDataStore().getUuid());
|
||||||
|
DatastoreMO dsMo = new DatastoreMO(context, morDs);
|
||||||
|
|
||||||
|
dsName = dsMo.getName();
|
||||||
|
|
||||||
|
diskBackingFileBaseName = volume.getPath();
|
||||||
|
}
|
||||||
|
|
||||||
VirtualMachineDiskInfo diskInfo =
|
VirtualMachineDiskInfo diskInfo =
|
||||||
diskInfoBuilder.getDiskInfoByBackingFileBaseName(isManaged ? new DatastoreFile(volume.getPath()).getFileBaseName() : volume.getPath(), dsName);
|
diskInfoBuilder.getDiskInfoByBackingFileBaseName(diskBackingFileBaseName, dsName);
|
||||||
if (diskInfo != null) {
|
if (diskInfo != null) {
|
||||||
s_logger.info("Found existing disk info from volume path: " + volume.getPath());
|
s_logger.info("Found existing disk info from volume path: " + volume.getPath());
|
||||||
return diskInfo;
|
return diskInfo;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user