Skip to content

Commit d5406e5

Browse files
piyush5netappSrivastava, Piyush
andauthored
feature/CSTACKEX-220: null check for volumeToAttach (#81)
### Description This PR... <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. --> <!-- For new features, provide link to FS, dev ML discussion etc. --> <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. --> <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged --> <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" --> <!-- Fixes: # --> <!--- ******************************************************************************* --> <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. --> <!--- PLEASE PUT AN 'X' in only **ONE** box --> <!--- ******************************************************************************* --> ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) - [ ] Build/CI - [ ] Test (unit or integration test code) ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [ ] Major - [ ] Minor #### Bug Severity - [ ] BLOCKER - [ ] Critical - [ ] Major - [ ] Minor - [ ] Trivial ### Screenshots (if appropriate): ### How Has This Been Tested? <!-- Please describe in detail how you tested your changes. --> <!-- Include details of your testing environment, and the tests you ran to --> #### How did you try to break this feature and the system with this change? <!-- see how your change affects other areas of the code, etc. --> <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document --> Co-authored-by: Srivastava, Piyush <Piyush.Srivastava@netapp.com>
1 parent 5311795 commit d5406e5

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/lifecycle/OntapPrimaryDatastoreLifecycle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ public boolean attachZone(DataStore dataStore, ZoneScope scope, Hypervisor.Hyper
340340
logger.error("attachZone : Storage Pool not found for id: " + dataStore.getId());
341341
throw new CloudRuntimeException("Storage Pool not found for id: " + dataStore.getId());
342342
}
343-
if (!Hypervisor.HypervisorType.KVM.equals(hypervisorType)){
343+
if (!Hypervisor.HypervisorType.KVM.equals(hypervisorType)) {
344344
logger.error("attachZone : ONTAP primary storage is supported only for KVM hypervisor");
345345
throw new CloudRuntimeException("ONTAP primary storage is supported only for KVM hypervisor");
346346
}

server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4852,7 +4852,7 @@ private VolumeVO sendAttachVolumeCommand(UserVmVO vm, VolumeVO volumeToAttach, L
48524852
// Reload volume from DB after grantAccess — managed storage drivers (e.g. ONTAP)
48534853
// may update the volume's path and iScsiName during grantAccess, so the local
48544854
// volumeToAttach object can be stale.
4855-
if(DataStoreProvider.ONTAP_PLUGIN_NAME.equals(volumeToAttachStoragePool.getStorageProviderName())){
4855+
if (volumeToAttachStoragePool != null && DataStoreProvider.ONTAP_PLUGIN_NAME.equals(volumeToAttachStoragePool.getStorageProviderName())) {
48564856
volumeToAttach = _volsDao.findById(volumeToAttach.getId());
48574857
}
48584858
}

0 commit comments

Comments
 (0)