|
45 | 45 | import org.apache.cloudstack.storage.datastore.lifecycle.BasePrimaryDataStoreLifeCycleImpl; |
46 | 46 | import org.apache.cloudstack.storage.feign.model.ExportPolicy; |
47 | 47 | import org.apache.cloudstack.storage.feign.model.OntapStorage; |
| 48 | +import org.apache.cloudstack.storage.feign.model.Volume; |
48 | 49 | import org.apache.cloudstack.storage.provider.StorageProviderFactory; |
49 | 50 | import org.apache.cloudstack.storage.service.StorageStrategy; |
50 | 51 | import org.apache.cloudstack.storage.service.model.AccessGroup; |
@@ -220,6 +221,21 @@ public DataStore initialize(Map<String, Object> dsInfos) { |
220 | 221 | } |
221 | 222 | s_logger.info("Using Data LIF for storage access: " + dataLIF); |
222 | 223 | details.put(Constants.DATA_LIF, dataLIF); |
| 224 | + s_logger.info("Creating ONTAP volume '" + storagePoolName + "' with size: " + volumeSize + " bytes (" + |
| 225 | + (volumeSize / (1024 * 1024 * 1024)) + " GB)"); |
| 226 | + try { |
| 227 | + Volume volume = storageStrategy.createStorageVolume(storagePoolName, volumeSize); |
| 228 | + if (volume == null) { |
| 229 | + s_logger.error("createStorageVolume returned null for volume: " + storagePoolName); |
| 230 | + throw new CloudRuntimeException("Failed to create ONTAP volume: " + storagePoolName); |
| 231 | + } |
| 232 | + s_logger.info("Volume object retrieved successfully. UUID: " + volume.getUuid() + ", Name: " + volume.getName()); |
| 233 | + details.putIfAbsent(Constants.VOLUME_UUID, volume.getUuid()); |
| 234 | + details.putIfAbsent(Constants.VOLUME_NAME, volume.getName()); |
| 235 | + } catch (Exception e) { |
| 236 | + s_logger.error("Exception occurred while creating ONTAP volume: " + storagePoolName, e); |
| 237 | + throw new CloudRuntimeException("Failed to create ONTAP volume: " + storagePoolName + ". Error: " + e.getMessage(), e); |
| 238 | + } |
223 | 239 | } else { |
224 | 240 | throw new CloudRuntimeException("ONTAP details validation failed, cannot create primary storage"); |
225 | 241 | } |
|
0 commit comments