This is an automated email from the ASF dual-hosted git repository.

sureshanaparti pushed a commit to branch 4.16
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.16 by this push:
     new 7ea2cbd  Storage pool absent (#5841)
7ea2cbd is described below

commit 7ea2cbd889ac887f6ad08c9ce1c513d323bc46fe
Author: dahn <[email protected]>
AuthorDate: Tue Jan 11 07:48:55 2022 +0100

    Storage pool absent (#5841)
    
    * simple null check
    
    Co-authored-by: Daan Hoogland <[email protected]>
    Co-authored-by: Rohit Yadav <[email protected]>
    Co-authored-by: Daniel Augusto Veronezi Salvador 
<[email protected]>
---
 .../kvm/resource/wrapper/LibvirtGetStorageStatsCommandWrapper.java     | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetStorageStatsCommandWrapper.java
 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetStorageStatsCommandWrapper.java
index 294af53..3e44db0 100644
--- 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetStorageStatsCommandWrapper.java
+++ 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetStorageStatsCommandWrapper.java
@@ -37,6 +37,9 @@ public final class LibvirtGetStorageStatsCommandWrapper 
extends CommandWrapper<G
         try {
             final KVMStoragePoolManager storagePoolMgr = 
libvirtComputingResource.getStoragePoolMgr();
             final KVMStoragePool sp = 
storagePoolMgr.getStoragePool(command.getPooltype(), command.getStorageId(), 
true);
+            if (sp == null) {
+                return new GetStorageStatsAnswer(command, "no storage pool to 
get statistics from");
+            }
             return new GetStorageStatsAnswer(command, sp.getCapacity(), 
sp.getUsed());
         } catch (final CloudRuntimeException e) {
             return new GetStorageStatsAnswer(command, e.toString());

Reply via email to