CLOUDSTACK-2120: mixed zone management - extend listSnapshots API to return zone type.

This commit is contained in:
Jessica Wang 2013-04-23 14:03:35 -07:00
parent 6230e5b77b
commit 15e2bc463f
2 changed files with 22 additions and 0 deletions

View File

@ -93,6 +93,14 @@ 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.ZONE_NAME)
@Param(description = "name of the availability zone")
private String zoneName;
@SerializedName(ApiConstants.ZONE_TYPE)
@Param(description = "network type of the availability zone")
private String zoneType;
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with snapshot", responseObject = ResourceTagResponse.class)
private List<ResourceTagResponse> tags;
@ -173,6 +181,14 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe
this.projectName = projectName;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
public void setZoneType(String zoneType) {
this.zoneType = zoneType;
}
public void setTags(List<ResourceTagResponse> tags) {
this.tags = tags;
}

View File

@ -443,6 +443,12 @@ public class ApiResponseHelper implements ResponseGenerator {
snapshotResponse.setVolumeId(volume.getUuid());
snapshotResponse.setVolumeName(volume.getName());
snapshotResponse.setVolumeType(volume.getVolumeType().name());
DataCenter zone = ApiDBUtils.findZoneById(volume.getDataCenterId());
if (zone != null) {
snapshotResponse.setZoneName(zone.getName());
snapshotResponse.setZoneType(zone.getNetworkType().toString());
}
}
snapshotResponse.setCreated(snapshot.getCreated());
snapshotResponse.setName(snapshot.getName());