Skip to content

Commit c0d2c1b

Browse files
Marcus SorensenJoe Brockmeier
authored andcommitted
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 5ac59fb commit c0d2c1b

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
@@ -3332,7 +3332,7 @@ public StartupCommand[] initialize() {
33323332
localStoragePool.getUuid(), cmd.getPrivateIpAddress(),
33333333
_localStoragePath, _localStoragePath,
33343334
StoragePoolType.Filesystem, localStoragePool.getCapacity(),
3335-
localStoragePool.getUsed());
3335+
localStoragePool.getAvailable());
33363336

33373337
sscmd = new StartupStorageCommand();
33383338
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
@@ -403,6 +403,7 @@ public KVMStoragePool getStoragePool(String uuid) {
403403
pool.refresh();
404404
pool.setCapacity(storage.getInfo().capacity);
405405
pool.setUsed(storage.getInfo().allocation);
406+
pool.setAvailable(storage.getInfo().available);
406407

407408
return pool;
408409
} catch (LibvirtException e) {
@@ -535,6 +536,7 @@ public KVMStoragePool createStoragePool(String name, String host, int port,
535536

536537
pool.setCapacity(sp.getInfo().capacity);
537538
pool.setUsed(sp.getInfo().allocation);
539+
pool.setAvailable(sp.getInfo().available);
538540

539541
return pool;
540542
} 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)