mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
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 <atrocitythemetms@gmail.com>
This commit is contained in:
parent
30aeeb09d2
commit
f6073052aa
@ -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()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user