You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ki...@apache.org on 2014/01/06 14:19:57 UTC

[2/2] git commit: updated refs/heads/master to 91181a3

CLOUDSTACK-5472 fixed the listvirtualmachines API to show cpu, memory and cpucores when using custom compute offering


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/91181a3b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/91181a3b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/91181a3b

Branch: refs/heads/master
Commit: 91181a3b216357f09d69a50409ff0a505513239b
Parents: 17023c0
Author: Bharat Kumar <bh...@citrix.com>
Authored: Thu Dec 26 14:28:31 2013 +0530
Committer: Kishan Kavala <ki...@cloud.com>
Committed: Mon Jan 6 18:43:40 2014 +0530

----------------------------------------------------------------------
 setup/db/db/schema-420to421.sql | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/91181a3b/setup/db/db/schema-420to421.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-420to421.sql b/setup/db/db/schema-420to421.sql
index fe1e0d4..42e9c1e 100644
--- a/setup/db/db/schema-420to421.sql
+++ b/setup/db/db/schema-420to421.sql
@@ -91,9 +91,18 @@ CREATE VIEW `cloud`.`user_vm_view` AS
         iso.display_text iso_display_text,
         service_offering.id service_offering_id,
         disk_offering.uuid service_offering_uuid,
-        service_offering.cpu cpu,
-        service_offering.speed speed,
-        service_offering.ram_size ram_size,
+        Case
+             When (`cloud`.`service_offering`.`cpu` is null) then (`custom_cpu`.`value`)
+             Else ( `cloud`.`service_offering`.`cpu`)
+        End as `cpu`,
+        Case
+            When (`cloud`.`service_offering`.`speed` is null) then (`custom_speed`.`value`)
+            Else ( `cloud`.`service_offering`.`speed`)
+        End as `speed`,
+        Case
+            When (`cloud`.`service_offering`.`ram_size` is null) then (`custom_ram_size`.`value`)
+            Else ( `cloud`.`service_offering`.`ram_size`)
+        END as `ram_size`,
         disk_offering.name service_offering_name,
         storage_pool.id pool_id,
         storage_pool.uuid pool_uuid,
@@ -215,7 +224,13 @@ CREATE VIEW `cloud`.`user_vm_view` AS
             left join
         `cloud`.`affinity_group` ON affinity_group_vm_map.affinity_group_id = affinity_group.id
             left join
-        `cloud`.`user_vm_details` as all_details ON all_details.vm_id = vm_instance.id;
+        `cloud`.`user_vm_details` as all_details ON all_details.vm_id = vm_instance.id
+            left join
+        `cloud`.`user_vm_details` `custom_cpu`  ON (((`custom_cpu`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_cpu`.`name` = 'CpuNumber')))
+            left join
+        `cloud`.`user_vm_details` `custom_speed`  ON (((`custom_speed`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_speed`.`name` = 'CpuSpeed')))
+           left join
+        `cloud`.`user_vm_details` `custom_ram_size`  ON (((`custom_ram_size`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_ram_size`.`name` = 'memory')));
 
 --Add the format for volumes table for uploaded volumes (CLOUDSTACK-5013)
 update  `cloud`.`volumes` v,  `cloud`.`volume_host_ref` vhr  set v.format=vhr.format where v.id=vhr.volume_id and v.format is null;
@@ -225,4 +240,4 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'manag
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'baremetal.ipmi.fail.retry', 'default', "ipmi interface will be temporary out of order after power opertions(e.g. cycle, on), it leads following commands fail immediately. The value specifies retry times before accounting it as real failure");
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'vmware.hung.wokervm.timeout', '7200', 'Worker VM timeout in seconds');
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Alert", 'DEFAULT', 'management-server', "alert.smtp.connectiontimeout", "30000", "Socket connection timeout value in milliseconds. -1 for infinite timeout.");
-INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Alert", 'DEFAULT', 'management-server', "alert.smtp.timeout", "30000", "Socket I/O timeout value in milliseconds. -1 for infinite timeout.");
\ No newline at end of file
+INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Alert", 'DEFAULT', 'management-server', "alert.smtp.timeout", "30000", "Socket I/O timeout value in milliseconds. -1 for infinite timeout.");