From 16ba999bf1102938779f0b773984695b75ccd77e Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Tue, 23 Apr 2013 12:25:34 -0700 Subject: [PATCH] CLOUDSTACK-2120: mixed zone management - extend listNetworks API to return zone type. --- .../apache/cloudstack/api/response/NetworkResponse.java | 7 +++++++ server/src/com/cloud/api/ApiResponseHelper.java | 1 + 2 files changed, 8 insertions(+) diff --git a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java index cd32dede3c8..3f366e2e576 100644 --- a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java +++ b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java @@ -66,6 +66,9 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes @SerializedName(ApiConstants.ZONE_NAME) @Param(description="the name of the zone the network belongs to") private String zoneName; + + @SerializedName(ApiConstants.ZONE_TYPE) @Param(description="the networktype of the zone the network belongs to") + private String zoneType; @SerializedName("networkofferingid") @Param(description="network offering id the network is created from") private String networkOfferingId; @@ -291,6 +294,10 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes this.zoneName = zoneName; } + public void setZoneType(String zoneType) { + this.zoneType = zoneType; + } + public void setCidr(String cidr) { this.cidr = cidr; } diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index a7d6165e6ae..84dc46e52f4 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -2354,6 +2354,7 @@ public class ApiResponseHelper implements ResponseGenerator { if (zone != null) { response.setZoneId(zone.getUuid()); response.setZoneName(zone.getName()); + response.setZoneType(zone.getNetworkType().toString()); } if (network.getPhysicalNetworkId() != null) { PhysicalNetworkVO pnet = ApiDBUtils.findPhysicalNetworkById(network.getPhysicalNetworkId());