Skip to content

Commit 70d127a

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
Commit 12
1 parent d11b647 commit 70d127a

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,20 @@ public boolean deleteStoragePool(KVMStoragePool pool) {
131131
public boolean connectPhysicalDisk(String volumeUuid, KVMStoragePool pool, Map<String, String> details, boolean isVMMigrate) {
132132
logger.info("Connecting ONTAP NFS volume: " + volumeUuid);
133133

134-
// Get the per-volume junction path from details
135-
// This was set by OntapPrimaryDatastoreDriver as _iScsiName
136-
String junctionPath = details.get(DiskTO.MOUNT_POINT);
134+
// For ONTAP NFS, volumeUuid is actually the junction path (e.g., "/cloudstack_vol_ROOT_7")
135+
// This comes from managedStoreTarget set by OntapPrimaryDatastoreDriver
136+
String junctionPath = volumeUuid;
137+
138+
// Validate junction path
137139
if (junctionPath == null || junctionPath.isEmpty()) {
138-
logger.error("Missing MOUNT_POINT (junction path) for volume: " + volumeUuid);
140+
logger.error("Invalid junction path for volume: " + volumeUuid);
139141
return false;
140142
}
141143

142-
String mountPoint = _mountPoint + "/" + volumeUuid;
144+
// Create a sanitized mount point name (remove leading slash, replace special chars)
145+
String sanitizedPath = junctionPath.startsWith("/") ? junctionPath.substring(1) : junctionPath;
146+
sanitizedPath = sanitizedPath.replace("/", "_");
147+
String mountPoint = _mountPoint + "/" + sanitizedPath;
143148

144149
// Check if already mounted
145150
if (isMounted(mountPoint)) {

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ private String createManagedNfsVolume(DataStore dataStore, DataObject dataObject
255255
Map<String, String> details = storagePoolDetailsDao.listDetailsKeyPairs(dataStore.getId());
256256
StorageStrategy storageStrategy = getStrategyByStoragePoolDetails(details);
257257

258-
String sanitizedName = volumeInfo.getName().replace('-', '_'); // "DATA_4"
259-
String ontapVolumeName = "cloudstack_vol_" + sanitizedName; // "cloudstack_vol_DATA_4"
258+
String sanitizedName = volumeUuid.replace('-', '_');
259+
String ontapVolumeName = "cs_vol_" + sanitizedName;
260260
String junctionPath = "/" + ontapVolumeName;
261261
long sizeInBytes = volumeInfo.getSize();
262262

0 commit comments

Comments
 (0)