Skip to content

Commit b880b67

Browse files
committed
optimize
1 parent 4ecc286 commit b880b67

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

‎plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/ClvmStorageAdaptor.java‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,21 @@ public boolean deleteStoragePool(String uuid) {
9696

9797
if (decStoragePoolRefCount(uuid)) {
9898
logger.info("deleteStoragePool: CLVM/CLVM_NG storage pool {} still in use", uuid);
99-
return true;
100-
}
101-
102-
try {
103-
return undefineInactiveClvmPool(LibvirtConnection.getConnection(), uuid);
104-
} catch (LibvirtException e) {
105-
throw new CloudRuntimeException(e.toString(), e);
99+
} else {
100+
try {
101+
undefineInactiveClvmPool(LibvirtConnection.getConnection(), uuid);
102+
} catch (LibvirtException e) {
103+
throw new CloudRuntimeException(e.toString(), e);
104+
}
106105
}
106+
return true;
107107
}
108108

109-
private boolean undefineInactiveClvmPool(Connect conn, String uuid) throws LibvirtException {
109+
private void undefineInactiveClvmPool(Connect conn, String uuid) throws LibvirtException {
110110
StoragePool sp = lookupClvmPool(conn, uuid);
111111
if (sp == null) {
112112
logger.warn("CLVM/CLVM_NG storage pool {} doesn't exist in libvirt. Assuming it is already removed", uuid);
113-
return true;
113+
return;
114114
}
115115

116116
try {
@@ -124,7 +124,6 @@ private boolean undefineInactiveClvmPool(Connect conn, String uuid) throws Libvi
124124
sp.free();
125125
}
126126
logger.info("CLVM/CLVM_NG storage pool {} was successfully removed from libvirt", uuid);
127-
return true;
128127
}
129128

130129
private StoragePool lookupClvmPool(Connect conn, String uuid) throws LibvirtException {

0 commit comments

Comments
 (0)