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

This commit is contained in:
Jessica Wang 2013-04-23 11:23:49 -07:00
parent ba4b8f1705
commit 35e2072660
4 changed files with 127 additions and 1 deletions

View File

@ -47,6 +47,10 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
@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.TYPE)
@Param(description = "type of the disk volume (ROOT or DATADISK)")
@ -198,6 +202,10 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
this.zoneName = zoneName;
}
public void setZoneType(String zoneType) {
this.zoneType = zoneType;
}
public void setVolumeType(String volumeType) {
this.volumeType = volumeType;
}

View File

@ -86,7 +86,8 @@ public class VolumeJoinDaoImpl extends GenericDaoBase<VolumeJoinVO, Long> implem
volResponse.setZoneId(volume.getDataCenterUuid());
volResponse.setZoneName(volume.getDataCenterName());
volResponse.setZoneType(volume.getDataCenterType());
volResponse.setVolumeType(volume.getVolumeType().toString());
volResponse.setDeviceId(volume.getDeviceId());

View File

@ -117,6 +117,9 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity {
@Column(name="data_center_name")
private String dataCenterName;
@Column(name="data_center_type")
private String dataCenterType;
@Column(name="vm_id")
private long vmId;
@ -1004,8 +1007,20 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity {
this.dataCenterName = dataCenterName;
}
public String getDataCenterType() {
return dataCenterType;
}
public void setDataCenterType(String dataCenterType) {
this.dataCenterType = dataCenterType;
}
public long getPodId() {
return podId;
}

View File

@ -544,6 +544,108 @@ CREATE VIEW `cloud`.`affinity_group_view` AS
left join
`cloud`.`user_vm` ON user_vm.id = vm_instance.id;
DROP VIEW IF EXISTS `cloud`.`volume_view`;
CREATE VIEW `cloud`.`volume_view` AS
select
volumes.id,
volumes.uuid,
volumes.name,
volumes.device_id,
volumes.volume_type,
volumes.size,
volumes.created,
volumes.state,
volumes.attached,
volumes.removed,
volumes.pod_id,
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,
data_center.id data_center_id,
data_center.uuid data_center_uuid,
data_center.name data_center_name,
data_center.networktype data_center_type,
vm_instance.id vm_id,
vm_instance.uuid vm_uuid,
vm_instance.name vm_name,
vm_instance.state vm_state,
vm_instance.vm_type,
user_vm.display_name vm_display_name,
volume_host_ref.size volume_host_size,
volume_host_ref.created volume_host_created,
volume_host_ref.format,
volume_host_ref.download_pct,
volume_host_ref.download_state,
volume_host_ref.error_str,
disk_offering.id disk_offering_id,
disk_offering.uuid disk_offering_uuid,
disk_offering.name disk_offering_name,
disk_offering.display_text disk_offering_display_text,
disk_offering.use_local_storage,
disk_offering.system_use,
storage_pool.id pool_id,
storage_pool.uuid pool_uuid,
storage_pool.name pool_name,
cluster.hypervisor_type,
vm_template.id template_id,
vm_template.uuid template_uuid,
vm_template.extractable,
vm_template.type template_type,
resource_tags.id tag_id,
resource_tags.uuid tag_uuid,
resource_tags.key tag_key,
resource_tags.value tag_value,
resource_tags.domain_id tag_domain_id,
resource_tags.account_id tag_account_id,
resource_tags.resource_id tag_resource_id,
resource_tags.resource_uuid tag_resource_uuid,
resource_tags.resource_type tag_resource_type,
resource_tags.customer tag_customer,
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`.`volumes`
inner join
`cloud`.`account` ON volumes.account_id = account.id
inner join
`cloud`.`domain` ON volumes.domain_id = domain.id
left join
`cloud`.`projects` ON projects.project_account_id = account.id
left join
`cloud`.`data_center` ON volumes.data_center_id = data_center.id
left join
`cloud`.`vm_instance` ON volumes.instance_id = vm_instance.id
left join
`cloud`.`user_vm` ON user_vm.id = vm_instance.id
left join
`cloud`.`volume_host_ref` ON volumes.id = volume_host_ref.volume_id
and volumes.data_center_id = volume_host_ref.zone_id
left join
`cloud`.`disk_offering` ON volumes.disk_offering_id = disk_offering.id
left join
`cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id
left join
`cloud`.`cluster` ON storage_pool.cluster_id = cluster.id
left join
`cloud`.`vm_template` ON volumes.template_id = vm_template.id
left join
`cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id
and resource_tags.resource_type = 'Volume'
left join
`cloud`.`async_job` ON async_job.instance_id = volumes.id
and async_job.instance_type = 'Volume'
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,