Skip to content

Commit ff6177d

Browse files
author
Marcus Sorensen
committed
CLOUDSTACK-1761 - Available local storage disk capacity incorrectly reported in
KVM to manager. This adds collection of available storage to KVM, not just used. Bugfix-for: 4.0.2, 4.1, master Submitted-by: Ted Smith <darnoth@gmail.com> Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1363966235 -0600
1 parent c305e3c commit ff6177d

4 files changed

Lines changed: 15 additions & 1 deletion

File tree

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3559,7 +3559,7 @@ public StartupCommand[] initialize() {
35593559
localStoragePool.getUuid(), cmd.getPrivateIpAddress(),
35603560
_localStoragePath, _localStoragePath,
35613561
StoragePoolType.Filesystem, localStoragePool.getCapacity(),
3562-
localStoragePool.getUsed());
3562+
localStoragePool.getAvailable());
35633563

35643564
sscmd = new StartupStorageCommand();
35653565
sscmd.setPoolInfo(pi);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public KVMPhysicalDisk createPhysicalDisk(String name,
3939

4040
public long getUsed();
4141

42+
public long getAvailable();
43+
4244
public boolean refresh();
4345

4446
public boolean isExternalSnapshot();

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ public KVMStoragePool getStoragePool(String uuid) {
351351
pool.refresh();
352352
pool.setCapacity(storage.getInfo().capacity);
353353
pool.setUsed(storage.getInfo().allocation);
354+
pool.setAvailable(storage.getInfo().available);
354355

355356
return pool;
356357
} catch (LibvirtException e) {
@@ -483,6 +484,7 @@ public KVMStoragePool createStoragePool(String name, String host, int port,
483484

484485
pool.setCapacity(sp.getInfo().capacity);
485486
pool.setUsed(sp.getInfo().allocation);
487+
pool.setAvailable(sp.getInfo().available);
486488

487489
return pool;
488490
} catch (LibvirtException e) {

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class LibvirtStoragePool implements KVMStoragePool {
2828
protected String uri;
2929
protected long capacity;
3030
protected long used;
31+
protected long available;
3132
protected String name;
3233
protected String localPath;
3334
protected PhysicalDiskFormat defaultFormat;
@@ -48,6 +49,7 @@ public LibvirtStoragePool(String uuid, String name, StoragePoolType type,
4849
this._storageAdaptor = adaptor;
4950
this.capacity = 0;
5051
this.used = 0;
52+
this.available = 0;
5153
this._pool = pool;
5254

5355
}
@@ -65,11 +67,19 @@ public void setUsed(long used) {
6567
this.used = used;
6668
}
6769

70+
public void setAvailable(long available) {
71+
this.available = available;
72+
}
73+
6874
@Override
6975
public long getUsed() {
7076
return this.used;
7177
}
7278

79+
public long getAvailable() {
80+
return this.available;
81+
}
82+
7383
public StoragePoolType getStoragePoolType() {
7484
return this.type;
7585
}

0 commit comments

Comments
 (0)