Skip to content

Commit 0688b00

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
vm instance creation test11
1 parent 24a16b8 commit 0688b00

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,25 +137,27 @@ private String createCloudStackVolumeForTypeVolume(DataStore dataStore, DataObje
137137
// CRITICAL: Set poolType at VOLUME level
138138
// This tells KVM to use LibvirtStorageAdaptor (NFS) instead of IscsiAdmStorageAdaptor
139139
volume.setPoolType(Storage.StoragePoolType.NetworkFilesystem);
140-
// Use UUID only (KVM's default behavior for managed NFS)
141-
// KVM's getPhysicalDisk() is hardcoded to use UUID, not the path we set
140+
// Create unique volume name: name_uuid format for readability
141+
// Example: ROOT-22_e4cf5d79-3a5f-4618-b3c5-f727ff3d1603
142+
String volumeName = ((VolumeInfo) dataObject).getName();
142143
String volumeUuid = ((VolumeInfo) dataObject).getUuid();
143-
// Set path to UUID (KVM will use this)
144-
volume.setPath(volumeUuid);
144+
String uniqueVolumeName = volumeName + "_" + volumeUuid;
145+
// Set path to the unique name so KVM can find it later
146+
// This is critical - the path is what KVM uses to locate the file
147+
volume.setPath(uniqueVolumeName);
145148
volume.setFolder(""); // No folder for flat structure
146149
volume.setPoolId(dataStore.getId());
147150
volumeDao.update(volume.getId(), volume);
148-
s_logger.info("=== ONTAP Managed NFS Volume (Flat Structure - UUID only) ===");
149-
s_logger.info("Volume Name: {}", volume.getName());
151+
s_logger.info("=== ONTAP Managed NFS Volume (Flat Structure) ===");
152+
s_logger.info("Volume Name: {}", volumeName);
150153
s_logger.info("Volume UUID: {}", volumeUuid);
151-
s_logger.info("Volume Path: {} (UUID-based, KVM default)", volumeUuid);
154+
s_logger.info("Volume Path: {} (name_uuid format)", uniqueVolumeName);
152155
s_logger.info("Volume PoolType: {}", volume.getPoolType());
153-
s_logger.info("Returning null - hypervisor will create: /mnt/<pool>/{}.qcow2", volumeUuid);
154-
s_logger.info("Note: KVM's LibvirtStoragePool.getPhysicalDisk() is hardcoded to use UUID");
156+
s_logger.info("Hypervisor will create: /mnt/<pool>/{}.qcow2", uniqueVolumeName);
155157
s_logger.info("================================================");
156-
// CRITICAL: Return null so CloudStack triggers KVM to create the volume!
157-
// KVM will create file as: /mnt/pool/<uuid>.qcow2
158-
return null;
158+
// CRITICAL: Return the unique name (not null!)
159+
// This tells CloudStack what path was created, so KVM can find it later
160+
return uniqueVolumeName;
159161
}
160162
// For iSCSI and other protocols, use ONTAP REST API
161163
StorageStrategy storageStrategy = getStrategyByStoragePoolDetails(details);

0 commit comments

Comments
 (0)