Skip to content

Commit 48899e4

Browse files
committed
CLOUDSTACK-6783: Return a proper LibvirtStoragePool object after creating the pool
In situations where libvirt lost the storage pool the KVM Agent will re-create the storage pool in libvirt. This could be then libvirt is restarted for example. The object returned internally was missing essential information like the sourceDir aka the Ceph pool, the monitor IPs, cephx information and such. In this case the first operation on this newly created pool would fail. All operations afterwards would succeed.
1 parent d093a8a commit 48899e4

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,20 @@ public KVMStoragePool createStoragePool(String name, String host, int port, Stri
546546
pool.setLocalPath("");
547547
}
548548

549+
if (pool.getType() == StoragePoolType.RBD
550+
|| pool.getType() == StoragePoolType.Gluster) {
551+
pool.setSourceHost(spd.getSourceHost());
552+
pool.setSourcePort(spd.getSourcePort());
553+
pool.setSourceDir(spd.getSourceDir());
554+
String authUsername = spd.getAuthUserName();
555+
if (authUsername != null) {
556+
Secret secret = conn.secretLookupByUUIDString(spd.getSecretUUID());
557+
String secretValue = new String(Base64.encodeBase64(secret.getByteValue()));
558+
pool.setAuthUsername(authUsername);
559+
pool.setAuthSecret(secretValue);
560+
}
561+
}
562+
549563
pool.setCapacity(sp.getInfo().capacity);
550564
pool.setUsed(sp.getInfo().allocation);
551565
pool.setAvailable(sp.getInfo().available);

0 commit comments

Comments
 (0)