CLOUDSTACK-4803: Return "path" parameter as a result of all Volume calls. But to the admin only Signed off by : nitin mehta<[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/73f68438 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/73f68438 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/73f68438 Branch: refs/heads/ui-restyle Commit: 73f68438400699da9e1821a7012cc9516f8d7572 Parents: 2229e3e Author: Nitin Mehta <[email protected]> Authored: Thu Oct 3 18:00:42 2013 -0700 Committer: Nitin Mehta <[email protected]> Committed: Thu Oct 3 18:00:42 2013 -0700 ---------------------------------------------------------------------- .../cloudstack/api/response/VolumeResponse.java | 18 ++- .../cloud/api/query/dao/VolumeJoinDaoImpl.java | 4 + .../com/cloud/api/query/vo/VolumeJoinVO.java | 11 +- setup/db/db/schema-420to430.sql | 111 ++++++++++++++++++- 4 files changed, 140 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/73f68438/api/src/org/apache/cloudstack/api/response/VolumeResponse.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/response/VolumeResponse.java b/api/src/org/apache/cloudstack/api/response/VolumeResponse.java index 338fcaa..d2ca37a 100644 --- a/api/src/org/apache/cloudstack/api/response/VolumeResponse.java +++ b/api/src/org/apache/cloudstack/api/response/VolumeResponse.java @@ -178,12 +178,26 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity @Param(description="the status of the volume") private String status; - @SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with volume", responseObject = ResourceTagResponse.class) + @SerializedName(ApiConstants.TAGS) + @Param(description="the list of resource tags associated with volume", responseObject = ResourceTagResponse.class) private Set<ResourceTagResponse> tags; - @SerializedName(ApiConstants.DISPLAY_VOLUME) @Param(description="an optional field whether to the display the volume to the end user or not.") + @SerializedName(ApiConstants.DISPLAY_VOLUME) + @Param(description="an optional field whether to the display the volume to the end user or not.") private Boolean displayVm; + @SerializedName(ApiConstants.PATH) + @Param(description="The path of the volume") + private String path; + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + public VolumeResponse(){ tags = new LinkedHashSet<ResourceTagResponse>(); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/73f68438/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java index df6e583..b76ff34 100644 --- a/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java @@ -142,6 +142,10 @@ public class VolumeJoinDaoImpl extends GenericDaoBase<VolumeJoinVO, Long> implem } } + if (caller.getType() == Account.ACCOUNT_TYPE_ADMIN){ + volResponse.setPath(volume.getPath()); + } + // populate owner. ApiResponseHelper.populateOwner(volResponse, volume); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/73f68438/server/src/com/cloud/api/query/vo/VolumeJoinVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/vo/VolumeJoinVO.java b/server/src/com/cloud/api/query/vo/VolumeJoinVO.java index c7b43ba..9fe9fd1 100644 --- a/server/src/com/cloud/api/query/vo/VolumeJoinVO.java +++ b/server/src/com/cloud/api/query/vo/VolumeJoinVO.java @@ -260,10 +260,12 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { @Column(name="tag_customer") private String tagCustomer; - @Column(name="display_volume", updatable=true, nullable=false) protected boolean displayVolume; + @Column(name="path") + protected String path; + public VolumeJoinVO() { } @@ -1091,6 +1093,13 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { } + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/73f68438/setup/db/db/schema-420to430.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-420to430.sql b/setup/db/db/schema-420to430.sql index 44a884d..6d8cfe2 100644 --- a/setup/db/db/schema-420to430.sql +++ b/setup/db/db/schema-420to430.sql @@ -280,4 +280,113 @@ CREATE VIEW `cloud`.`template_view` AS `cloud`.`resource_tags` ON resource_tags.resource_id = vm_template.id and (resource_tags.resource_type = 'Template' or resource_tags.resource_type='ISO') where - vm_template.state='Active'; + vm_template.state='Active'; +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.min_iops, + volumes.max_iops, + volumes.created, + volumes.state, + volumes.attached, + volumes.removed, + volumes.pod_id, + volumes.display_volume, + volumes.format, + volumes.path, + 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_store_ref.size volume_store_size, + volume_store_ref.download_pct, + volume_store_ref.download_state, + volume_store_ref.error_str, + volume_store_ref.created created_on_store, + 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, + disk_offering.bytes_read_rate, + disk_offering.bytes_write_rate, + disk_offering.iops_read_rate, + disk_offering.iops_write_rate, + 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_store_ref` ON volumes.id = volume_store_ref.volume_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 OR volumes.iso_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; +
