Skip to content

Commit 7ea2cbd

Browse files
DaanHooglandDaan HooglandyadvrGutoVeronezi
authored
Storage pool absent (#5841)
* simple null check Co-authored-by: Daan Hoogland <dahn@onecht.net> Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com> Co-authored-by: Daniel Augusto Veronezi Salvador <38945620+GutoVeronezi@users.noreply.github.com>
1 parent fadd74a commit 7ea2cbd

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetStorageStatsCommandWrapper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public Answer execute(final GetStorageStatsCommand command, final LibvirtComputi
3737
try {
3838
final KVMStoragePoolManager storagePoolMgr = libvirtComputingResource.getStoragePoolMgr();
3939
final KVMStoragePool sp = storagePoolMgr.getStoragePool(command.getPooltype(), command.getStorageId(), true);
40+
if (sp == null) {
41+
return new GetStorageStatsAnswer(command, "no storage pool to get statistics from");
42+
}
4043
return new GetStorageStatsAnswer(command, sp.getCapacity(), sp.getUsed());
4144
} catch (final CloudRuntimeException e) {
4245
return new GetStorageStatsAnswer(command, e.toString());

0 commit comments

Comments
 (0)