mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-8066: There is not way to know the size of the snapshot created.
(cherry picked from commit 9153b8bede)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
c06ca09b54
commit
8676ff26e0
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -36,4 +36,6 @@ public interface SnapshotInfo extends DataObject, Snapshot {
|
|||
ObjectInDataStoreStateMachine.State getStatus();
|
||||
|
||||
boolean isRevertable();
|
||||
|
||||
long getPhysicalSize();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,6 +138,16 @@ public class SnapshotObject implements SnapshotInfo {
|
|||
return false;
|
||||
}
|
||||
|
||||
@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());
|
||||
|
|
|
|||
|
|
@ -470,6 +470,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
snapshotResponse.setRevertable(false);
|
||||
} else {
|
||||
snapshotResponse.setRevertable(snapshotInfo.isRevertable());
|
||||
snapshotResponse.setPhysicaSize(snapshotInfo.getPhysicalSize());
|
||||
}
|
||||
|
||||
// set tag information
|
||||
|
|
|
|||
Loading…
Reference in New Issue