Repository: cloudstack Updated Branches: refs/heads/master 6c8a0a1f9 -> 7ae784ba3
CLOUDSTACK-6633: listVolumes should return template/iso info for root volumes Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7ae784ba Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7ae784ba Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7ae784ba Branch: refs/heads/master Commit: 7ae784ba3ca648006e52dd5db2c77a006dae3000 Parents: 6c8a0a1 Author: Nitin Mehta <nitin.me...@citrix.com> Authored: Sun May 11 20:32:04 2014 -0700 Committer: Nitin Mehta <nitin.me...@citrix.com> Committed: Sun May 11 20:36:53 2014 -0700 ---------------------------------------------------------------------- .../cloudstack/api/response/VolumeResponse.java | 70 ++++++++++++++++++++ .../cloud/api/query/dao/VolumeJoinDaoImpl.java | 8 +++ .../com/cloud/api/query/vo/VolumeJoinVO.java | 42 ++++++++++++ setup/db/db/schema-430to440.sql | 16 +++-- 4 files changed, 132 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ae784ba/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 e79c4c3..eeb4af9 100644 --- a/api/src/org/apache/cloudstack/api/response/VolumeResponse.java +++ b/api/src/org/apache/cloudstack/api/response/VolumeResponse.java @@ -60,6 +60,30 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity @Param(description = "id of the virtual machine") private String virtualMachineId; + @SerializedName("isoid") + @Param(description = "the ID of the ISO attached to the virtual machine") + private String isoId; + + @SerializedName("isoname") + @Param(description = "the name of the ISO attached to the virtual machine") + private String isoName; + + @SerializedName("isodisplaytext") + @Param(description = "an alternate display text of the ISO attached to the virtual machine") + private String isoDisplayText; + + @SerializedName(ApiConstants.TEMPLATE_ID) + @Param(description = "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.") + private String templateId; + + @SerializedName("templatename") + @Param(description = "the name of the template for the virtual machine") + private String templateName; + + @SerializedName("templatedisplaytext") + @Param(description = " an alternate display text of the template for the virtual machine") + private String templateDisplayText; + @SerializedName("vmname") @Param(description = "name of the virtual machine") private String virtualMachineName; @@ -451,5 +475,51 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity return this.needQuiescevm; } + public String getIsoId() { + return isoId; + } + + public void setIsoId(String isoId) { + this.isoId = isoId; + } + + public String getIsoName() { + return isoName; + } + + public void setIsoName(String isoName) { + this.isoName = isoName; + } + + public String getIsoDisplayText() { + return isoDisplayText; + } + + public void setIsoDisplayText(String isoDisplayText) { + this.isoDisplayText = isoDisplayText; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + public String getTemplateDisplayText() { + return templateDisplayText; + } + + public void setTemplateDisplayText(String templateDisplayText) { + this.templateDisplayText = templateDisplayText; + } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ae784ba/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 04e99cf..7e9fd39 100644 --- a/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java @@ -217,6 +217,14 @@ public class VolumeJoinDaoImpl extends GenericDaoBase<VolumeJoinVO, Long> implem volResponse.setDisplayVolume(volume.isDisplayVolume()); volResponse.setChainInfo(volume.getChainInfo()); + volResponse.setTemplateId(volume.getTemplateUuid()); + volResponse.setTemplateName(volume.getTemplateName()); + volResponse.setTemplateDisplayText(volume.getTemplateDisplayText()); + + volResponse.setIsoId(volume.getIsoUuid()); + volResponse.setIsoName(volume.getIsoName()); + volResponse.setIsoDisplayText(volume.getIsoDisplayText()); + // set async job if (volume.getJobId() != null) { volResponse.setJobId(volume.getJobUuid()); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ae784ba/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 cbc9efe..62384c1 100644 --- a/server/src/com/cloud/api/query/vo/VolumeJoinVO.java +++ b/server/src/com/cloud/api/query/vo/VolumeJoinVO.java @@ -216,12 +216,30 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { @Column(name = "template_uuid") private String templateUuid; + @Column(name = "template_name") + private String templateName; + + @Column(name = "template_display_text", length = 4096) + private String templateDisplayText; + @Column(name = "extractable") private boolean extractable; @Column(name = "template_type") private Storage.TemplateType templateType; + @Column(name = "iso_id", updatable = true, nullable = true, length = 17) + private long isoId; + + @Column(name = "iso_uuid") + private String isoUuid; + + @Column(name = "iso_name") + private String isoName; + + @Column(name = "iso_display_text", length = 4096) + private String isoDisplayText; + @Column(name = "job_id") private Long jobId; @@ -502,6 +520,30 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { return templateType; } + public String getTemplateName() { + return templateName; + } + + public String getTemplateDisplayText() { + return templateDisplayText; + } + + public long getIsoId() { + return isoId; + } + + public String getIsoUuid() { + return isoUuid; + } + + public String getIsoName() { + return isoName; + } + + public String getIsoDisplayText() { + return isoDisplayText; + } + public Long getJobId() { return jobId; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ae784ba/setup/db/db/schema-430to440.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql index e53c970..3b525c4 100644 --- a/setup/db/db/schema-430to440.sql +++ b/setup/db/db/schema-430to440.sql @@ -128,9 +128,9 @@ CREATE VIEW `cloud`.`volume_view` AS volumes.attached, volumes.removed, volumes.pod_id, - volumes.display_volume, + volumes.display_volume, volumes.format, - volumes.path, + volumes.path, volumes.chain_info, account.id account_id, account.uuid account_uuid, @@ -146,7 +146,7 @@ CREATE VIEW `cloud`.`volume_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.networktype data_center_type, vm_instance.id vm_id, vm_instance.uuid vm_uuid, vm_instance.name vm_name, @@ -177,6 +177,12 @@ CREATE VIEW `cloud`.`volume_view` AS vm_template.uuid template_uuid, vm_template.extractable, vm_template.type template_type, + vm_template.name template_name, + vm_template.display_text template_display_text, + iso.id iso_id, + iso.uuid iso_uuid, + iso.name iso_name, + iso.display_text iso_display_text, resource_tags.id tag_id, resource_tags.uuid tag_uuid, resource_tags.key tag_key, @@ -214,7 +220,9 @@ CREATE VIEW `cloud`.`volume_view` AS 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 + `cloud`.`vm_template` ON volumes.template_id = vm_template.id + left join + `cloud`.`vm_template` iso ON iso.id = volumes.iso_id left join `cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id and resource_tags.resource_type = 'Volume'