mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-2120: mixed zone management - extend listPods, listClusters, listHosts, listStoragePools, listSystemVms, listRouters API to return zone type.
This commit is contained in:
parent
15e2bc463f
commit
04a2b2d326
@ -46,7 +46,10 @@ public class ClusterResponse extends BaseResponse {
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name of the cluster")
|
||||
private String zoneName;
|
||||
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network type of the availability zone")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName("hypervisortype") @Param(description="the hypervisor type of the cluster")
|
||||
private String hypervisorType;
|
||||
|
||||
@ -116,6 +119,10 @@ public class ClusterResponse extends BaseResponse {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public String getClusterType() {
|
||||
return clusterType;
|
||||
}
|
||||
|
||||
@ -42,6 +42,9 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
|
||||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name for the router")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network type of the availability zone")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName(ApiConstants.DNS1) @Param(description="the first DNS for the router")
|
||||
private String dns1;
|
||||
|
||||
@ -186,6 +189,14 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public void setDns1(String dns1) {
|
||||
this.dns1 = dns1;
|
||||
}
|
||||
|
||||
@ -59,7 +59,10 @@ public class HostResponse extends BaseResponse {
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name of the host")
|
||||
private String zoneName;
|
||||
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network type of the availability zone")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName(ApiConstants.POD_ID) @Param(description="the Pod ID of the host")
|
||||
private String podId;
|
||||
|
||||
@ -209,6 +212,10 @@ public class HostResponse extends BaseResponse {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public void setPodId(String podId) {
|
||||
this.podId = podId;
|
||||
}
|
||||
|
||||
@ -36,10 +36,13 @@ public class PodResponse extends BaseResponse {
|
||||
|
||||
@SerializedName("zoneid") @Param(description="the Zone ID of the Pod")
|
||||
private String zoneId;
|
||||
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name of the Pod")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network type of the availability zone")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName("gateway") @Param(description="the gateway of the Pod")
|
||||
private String gateway;
|
||||
|
||||
@ -86,6 +89,10 @@ public class PodResponse extends BaseResponse {
|
||||
return zoneName;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public void setZoneName(String zoneName) {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
@ -38,12 +38,15 @@ public class StoragePoolResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name of the storage pool")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network type of the availability zone")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName("podid") @Param(description="the Pod ID of the storage pool")
|
||||
private String podId;
|
||||
|
||||
@SerializedName("podname") @Param(description="the Pod name of the storage pool")
|
||||
private String podName;
|
||||
|
||||
private String podName;
|
||||
|
||||
@SerializedName("name") @Param(description="the name of the storage pool")
|
||||
private String name;
|
||||
|
||||
@ -126,6 +129,14 @@ public class StoragePoolResponse extends BaseResponse {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public String getPodId() {
|
||||
return podId;
|
||||
}
|
||||
|
||||
@ -46,6 +46,9 @@ public class SystemVmResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name for the system VM")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network type of the availability zone")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName("dns1") @Param(description="the first DNS for the system VM")
|
||||
private String dns1;
|
||||
|
||||
@ -150,7 +153,15 @@ public class SystemVmResponse extends BaseResponse {
|
||||
public void setZoneName(String zoneName) {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public String getDns1() {
|
||||
return dns1;
|
||||
}
|
||||
|
||||
@ -817,6 +817,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
if (zone != null) {
|
||||
podResponse.setZoneId(zone.getUuid());
|
||||
podResponse.setZoneName(zone.getName());
|
||||
podResponse.setZoneType(zone.getNetworkType().toString());
|
||||
}
|
||||
podResponse.setNetmask(NetUtils.getCidrNetmask(pod.getCidrSize()));
|
||||
podResponse.setStartIp(ipRange[0]);
|
||||
@ -961,6 +962,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
if (dc != null) {
|
||||
clusterResponse.setZoneId(dc.getUuid());
|
||||
clusterResponse.setZoneName(dc.getName());
|
||||
clusterResponse.setZoneType(dc.getNetworkType().toString());
|
||||
}
|
||||
clusterResponse.setHypervisorType(cluster.getHypervisorType().toString());
|
||||
clusterResponse.setClusterType(cluster.getClusterType().toString());
|
||||
@ -1165,6 +1167,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
if (zone != null) {
|
||||
vmResponse.setZoneId(zone.getUuid());
|
||||
vmResponse.setZoneName(zone.getName());
|
||||
vmResponse.setZoneType(zone.getNetworkType().toString());
|
||||
vmResponse.setDns1(zone.getDns1());
|
||||
vmResponse.setDns2(zone.getDns2());
|
||||
}
|
||||
|
||||
@ -148,6 +148,7 @@ public class DomainRouterJoinDaoImpl extends GenericDaoBase<DomainRouterJoinVO,
|
||||
routerResponse.setDomainName(router.getDomainName());
|
||||
|
||||
routerResponse.setZoneName(router.getDataCenterName());
|
||||
routerResponse.setZoneType(router.getDataCenterType());
|
||||
routerResponse.setDns1(router.getDns1());
|
||||
routerResponse.setDns2(router.getDns2());
|
||||
|
||||
|
||||
@ -99,6 +99,7 @@ public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements
|
||||
hostResponse.setOsCategoryId(host.getOsCategoryUuid());
|
||||
hostResponse.setOsCategoryName(host.getOsCategoryName());
|
||||
hostResponse.setZoneName(host.getZoneName());
|
||||
hostResponse.setZoneType(host.getZoneType().toString());
|
||||
hostResponse.setPodName(host.getPodName());
|
||||
if ( host.getClusterId() > 0) {
|
||||
hostResponse.setClusterName(host.getClusterName());
|
||||
|
||||
@ -77,6 +77,7 @@ public class StoragePoolJoinDaoImpl extends GenericDaoBase<StoragePoolJoinVO, Lo
|
||||
poolResponse.setIpAddress(pool.getHostAddress());
|
||||
poolResponse.setZoneId(pool.getZoneUuid());
|
||||
poolResponse.setZoneName(pool.getZoneName());
|
||||
poolResponse.setZoneType(pool.getZoneType());
|
||||
if (pool.getPoolType() != null) {
|
||||
poolResponse.setType(pool.getPoolType().toString());
|
||||
}
|
||||
|
||||
@ -101,6 +101,9 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
|
||||
@Column(name="data_center_name")
|
||||
private String dataCenterName = null;
|
||||
|
||||
@Column(name="data_center_type")
|
||||
private String dataCenterType;
|
||||
|
||||
@Column(name="dns1")
|
||||
private String dns1 = null;
|
||||
|
||||
@ -447,6 +450,15 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
|
||||
this.dataCenterName = zoneName;
|
||||
}
|
||||
|
||||
|
||||
public String getDataCenterType() {
|
||||
return dataCenterType;
|
||||
}
|
||||
|
||||
public void setDataCenterType(String dataCenterType) {
|
||||
this.dataCenterType = dataCenterType;
|
||||
}
|
||||
|
||||
|
||||
public Long getHostId() {
|
||||
return hostId;
|
||||
|
||||
@ -130,6 +130,9 @@ public class HostJoinVO extends BaseViewVO implements InternalIdentity, Identity
|
||||
@Column(name="data_center_name")
|
||||
private String zoneName;
|
||||
|
||||
@Column(name="data_center_type")
|
||||
private String zoneType;
|
||||
|
||||
@Column(name="pod_id")
|
||||
private long podId;
|
||||
|
||||
@ -231,7 +234,15 @@ public class HostJoinVO extends BaseViewVO implements InternalIdentity, Identity
|
||||
public void setZoneName(String zoneName) {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@ -97,6 +97,9 @@ public class StoragePoolJoinVO extends BaseViewVO implements InternalIdentity, I
|
||||
@Column(name="data_center_name")
|
||||
private String zoneName;
|
||||
|
||||
@Column(name="data_center_type")
|
||||
private String zoneType;
|
||||
|
||||
@Column(name="pod_id")
|
||||
private long podId;
|
||||
|
||||
@ -283,6 +286,14 @@ public class StoragePoolJoinVO extends BaseViewVO implements InternalIdentity, I
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public long getPodId() {
|
||||
return podId;
|
||||
}
|
||||
|
||||
@ -544,6 +544,77 @@ CREATE VIEW `cloud`.`affinity_group_view` AS
|
||||
left join
|
||||
`cloud`.`user_vm` ON user_vm.id = vm_instance.id;
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`host_view`;
|
||||
CREATE VIEW `cloud`.`host_view` AS
|
||||
select
|
||||
host.id,
|
||||
host.uuid,
|
||||
host.name,
|
||||
host.status,
|
||||
host.disconnected,
|
||||
host.type,
|
||||
host.private_ip_address,
|
||||
host.version,
|
||||
host.hypervisor_type,
|
||||
host.hypervisor_version,
|
||||
host.capabilities,
|
||||
host.last_ping,
|
||||
host.created,
|
||||
host.removed,
|
||||
host.resource_state,
|
||||
host.mgmt_server_id,
|
||||
host.cpus,
|
||||
host.speed,
|
||||
host.ram,
|
||||
cluster.id cluster_id,
|
||||
cluster.uuid cluster_uuid,
|
||||
cluster.name cluster_name,
|
||||
cluster.cluster_type,
|
||||
data_center.id data_center_id,
|
||||
data_center.uuid data_center_uuid,
|
||||
data_center.name data_center_name,
|
||||
data_center.networktype data_center_type,
|
||||
host_pod_ref.id pod_id,
|
||||
host_pod_ref.uuid pod_uuid,
|
||||
host_pod_ref.name pod_name,
|
||||
host_tags.tag,
|
||||
guest_os_category.id guest_os_category_id,
|
||||
guest_os_category.uuid guest_os_category_uuid,
|
||||
guest_os_category.name guest_os_category_name,
|
||||
mem_caps.used_capacity memory_used_capacity,
|
||||
mem_caps.reserved_capacity memory_reserved_capacity,
|
||||
cpu_caps.used_capacity cpu_used_capacity,
|
||||
cpu_caps.reserved_capacity cpu_reserved_capacity,
|
||||
async_job.id job_id,
|
||||
async_job.uuid job_uuid,
|
||||
async_job.job_status job_status,
|
||||
async_job.account_id job_account_id
|
||||
from
|
||||
`cloud`.`host`
|
||||
left join
|
||||
`cloud`.`cluster` ON host.cluster_id = cluster.id
|
||||
left join
|
||||
`cloud`.`data_center` ON host.data_center_id = data_center.id
|
||||
left join
|
||||
`cloud`.`host_pod_ref` ON host.pod_id = host_pod_ref.id
|
||||
left join
|
||||
`cloud`.`host_details` ON host.id = host_details.id
|
||||
and host_details.name = 'guest.os.category.id'
|
||||
left join
|
||||
`cloud`.`guest_os_category` ON guest_os_category.id = CONVERT( host_details.value , UNSIGNED)
|
||||
left join
|
||||
`cloud`.`host_tags` ON host_tags.host_id = host.id
|
||||
left join
|
||||
`cloud`.`op_host_capacity` mem_caps ON host.id = mem_caps.host_id
|
||||
and mem_caps.capacity_type = 0
|
||||
left join
|
||||
`cloud`.`op_host_capacity` cpu_caps ON host.id = cpu_caps.host_id
|
||||
and cpu_caps.capacity_type = 1
|
||||
left join
|
||||
`cloud`.`async_job` ON async_job.instance_id = host.id
|
||||
and async_job.instance_type = 'Host'
|
||||
and async_job.job_status = 0;
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`volume_view`;
|
||||
CREATE VIEW `cloud`.`volume_view` AS
|
||||
select
|
||||
@ -645,7 +716,164 @@ CREATE VIEW `cloud`.`volume_view` AS
|
||||
`cloud`.`async_job` ON async_job.instance_id = volumes.id
|
||||
and async_job.instance_type = 'Volume'
|
||||
and async_job.job_status = 0;
|
||||
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`storage_pool_view`;
|
||||
CREATE VIEW `cloud`.`storage_pool_view` AS
|
||||
select
|
||||
storage_pool.id,
|
||||
storage_pool.uuid,
|
||||
storage_pool.name,
|
||||
storage_pool.status,
|
||||
storage_pool.path,
|
||||
storage_pool.pool_type,
|
||||
storage_pool.host_address,
|
||||
storage_pool.created,
|
||||
storage_pool.removed,
|
||||
storage_pool.capacity_bytes,
|
||||
storage_pool.scope,
|
||||
cluster.id cluster_id,
|
||||
cluster.uuid cluster_uuid,
|
||||
cluster.name cluster_name,
|
||||
cluster.cluster_type,
|
||||
data_center.id data_center_id,
|
||||
data_center.uuid data_center_uuid,
|
||||
data_center.name data_center_name,
|
||||
data_center.networktype data_center_type,
|
||||
host_pod_ref.id pod_id,
|
||||
host_pod_ref.uuid pod_uuid,
|
||||
host_pod_ref.name pod_name,
|
||||
storage_pool_details.name tag,
|
||||
op_host_capacity.used_capacity disk_used_capacity,
|
||||
op_host_capacity.reserved_capacity disk_reserved_capacity,
|
||||
async_job.id job_id,
|
||||
async_job.uuid job_uuid,
|
||||
async_job.job_status job_status,
|
||||
async_job.account_id job_account_id
|
||||
from
|
||||
`cloud`.`storage_pool`
|
||||
left join
|
||||
`cloud`.`cluster` ON storage_pool.cluster_id = cluster.id
|
||||
left join
|
||||
`cloud`.`data_center` ON storage_pool.data_center_id = data_center.id
|
||||
left join
|
||||
`cloud`.`host_pod_ref` ON storage_pool.pod_id = host_pod_ref.id
|
||||
left join
|
||||
`cloud`.`storage_pool_details` ON storage_pool_details.pool_id = storage_pool.id
|
||||
and storage_pool_details.value = 'true'
|
||||
left join
|
||||
`cloud`.`op_host_capacity` ON storage_pool.id = op_host_capacity.host_id
|
||||
and op_host_capacity.capacity_type = 3
|
||||
left join
|
||||
`cloud`.`async_job` ON async_job.instance_id = storage_pool.id
|
||||
and async_job.instance_type = 'StoragePool'
|
||||
and async_job.job_status = 0;
|
||||
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`domain_router_view`;
|
||||
CREATE VIEW `cloud`.`domain_router_view` AS
|
||||
select
|
||||
vm_instance.id id,
|
||||
vm_instance.name name,
|
||||
account.id account_id,
|
||||
account.uuid account_uuid,
|
||||
account.account_name account_name,
|
||||
account.type account_type,
|
||||
domain.id domain_id,
|
||||
domain.uuid domain_uuid,
|
||||
domain.name domain_name,
|
||||
domain.path domain_path,
|
||||
projects.id project_id,
|
||||
projects.uuid project_uuid,
|
||||
projects.name project_name,
|
||||
vm_instance.uuid uuid,
|
||||
vm_instance.created created,
|
||||
vm_instance.state state,
|
||||
vm_instance.removed removed,
|
||||
vm_instance.pod_id pod_id,
|
||||
vm_instance.instance_name instance_name,
|
||||
host_pod_ref.uuid pod_uuid,
|
||||
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.dns1 dns1,
|
||||
data_center.dns2 dns2,
|
||||
data_center.ip6_dns1 ip6_dns1,
|
||||
data_center.ip6_dns2 ip6_dns2,
|
||||
host.id host_id,
|
||||
host.uuid host_uuid,
|
||||
host.name host_name,
|
||||
vm_template.id template_id,
|
||||
vm_template.uuid template_uuid,
|
||||
service_offering.id service_offering_id,
|
||||
disk_offering.uuid service_offering_uuid,
|
||||
disk_offering.name service_offering_name,
|
||||
nics.id nic_id,
|
||||
nics.uuid nic_uuid,
|
||||
nics.network_id network_id,
|
||||
nics.ip4_address ip_address,
|
||||
nics.ip6_address ip6_address,
|
||||
nics.ip6_gateway ip6_gateway,
|
||||
nics.ip6_cidr ip6_cidr,
|
||||
nics.default_nic is_default_nic,
|
||||
nics.gateway gateway,
|
||||
nics.netmask netmask,
|
||||
nics.mac_address mac_address,
|
||||
nics.broadcast_uri broadcast_uri,
|
||||
nics.isolation_uri isolation_uri,
|
||||
vpc.id vpc_id,
|
||||
vpc.uuid vpc_uuid,
|
||||
networks.uuid network_uuid,
|
||||
networks.name network_name,
|
||||
networks.network_domain network_domain,
|
||||
networks.traffic_type traffic_type,
|
||||
networks.guest_type guest_type,
|
||||
async_job.id job_id,
|
||||
async_job.uuid job_uuid,
|
||||
async_job.job_status job_status,
|
||||
async_job.account_id job_account_id,
|
||||
domain_router.template_version template_version,
|
||||
domain_router.scripts_version scripts_version,
|
||||
domain_router.is_redundant_router is_redundant_router,
|
||||
domain_router.redundant_state redundant_state,
|
||||
domain_router.stop_pending stop_pending
|
||||
from
|
||||
`cloud`.`domain_router`
|
||||
inner join
|
||||
`cloud`.`vm_instance` ON vm_instance.id = domain_router.id
|
||||
inner join
|
||||
`cloud`.`account` ON vm_instance.account_id = account.id
|
||||
inner join
|
||||
`cloud`.`domain` ON vm_instance.domain_id = domain.id
|
||||
left join
|
||||
`cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id
|
||||
left join
|
||||
`cloud`.`projects` ON projects.project_account_id = account.id
|
||||
left join
|
||||
`cloud`.`data_center` ON vm_instance.data_center_id = data_center.id
|
||||
left join
|
||||
`cloud`.`host` ON vm_instance.host_id = host.id
|
||||
left join
|
||||
`cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id
|
||||
left join
|
||||
`cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id
|
||||
left join
|
||||
`cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id
|
||||
left join
|
||||
`cloud`.`volumes` ON vm_instance.id = volumes.instance_id
|
||||
left join
|
||||
`cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id
|
||||
left join
|
||||
`cloud`.`nics` ON vm_instance.id = nics.instance_id
|
||||
left join
|
||||
`cloud`.`networks` ON nics.network_id = networks.id
|
||||
left join
|
||||
`cloud`.`vpc` ON domain_router.vpc_id = vpc.id
|
||||
left join
|
||||
`cloud`.`async_job` ON async_job.instance_id = vm_instance.id
|
||||
and async_job.instance_type = 'DomainRouter'
|
||||
and async_job.job_status = 0;
|
||||
|
||||
CREATE TABLE `cloud`.`external_cisco_vnmc_devices` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`uuid` varchar(255) UNIQUE,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user