mirror of https://github.com/apache/cloudstack.git
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>
This commit is contained in:
parent
fadd74aaca
commit
7ea2cbd889
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Reference in New Issue