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
This commit is contained in:
Marcus Sorensen 2013-03-22 09:30:35 -06:00
parent c305e3c5a1
commit ff6177d119
4 changed files with 15 additions and 1 deletions

View File

@ -3559,7 +3559,7 @@ ServerResource {
localStoragePool.getUuid(), cmd.getPrivateIpAddress(),
_localStoragePath, _localStoragePath,
StoragePoolType.Filesystem, localStoragePool.getCapacity(),
localStoragePool.getUsed());
localStoragePool.getAvailable());
sscmd = new StartupStorageCommand();
sscmd.setPoolInfo(pi);

View File

@ -39,6 +39,8 @@ public interface KVMStoragePool {
public long getUsed();
public long getAvailable();
public boolean refresh();
public boolean isExternalSnapshot();

View File

@ -351,6 +351,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
pool.refresh();
pool.setCapacity(storage.getInfo().capacity);
pool.setUsed(storage.getInfo().allocation);
pool.setAvailable(storage.getInfo().available);
return pool;
} catch (LibvirtException e) {
@ -483,6 +484,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
pool.setCapacity(sp.getInfo().capacity);
pool.setUsed(sp.getInfo().allocation);
pool.setAvailable(sp.getInfo().available);
return pool;
} catch (LibvirtException e) {

View File

@ -28,6 +28,7 @@ public class LibvirtStoragePool implements KVMStoragePool {
protected String uri;
protected long capacity;
protected long used;
protected long available;
protected String name;
protected String localPath;
protected PhysicalDiskFormat defaultFormat;
@ -48,6 +49,7 @@ public class LibvirtStoragePool implements KVMStoragePool {
this._storageAdaptor = adaptor;
this.capacity = 0;
this.used = 0;
this.available = 0;
this._pool = pool;
}
@ -65,11 +67,19 @@ public class LibvirtStoragePool implements KVMStoragePool {
this.used = used;
}
public void setAvailable(long available) {
this.available = available;
}
@Override
public long getUsed() {
return this.used;
}
public long getAvailable() {
return this.available;
}
public StoragePoolType getStoragePoolType() {
return this.type;
}