mirror of https://github.com/apache/cloudstack.git
kvm: Use getStoragePool after createStoragePool when we create a libvirt pool
This removes some redundant code
This commit is contained in:
parent
5f11c2e0be
commit
84cfb47281
|
|
@ -537,34 +537,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
|
||||||
sp.create(0);
|
sp.create(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LibvirtStoragePoolDef spd = getStoragePoolDef(conn, sp);
|
return getStoragePool(name);
|
||||||
LibvirtStoragePool pool = new LibvirtStoragePool(name, sp.getName(), type, this, sp);
|
|
||||||
|
|
||||||
if (pool.getType() != StoragePoolType.RBD) {
|
|
||||||
pool.setLocalPath(spd.getTargetPath());
|
|
||||||
} else {
|
|
||||||
pool.setLocalPath("");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pool.getType() == StoragePoolType.RBD
|
|
||||||
|| pool.getType() == StoragePoolType.Gluster) {
|
|
||||||
pool.setSourceHost(spd.getSourceHost());
|
|
||||||
pool.setSourcePort(spd.getSourcePort());
|
|
||||||
pool.setSourceDir(spd.getSourceDir());
|
|
||||||
String authUsername = spd.getAuthUserName();
|
|
||||||
if (authUsername != null) {
|
|
||||||
Secret secret = conn.secretLookupByUUIDString(spd.getSecretUUID());
|
|
||||||
String secretValue = new String(Base64.encodeBase64(secret.getByteValue()));
|
|
||||||
pool.setAuthUsername(authUsername);
|
|
||||||
pool.setAuthSecret(secretValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pool.setCapacity(sp.getInfo().capacity);
|
|
||||||
pool.setUsed(sp.getInfo().allocation);
|
|
||||||
pool.setAvailable(sp.getInfo().available);
|
|
||||||
|
|
||||||
return pool;
|
|
||||||
} catch (LibvirtException e) {
|
} catch (LibvirtException e) {
|
||||||
String error = e.toString();
|
String error = e.toString();
|
||||||
if (error.contains("Storage source conflict")) {
|
if (error.contains("Storage source conflict")) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue