Skip to content

Commit 3157080

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
testing fix 3
1 parent 20e2817 commit 3157080

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/UnifiedNASStrategy.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
3030
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
3131
import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
32+
import org.apache.cloudstack.storage.volume.VolumeObject;
3233
import org.apache.cloudstack.storage.command.CreateObjectCommand;
3334
import org.apache.cloudstack.storage.feign.FeignClientFactory;
3435
import org.apache.cloudstack.storage.feign.client.JobFeignClient;
@@ -381,12 +382,22 @@ private ExportPolicy createExportPolicyRequest(AccessGroup accessGroup,String sv
381382

382383
private String updateCloudStackVolumeMetadata(String dataStoreId, DataObject volumeInfo) {
383384
s_logger.info("createManagedNfsVolume called with datastoreID: {} volumeInfo: {} ", dataStoreId, volumeInfo );
384-
s_logger.info("line 379");
385385
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);
390401
String volumeUuid = volumeInfo.getUuid();
391402
s_logger.info("line 383");
392403
volume.setPoolType(Storage.StoragePoolType.NetworkFilesystem);

0 commit comments

Comments
 (0)