This is an automated email from the ASF dual-hosted git repository.
bhaisaab pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/master by this push:
new bef5c17 CLOUDSTACK-9982: Introduce new response parameter:
PhysicalSize in listTemplates API response
bef5c17 is described below
commit bef5c17baa0d708fae3b99ff79d9c3fec80cde39
Author: Harika Punna <[email protected]>
AuthorDate: Tue Jul 4 12:23:05 2017 +0530
CLOUDSTACK-9982: Introduce new response parameter: PhysicalSize in
listTemplates API response
---
.../cloudstack/api/response/TemplateResponse.java | 8 ++
.../cloud/api/query/dao/TemplateJoinDaoImpl.java | 5 +
.../src/com/cloud/api/query/vo/TemplateJoinVO.java | 7 ++
setup/db/db/schema-41000to41100.sql | 103 +++++++++++++++++++++
4 files changed, 123 insertions(+)
diff --git a/api/src/org/apache/cloudstack/api/response/TemplateResponse.java
b/api/src/org/apache/cloudstack/api/response/TemplateResponse.java
index c576493..7cbcd1d 100644
--- a/api/src/org/apache/cloudstack/api/response/TemplateResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/TemplateResponse.java
@@ -117,6 +117,10 @@ public class TemplateResponse extends
BaseResponseWithTagInformation implements
@Param(description = "the size of the template")
private Long size;
+ @SerializedName(ApiConstants.PHYSICAL_SIZE)
+ @Param(description = "the physical size of the template")
+ private Long physicalSize;
+
@SerializedName("templatetype")
@Param(description = "the type of the template")
private String templateType;
@@ -275,6 +279,10 @@ public class TemplateResponse extends
BaseResponseWithTagInformation implements
this.size = size;
}
+ public void setPhysicalSize(Long physicalSize) {
+ this.physicalSize = physicalSize;
+ }
+
public void setTemplateType(String templateType) {
this.templateType = templateType;
}
diff --git a/server/src/com/cloud/api/query/dao/TemplateJoinDaoImpl.java
b/server/src/com/cloud/api/query/dao/TemplateJoinDaoImpl.java
index 92a2e20..53f0429 100644
--- a/server/src/com/cloud/api/query/dao/TemplateJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/TemplateJoinDaoImpl.java
@@ -171,6 +171,11 @@ public class TemplateJoinDaoImpl extends
GenericDaoBaseWithTagInformation<Templa
templateResponse.setSize(templateSize);
}
+ Long templatePhysicalSize = template.getPhysicalSize();
+ if (templatePhysicalSize > 0) {
+ templateResponse.setPhysicalSize(templatePhysicalSize);
+ }
+
templateResponse.setChecksum(template.getChecksum());
if (template.getSourceTemplateId() != null) {
templateResponse.setSourceTemplateId(template.getSourceTemplateUuid());
diff --git a/server/src/com/cloud/api/query/vo/TemplateJoinVO.java
b/server/src/com/cloud/api/query/vo/TemplateJoinVO.java
index 43a9c3b..15a748b 100644
--- a/server/src/com/cloud/api/query/vo/TemplateJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/TemplateJoinVO.java
@@ -196,6 +196,9 @@ public class TemplateJoinVO extends
BaseViewWithTagInformationVO implements Cont
@Column(name = "size")
private long size;
+ @Column(name = "physical_size")
+ private long physicalSize;
+
@Column(name = "template_state")
@Enumerated(EnumType.STRING)
private State templateState;
@@ -409,6 +412,10 @@ public class TemplateJoinVO extends
BaseViewWithTagInformationVO implements Cont
return size;
}
+ public long getPhysicalSize() {
+ return physicalSize;
+ }
+
public boolean isDestroyed() {
return destroyed;
}
diff --git a/setup/db/db/schema-41000to41100.sql
b/setup/db/db/schema-41000to41100.sql
index ef689da..d38e1ae 100644
--- a/setup/db/db/schema-41000to41100.sql
+++ b/setup/db/db/schema-41000to41100.sql
@@ -18,3 +18,106 @@
--;
-- Schema upgrade from 4.10.0.0 to 4.11.0.0
--;
+
+--Alter view template_view
+
+DROP VIEW IF EXISTS `cloud`.`template_view`;
+CREATE VIEW `template_view` AS
+ SELECT
+ `vm_template`.`id` AS `id`,
+ `vm_template`.`uuid` AS `uuid`,
+ `vm_template`.`unique_name` AS `unique_name`,
+ `vm_template`.`name` AS `name`,
+ `vm_template`.`public` AS `public`,
+ `vm_template`.`featured` AS `featured`,
+ `vm_template`.`type` AS `type`,
+ `vm_template`.`hvm` AS `hvm`,
+ `vm_template`.`bits` AS `bits`,
+ `vm_template`.`url` AS `url`,
+ `vm_template`.`format` AS `format`,
+ `vm_template`.`created` AS `created`,
+ `vm_template`.`checksum` AS `checksum`,
+ `vm_template`.`display_text` AS `display_text`,
+ `vm_template`.`enable_password` AS `enable_password`,
+ `vm_template`.`dynamically_scalable` AS `dynamically_scalable`,
+ `vm_template`.`state` AS `template_state`,
+ `vm_template`.`guest_os_id` AS `guest_os_id`,
+ `guest_os`.`uuid` AS `guest_os_uuid`,
+ `guest_os`.`display_name` AS `guest_os_name`,
+ `vm_template`.`bootable` AS `bootable`,
+ `vm_template`.`prepopulate` AS `prepopulate`,
+ `vm_template`.`cross_zones` AS `cross_zones`,
+ `vm_template`.`hypervisor_type` AS `hypervisor_type`,
+ `vm_template`.`extractable` AS `extractable`,
+ `vm_template`.`template_tag` AS `template_tag`,
+ `vm_template`.`sort_key` AS `sort_key`,
+ `vm_template`.`removed` AS `removed`,
+ `vm_template`.`enable_sshkey` AS `enable_sshkey`,
+ `source_template`.`id` AS `source_template_id`,
+ `source_template`.`uuid` AS `source_template_uuid`,
+ `account`.`id` AS `account_id`,
+ `account`.`uuid` AS `account_uuid`,
+ `account`.`account_name` AS `account_name`,
+ `account`.`type` AS `account_type`,
+ `domain`.`id` AS `domain_id`,
+ `domain`.`uuid` AS `domain_uuid`,
+ `domain`.`name` AS `domain_name`,
+ `domain`.`path` AS `domain_path`,
+ `projects`.`id` AS `project_id`,
+ `projects`.`uuid` AS `project_uuid`,
+ `projects`.`name` AS `project_name`,
+ `data_center`.`id` AS `data_center_id`,
+ `data_center`.`uuid` AS `data_center_uuid`,
+ `data_center`.`name` AS `data_center_name`,
+ `launch_permission`.`account_id` AS `lp_account_id`,
+ `template_store_ref`.`store_id` AS `store_id`,
+ `image_store`.`scope` AS `store_scope`,
+ `template_store_ref`.`state` AS `state`,
+ `template_store_ref`.`download_state` AS `download_state`,
+ `template_store_ref`.`download_pct` AS `download_pct`,
+ `template_store_ref`.`error_str` AS `error_str`,
+ `template_store_ref`.`size` AS `size`,
+ `template_store_ref`.physical_size AS `physical_size`,
+ `template_store_ref`.`destroyed` AS `destroyed`,
+ `template_store_ref`.`created` AS `created_on_store`,
+ `vm_template_details`.`name` AS `detail_name`,
+ `vm_template_details`.`value` AS `detail_value`,
+ `resource_tags`.`id` AS `tag_id`,
+ `resource_tags`.`uuid` AS `tag_uuid`,
+ `resource_tags`.`key` AS `tag_key`,
+ `resource_tags`.`value` AS `tag_value`,
+ `resource_tags`.`domain_id` AS `tag_domain_id`,
+ `domain`.`uuid` AS `tag_domain_uuid`,
+ `domain`.`name` AS `tag_domain_name`,
+ `resource_tags`.`account_id` AS `tag_account_id`,
+ `account`.`account_name` AS `tag_account_name`,
+ `resource_tags`.`resource_id` AS `tag_resource_id`,
+ `resource_tags`.`resource_uuid` AS `tag_resource_uuid`,
+ `resource_tags`.`resource_type` AS `tag_resource_type`,
+ `resource_tags`.`customer` AS `tag_customer`,
+ CONCAT(`vm_template`.`id`,
+ '_',
+ IFNULL(`data_center`.`id`, 0)) AS `temp_zone_pair`
+ FROM
+ ((((((((((((`vm_template`
+ JOIN `guest_os` ON ((`guest_os`.`id` = `vm_template`.`guest_os_id`)))
+ JOIN `account` ON ((`account`.`id` = `vm_template`.`account_id`)))
+ JOIN `domain` ON ((`domain`.`id` = `account`.`domain_id`)))
+ LEFT JOIN `projects` ON ((`projects`.`project_account_id` =
`account`.`id`)))
+ LEFT JOIN `vm_template_details` ON
((`vm_template_details`.`template_id` = `vm_template`.`id`)))
+ LEFT JOIN `vm_template` `source_template` ON ((`source_template`.`id`
= `vm_template`.`source_template_id`)))
+ LEFT JOIN `template_store_ref` ON
(((`template_store_ref`.`template_id` = `vm_template`.`id`)
+ AND (`template_store_ref`.`store_role` = 'Image')
+ AND (`template_store_ref`.`destroyed` = 0))))
+ LEFT JOIN `image_store` ON ((ISNULL(`image_store`.`removed`)
+ AND (`template_store_ref`.`store_id` IS NOT NULL)
+ AND (`image_store`.`id` = `template_store_ref`.`store_id`))))
+ LEFT JOIN `template_zone_ref` ON (((`template_zone_ref`.`template_id`
= `vm_template`.`id`)
+ AND ISNULL(`template_store_ref`.`store_id`)
+ AND ISNULL(`template_zone_ref`.`removed`))))
+ LEFT JOIN `data_center` ON (((`image_store`.`data_center_id` =
`data_center`.`id`)
+ OR (`template_zone_ref`.`zone_id` = `data_center`.`id`))))
+ LEFT JOIN `launch_permission` ON ((`launch_permission`.`template_id`
= `vm_template`.`id`)))
+ LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` =
`vm_template`.`id`)
+ AND ((`resource_tags`.`resource_type` = 'Template')
+ OR (`resource_tags`.`resource_type` = 'ISO')))));
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].