You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/05/12 09:44:26 UTC

git commit: updated refs/heads/4.4 to 5ead629

Repository: cloudstack
Updated Branches:
  refs/heads/4.4 2fa15a044 -> 5ead629ce


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/5ead629c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5ead629c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5ead629c

Branch: refs/heads/4.4
Commit: 5ead629ce721a5d3291944da13ebc079f6074f91
Parents: 2fa15a0
Author: Nitin Mehta <ni...@citrix.com>
Authored: Sun May 11 20:32:04 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon May 12 09:44:12 2014 +0200

----------------------------------------------------------------------
 .../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/5ead629c/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 45c15da..c3e214f 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;
@@ -443,5 +467,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/5ead629c/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 8a0431b..9e1ee37 100644
--- a/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java
@@ -215,6 +215,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/5ead629c/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 8165d68..cb6dc4d 100644
--- a/server/src/com/cloud/api/query/vo/VolumeJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/VolumeJoinVO.java
@@ -212,12 +212,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;
 
@@ -494,6 +512,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/5ead629c/setup/db/db/schema-430to440.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql
index 8cb8221..89db04a 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'