cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sanjaytripa...@apache.org
Subject git commit: updated refs/heads/master to 9153b8b
Date Wed, 17 Dec 2014 10:50:46 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master cf1eed481 -> 9153b8bed


CLOUDSTACK-8066: There is not way to know the size of the snapshot created.


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

Branch: refs/heads/master
Commit: 9153b8bede3350750cb7a78891e0479cc72aa2ec
Parents: cf1eed4
Author: Sanjay Tripathi <sanjay.tripathi@citrix.com>
Authored: Wed Dec 17 15:51:47 2014 +0530
Committer: Sanjay Tripathi <sanjay.tripathi@citrix.com>
Committed: Wed Dec 17 16:00:19 2014 +0530

----------------------------------------------------------------------
 api/src/org/apache/cloudstack/api/ApiConstants.java       |  1 +
 .../apache/cloudstack/api/response/SnapshotResponse.java  |  8 ++++++++
 .../engine/subsystem/api/storage/SnapshotInfo.java        |  2 ++
 .../cloudstack/storage/snapshot/SnapshotObject.java       | 10 ++++++++++
 server/src/com/cloud/api/ApiResponseHelper.java           |  1 +
 5 files changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9153b8be/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index 762ad70..6bd5dde 100644
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -613,6 +613,7 @@ public class ApiConstants {
     public static final String REGION_LEVEL_VPC = "regionlevelvpc";
     public static final String STRECHED_L2_SUBNET = "strechedl2subnet";
     public static final String NETWORK_SPANNED_ZONES = "zonesnetworkspans";
+    public static final String PHYSICAL_SIZE = "physicalsize";
 
     public enum HostDetails {
         all, capacity, events, stats, min;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9153b8be/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java b/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
index 10cb202..aa8de5c 100644
--- a/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
@@ -86,6 +86,10 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe
     @Param(description = "the state of the snapshot. BackedUp means that snapshot is ready
to be used; Creating - the snapshot is being allocated on the primary storage; BackingUp -
the snapshot is being backed up on secondary storage")
     private Snapshot.State state;
 
+    @SerializedName(ApiConstants.PHYSICAL_SIZE)
+    @Param(description = "physical size of backedup snapshot on image store")
+    private long physicalSize;
+
     @SerializedName(ApiConstants.ZONE_ID)
     @Param(description = "id of the availability zone")
     private String zoneId;
@@ -166,6 +170,10 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe
         this.state = state;
     }
 
+    public void setPhysicaSize(long physicalSize) {
+        this.physicalSize = physicalSize;
+    }
+
     @Override
     public void setProjectId(String projectId) {
         this.projectId = projectId;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9153b8be/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.java
b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.java
index 7865965..0f05ca1 100644
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.java
@@ -36,4 +36,6 @@ public interface SnapshotInfo extends DataObject, Snapshot {
     ObjectInDataStoreStateMachine.State getStatus();
 
     boolean isRevertable();
+
+    long getPhysicalSize();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9153b8be/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
index c64f78f..60ff31e 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
@@ -139,6 +139,16 @@ public class SnapshotObject implements SnapshotInfo {
     }
 
     @Override
+    public long getPhysicalSize() {
+        long physicalSize = 0;
+        SnapshotDataStoreVO snapshotStore = snapshotStoreDao.findBySnapshot(snapshot.getId(),
DataStoreRole.Image);
+        if (snapshotStore != null) {
+            physicalSize = snapshotStore.getPhysicalSize();
+        }
+        return physicalSize;
+    }
+
+    @Override
     public VolumeInfo getBaseVolume() {
         return volFactory.getVolume(snapshot.getVolumeId());
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9153b8be/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 89c1eb7..dd55486 100644
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -493,6 +493,7 @@ public class ApiResponseHelper implements ResponseGenerator {
             snapshotResponse.setRevertable(false);
         } else {
         snapshotResponse.setRevertable(snapshotInfo.isRevertable());
+        snapshotResponse.setPhysicaSize(snapshotInfo.getPhysicalSize());
         }
 
         // set tag information


Mime
View raw message