Skip to content

Commit 66c64b6

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
Commit 25
1 parent 1c3a8f9 commit 66c64b6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/OntapNfsStorageAdaptor.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,20 @@ public boolean connectPhysicalDisk(String volumeUuid, KVMStoragePool pool, Map<S
188188

189189
/**
190190
* Get the mount point for a volume UUID.
191-
* Returns the stored mount point from connectPhysicalDisk, or falls back to volumeUuid.
191+
* Returns the stored mount point from connectPhysicalDisk, or constructs it from UUID.
192192
*/
193193
private String getMountPointForVolume(String volumeUuid) {
194194
// First check if we have a stored mount point (from connectPhysicalDisk)
195195
String mountPoint = volumeToMountPointMap.get(volumeUuid);
196196
if (mountPoint != null) {
197197
return mountPoint;
198198
}
199-
// Fallback: assume mount at /mnt/<volumeUuid> (old behavior)
200-
return _mountPoint + "/" + volumeUuid;
199+
// If not in map, construct the expected mount point
200+
// Volume UUID format: 3ee3da4b-fa35-4737-9625-4a4a9baa9517
201+
// FlexVolume name: cs_vol_3ee3da4b_fa35_4737_9625_4a4a9baa9517
202+
// Mount point: /mnt/cs_vol_3ee3da4b_fa35_4737_9625_4a4a9baa9517
203+
String volumeNameWithUnderscores = volumeUuid.replace("-", "_");
204+
return _mountPoint + "/cs_vol_" + volumeNameWithUnderscores;
201205
}
202206

203207
/**
@@ -293,9 +297,9 @@ public boolean disconnectPhysicalDiskByPath(String localPath) {
293297
@Override
294298
public KVMPhysicalDisk getPhysicalDisk(String volumeUuid, KVMStoragePool pool) {
295299
logger.debug("Getting physical disk info for: " + volumeUuid);
296-
// Path to qcow2 file: <mountPoint>/<volumeUuid>
300+
// Path to qcow2 file: <mountPoint>/<volumeUuid>.qcow2
297301
String mountPoint = getMountPointForVolume(volumeUuid);
298-
String diskPath = mountPoint + "/" + volumeUuid;
302+
String diskPath = mountPoint + "/" + volumeUuid + ".qcow2";
299303

300304
// Check if file exists - if not, this might be a new disk that needs to be created
301305
// For ONTAP managed storage, the disk file doesn't exist until we create it

0 commit comments

Comments
 (0)