This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new f607305 Fix potential NullPointerException in findStoragePool
(VolumeOrchestrator) (#5358)
f607305 is described below
commit f6073052aa3d592d6d737990a95c44e702908d59
Author: Junxuan Wu <[email protected]>
AuthorDate: Wed Sep 8 14:13:33 2021 -0400
Fix potential NullPointerException in findStoragePool (VolumeOrchestrator)
(#5358)
* fix null pointer exception when vm is null
* add null checker to getPreferredStoragePool method
Co-authored-by: junxuan <[email protected]>
---
.../apache/cloudstack/engine/orchestration/VolumeOrchestrator.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git
a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index 40881cf..3b93977 100644
---
a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++
b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -313,7 +313,10 @@ public class VolumeOrchestrator extends ManagerBase
implements VolumeOrchestrati
}
private Optional<StoragePool> getPreferredStoragePool(List<StoragePool>
poolList, VirtualMachine vm) {
- String accountStoragePoolUuid =
StorageManager.PreferredStoragePool.valueIn(vm.getAccountId());
+ String accountStoragePoolUuid = null;
+ if (vm != null) {
+ accountStoragePoolUuid =
StorageManager.PreferredStoragePool.valueIn(vm.getAccountId());
+ }
Optional<StoragePool> storagePool =
getMatchingStoragePool(accountStoragePoolUuid, poolList);
if (storagePool.isPresent()) {