CLOUDSTACK-8312: The storage usage of "Primary Storage Allocated" is incorrect.

This commit is contained in:
Sanjay Tripathi 2015-03-10 16:17:10 +05:30
parent 1fd401ff43
commit 520d96724a
5 changed files with 7 additions and 5 deletions

View File

@ -190,6 +190,7 @@ public class TemplateObject implements TemplateInfo {
TemplateObjectTO newTemplate = (TemplateObjectTO)cpyAnswer.getNewData();
VMTemplateStoragePoolVO templatePoolRef = templatePoolDao.findByPoolTemplate(getDataStore().getId(), getId());
templatePoolRef.setDownloadPercent(100);
templatePoolRef.setTemplateSize(newTemplate.getSize());
templatePoolRef.setDownloadState(Status.DOWNLOADED);
templatePoolRef.setLocalDownloadPath(newTemplate.getPath());
templatePoolRef.setInstallPath(newTemplate.getPath());

View File

@ -228,6 +228,7 @@ public class KVMStorageProcessor implements StorageProcessor {
if (destData.getObjectType() == DataObjectType.TEMPLATE) {
TemplateObjectTO newTemplate = new TemplateObjectTO();
newTemplate.setPath(primaryVol.getName());
newTemplate.setSize(primaryVol.getSize());
if (primaryPool.getType() == StoragePoolType.RBD) {
newTemplate.setFormat(ImageFormat.RAW);
} else {
@ -237,6 +238,7 @@ public class KVMStorageProcessor implements StorageProcessor {
} else if (destData.getObjectType() == DataObjectType.VOLUME) {
VolumeObjectTO volumeObjectTO = new VolumeObjectTO();
volumeObjectTO.setPath(primaryVol.getName());
volumeObjectTO.setSize(primaryVol.getSize());
if (primaryVol.getFormat() == PhysicalDiskFormat.RAW)
volumeObjectTO.setFormat(ImageFormat.RAW);
else if (primaryVol.getFormat() == PhysicalDiskFormat.QCOW2) {

View File

@ -850,6 +850,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
VDI tmplVdi = getVDIbyUuid(conn, tmplUuid);
final String uuidToReturn;
Long physicalSize = tmplVdi.getPhysicalUtilisation(conn);
if (managed) {
uuidToReturn = tmplUuid;
@ -876,6 +877,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
newVol.setUuid(uuidToReturn);
newVol.setPath(uuidToReturn);
newVol.setSize(physicalSize);
newVol.setFormat(ImageFormat.VHD);
return new CopyCmdAnswer(newVol);

View File

@ -265,6 +265,7 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor {
VDI tmplVdi = Types.toVDI(task, conn);
final String uuidToReturn;
Long physicalSize = tmplVdi.getPhysicalUtilisation(conn);
if (managed) {
uuidToReturn = tmplVdi.getUuid(conn);
@ -291,6 +292,7 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor {
newVol.setUuid(uuidToReturn);
newVol.setPath(uuidToReturn);
newVol.setSize(physicalSize);
newVol.setFormat(Storage.ImageFormat.VHD);
return new CopyCmdAnswer(newVol);

View File

@ -573,11 +573,6 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
totalAllocatedSize += templateSize + _extraBytesPerVolume;
}
// Add the size for the templateForVmCreation if its not already present
/*if ((templateForVmCreation != null) && !tmpinstalled) {
}*/
return totalAllocatedSize;
}