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

(cherry picked from commit 520d96724ac437aa0a9ed391066f4f0879eaef7e)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Sanjay Tripathi 2015-03-10 16:17:10 +05:30 committed by Rohit Yadav
parent 290938b08e
commit 5aedeb74f9
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(); TemplateObjectTO newTemplate = (TemplateObjectTO)cpyAnswer.getNewData();
VMTemplateStoragePoolVO templatePoolRef = templatePoolDao.findByPoolTemplate(getDataStore().getId(), getId()); VMTemplateStoragePoolVO templatePoolRef = templatePoolDao.findByPoolTemplate(getDataStore().getId(), getId());
templatePoolRef.setDownloadPercent(100); templatePoolRef.setDownloadPercent(100);
templatePoolRef.setTemplateSize(newTemplate.getSize());
templatePoolRef.setDownloadState(Status.DOWNLOADED); templatePoolRef.setDownloadState(Status.DOWNLOADED);
templatePoolRef.setLocalDownloadPath(newTemplate.getPath()); templatePoolRef.setLocalDownloadPath(newTemplate.getPath());
templatePoolRef.setInstallPath(newTemplate.getPath()); templatePoolRef.setInstallPath(newTemplate.getPath());

View File

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

View File

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

View File

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

View File

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