Skip to content

Commit f79e57a

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
vm instance creation test12
1 parent 0688b00 commit f79e57a

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -137,27 +137,26 @@ 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-
// Create unique volume name: name_uuid format for readability
141-
// Example: ROOT-22_e4cf5d79-3a5f-4618-b3c5-f727ff3d1603
142-
String volumeName = ((VolumeInfo) dataObject).getName();
140+
// Use UUID only (KVM's default behavior for managed NFS)
141+
// KVM's getPhysicalDisk() is hardcoded to use UUID, not custom paths
143142
String volumeUuid = ((VolumeInfo) dataObject).getUuid();
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);
143+
// Set path to UUID (KVM will use this)
144+
volume.setPath(volumeUuid);
148145
volume.setFolder(""); // No folder for flat structure
149146
volume.setPoolId(dataStore.getId());
150147
volumeDao.update(volume.getId(), volume);
151-
s_logger.info("=== ONTAP Managed NFS Volume (Flat Structure) ===");
152-
s_logger.info("Volume Name: {}", volumeName);
148+
s_logger.info("=== ONTAP Managed NFS Volume (Flat Structure - UUID only) ===");
149+
s_logger.info("Volume Name: {}", ((VolumeInfo) dataObject).getName());
153150
s_logger.info("Volume UUID: {}", volumeUuid);
154-
s_logger.info("Volume Path: {} (name_uuid format)", uniqueVolumeName);
151+
s_logger.info("Volume Path: {} (UUID-based, KVM default)", volumeUuid);
155152
s_logger.info("Volume PoolType: {}", volume.getPoolType());
156-
s_logger.info("Hypervisor will create: /mnt/<pool>/{}.qcow2", uniqueVolumeName);
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");
157155
s_logger.info("================================================");
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;
156+
// CRITICAL: Return null to tell CloudStack to trigger KVM volume creation!
157+
// If we return a path, CloudStack thinks volume is already created and skips KVM
158+
// This causes DATA volumes to never be created
159+
return null;
161160
}
162161
// For iSCSI and other protocols, use ONTAP REST API
163162
StorageStrategy storageStrategy = getStrategyByStoragePoolDetails(details);

0 commit comments

Comments
 (0)