cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kis...@apache.org
Subject [2/4] git commit: updated refs/heads/4.2 to 4f3e648
Date Wed, 14 Aug 2013 12:10:05 GMT
CLOUDSTACK-4295 : TemplateTO should contain physical size along with virtual size. Usage ignores
templates with size 0


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/903b92f6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/903b92f6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/903b92f6

Branch: refs/heads/4.2
Commit: 903b92f6ccc3c512fa79d5e408ca326fd93d3bff
Parents: 3be5605
Author: Kishan Kavala <kishan@cloud.com>
Authored: Wed Aug 14 15:07:46 2013 +0530
Committer: Kishan Kavala <kishan@cloud.com>
Committed: Wed Aug 14 17:28:22 2013 +0530

----------------------------------------------------------------------
 .../org/apache/cloudstack/storage/to/TemplateObjectTO.java  | 9 +++++++++
 .../cloudstack/storage/image/store/TemplateObject.java      | 1 +
 .../storage/resource/NfsSecondaryStorageResource.java       | 2 ++
 3 files changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/903b92f6/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java b/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java
index 2347de3..bcf6eb9 100644
--- a/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java
+++ b/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java
@@ -39,6 +39,7 @@ public class TemplateObjectTO implements DataTO {
     private String name;
     private String guestOsType;
     private Long size;
+    private Long physicalSize;
     private Hypervisor.HypervisorType hypervisorType;
 
     public TemplateObjectTO() {
@@ -200,6 +201,14 @@ public class TemplateObjectTO implements DataTO {
         this.size = size;
     }
 
+    public Long getPhysicalSize() {
+        return physicalSize;
+    }
+
+    public void setPhysicalSize(Long physicalSize) {
+        this.physicalSize = physicalSize;
+    }
+
     @Override
     public String toString() {
         return new StringBuilder("TemplateTO[id=").append(id).append("|origUrl=").append(origUrl)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/903b92f6/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
index 0c0aa99..174d5ca 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
@@ -198,6 +198,7 @@ public class TemplateObject implements TemplateInfo {
                     templateStoreRef.setDownloadPercent(100);
                     templateStoreRef.setDownloadState(Status.DOWNLOADED);
                     templateStoreRef.setSize(newTemplate.getSize());
+                    templateStoreRef.setPhysicalSize(newTemplate.getPhysicalSize());
                     templateStoreDao.update(templateStoreRef.getId(), templateStoreRef);
                     if (this.getDataStore().getRole() == DataStoreRole.Image) {
                         VMTemplateVO templateVO = this.imageDao.findById(this.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/903b92f6/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
index 3401006..e45b685 100755
--- a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
+++ b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
@@ -382,6 +382,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements
S
             newTemplate.setPath(destData.getPath() + File.separator + templateName);
             newTemplate.setFormat(ImageFormat.VHD);
             newTemplate.setSize(prop.getSize());
+            newTemplate.setPhysicalSize(prop.getPhysicalSize());
             return new CopyCmdAnswer(newTemplate);
         } catch (ConfigurationException e) {
             s_logger.debug("Failed to create template from snapshot: " + e.toString());
@@ -444,6 +445,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements
S
                 newTemplate.setPath(destData.getPath() + File.separator + templateName +
"." + ImageFormat.QCOW2.getFileExtension());
                 newTemplate.setFormat(ImageFormat.QCOW2);
                 newTemplate.setSize(prop.getSize());
+                newTemplate.setPhysicalSize(prop.getPhysicalSize());
                 return new CopyCmdAnswer(newTemplate);
             } catch (ConfigurationException e) {
                 s_logger.debug("Failed to create template:" + e.toString());


Mime
View raw message