|
29 | 29 | import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; |
30 | 30 | import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; |
31 | 31 | import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector; |
| 32 | +import org.apache.cloudstack.storage.volume.VolumeObject; |
32 | 33 | import org.apache.cloudstack.storage.command.CreateObjectCommand; |
33 | 34 | import org.apache.cloudstack.storage.feign.FeignClientFactory; |
34 | 35 | import org.apache.cloudstack.storage.feign.client.JobFeignClient; |
@@ -381,12 +382,22 @@ private ExportPolicy createExportPolicyRequest(AccessGroup accessGroup,String sv |
381 | 382 |
|
382 | 383 | private String updateCloudStackVolumeMetadata(String dataStoreId, DataObject volumeInfo) { |
383 | 384 | s_logger.info("createManagedNfsVolume called with datastoreID: {} volumeInfo: {} ", dataStoreId, volumeInfo ); |
384 | | - s_logger.info("line 379"); |
385 | 385 | try { |
386 | | - |
387 | | - |
388 | | - VolumeVO volume = volumeDao.findById(volumeInfo.getTO().getId()); |
389 | | - s_logger.info("line 381"); |
| 386 | + if (volumeInfo == null) { |
| 387 | + throw new CloudRuntimeException("volumeInfo is null"); |
| 388 | + } |
| 389 | + // Cast to VolumeObject to access the internal volumeVO directly |
| 390 | + if (!(volumeInfo instanceof VolumeObject)) { |
| 391 | + throw new CloudRuntimeException("volumeInfo is not a VolumeObject, it's: " + volumeInfo.getClass().getName()); |
| 392 | + } |
| 393 | + VolumeObject volumeObject = (VolumeObject) volumeInfo; |
| 394 | + long volumeId = volumeObject.getId(); |
| 395 | + s_logger.info("VolumeInfo ID from VolumeObject: {}", volumeId); |
| 396 | + VolumeVO volume = volumeDao.findById(volumeId); |
| 397 | + if (volume == null) { |
| 398 | + throw new CloudRuntimeException("VolumeVO not found for id: " + volumeId); |
| 399 | + } |
| 400 | + s_logger.info("Found VolumeVO: {}", volume); |
390 | 401 | String volumeUuid = volumeInfo.getUuid(); |
391 | 402 | s_logger.info("line 383"); |
392 | 403 | volume.setPoolType(Storage.StoragePoolType.NetworkFilesystem); |
|
0 commit comments