LOUDSTACK-2120: mixed zone management - extend listVirtualMachines API to return zone type.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/612e5fb6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/612e5fb6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/612e5fb6 Branch: refs/heads/ui-vm-affinity Commit: 612e5fb6726d1b0b9408072e4a95abfe696d2eb3 Parents: 060be08 Author: Jessica Wang <[email protected]> Authored: Sat Apr 20 18:42:18 2013 -0700 Committer: Jessica Wang <[email protected]> Committed: Mon Apr 22 10:08:19 2013 -0700 ---------------------------------------------------------------------- .../org/apache/cloudstack/api/ApiConstants.java | 1 + .../cloudstack/api/response/UserVmResponse.java | 7 +++++++ .../com/cloud/api/query/dao/UserVmJoinDaoImpl.java | 1 + .../src/com/cloud/api/query/vo/UserVmJoinVO.java | 13 +++++++++++++ setup/db/db/schema-40to410.sql | 2 ++ setup/db/db/schema-410to420.sql | 1 + 6 files changed, 25 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/612e5fb6/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 d73f309..e774ecc 100755 --- a/api/src/org/apache/cloudstack/api/ApiConstants.java +++ b/api/src/org/apache/cloudstack/api/ApiConstants.java @@ -231,6 +231,7 @@ public class ApiConstants { public static final String VOLUME_ID = "volumeid"; public static final String ZONE_ID = "zoneid"; public static final String ZONE_NAME = "zonename"; + public static final String ZONE_TYPE = "zonetype"; public static final String NETWORK_TYPE = "networktype"; public static final String PAGE = "page"; public static final String PAGE_SIZE = "pagesize"; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/612e5fb6/api/src/org/apache/cloudstack/api/response/UserVmResponse.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java b/api/src/org/apache/cloudstack/api/response/UserVmResponse.java index 212601c..da08c94 100644 --- a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java +++ b/api/src/org/apache/cloudstack/api/response/UserVmResponse.java @@ -80,6 +80,9 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp @SerializedName(ApiConstants.ZONE_NAME) @Param(description="the name of the availability zone for the virtual machine") private String zoneName; + @SerializedName(ApiConstants.ZONE_TYPE) @Param(description="the network type of the availability zone for the virtual machine") + private String zoneType; + @SerializedName(ApiConstants.HOST_ID) @Param(description="the ID of the host for the virtual machine") private String hostId; @@ -249,6 +252,10 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp this.zoneName = zoneName; } + public void setZoneType(String zoneType) { + this.zoneType = zoneType; + } + public void setHostId(String hostId) { this.hostId = hostId; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/612e5fb6/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java index 4ed6226..2bb7ee9 100644 --- a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java @@ -101,6 +101,7 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO, Long> implem } userVmResponse.setZoneId(userVm.getDataCenterUuid()); userVmResponse.setZoneName(userVm.getDataCenterName()); + userVmResponse.setZoneType(userVm.getDataCenterType()); if ((caller == null) || (caller.getType() == Account.ACCOUNT_TYPE_ADMIN)) { userVmResponse.setInstanceName(userVm.getInstanceName()); userVmResponse.setHostId(userVm.getHostUuid()); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/612e5fb6/server/src/com/cloud/api/query/vo/UserVmJoinVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/vo/UserVmJoinVO.java b/server/src/com/cloud/api/query/vo/UserVmJoinVO.java index 8d1314e..a50906d 100644 --- a/server/src/com/cloud/api/query/vo/UserVmJoinVO.java +++ b/server/src/com/cloud/api/query/vo/UserVmJoinVO.java @@ -153,6 +153,9 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity { @Column(name="data_center_name") private String dataCenterName = null; + @Column(name="data_center_type") + private String dataCenterType = null; + @Column(name="security_group_enabled") private boolean securityGroupEnabled; @@ -800,7 +803,17 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity { public void setDataCenterName(String zoneName) { this.dataCenterName = zoneName; } + + + public String getDataCenterType() { + return dataCenterType; + } + + public void setDataCenterType(String zoneType) { + this.dataCenterType = zoneType; + } + public boolean isSecurityGroupEnabled() { return securityGroupEnabled; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/612e5fb6/setup/db/db/schema-40to410.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql index e2949d9..57d6ab9 100644 --- a/setup/db/db/schema-40to410.sql +++ b/setup/db/db/schema-40to410.sql @@ -487,6 +487,7 @@ CREATE VIEW `cloud`.`user_vm_view` AS data_center.id data_center_id, data_center.uuid data_center_uuid, data_center.name data_center_name, + data_center.networktype data_center_type, data_center.is_security_group_enabled security_group_enabled, host.id host_id, host.uuid host_uuid, @@ -1456,6 +1457,7 @@ CREATE VIEW `cloud`.`storage_pool_view` AS data_center.id data_center_id, data_center.uuid data_center_uuid, data_center.name data_center_name, + data_center.name data_center_type, host_pod_ref.id pod_id, host_pod_ref.uuid pod_uuid, host_pod_ref.name pod_name, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/612e5fb6/setup/db/db/schema-410to420.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql index 93a685f..10cdbba 100644 --- a/setup/db/db/schema-410to420.sql +++ b/setup/db/db/schema-410to420.sql @@ -374,6 +374,7 @@ CREATE VIEW `cloud`.`user_vm_view` AS data_center.id data_center_id, data_center.uuid data_center_uuid, data_center.name data_center_name, + data_center.networktype data_center_type, data_center.is_security_group_enabled security_group_enabled, host.id host_id, host.uuid host_uuid,
