From 77ba5d0f8efe6aa0b7f04f038e26633523a24f00 Mon Sep 17 00:00:00 2001 From: frank Date: Mon, 5 Mar 2012 13:34:43 -0800 Subject: [PATCH] Bug 14068 - Db upgrade: resource_state is incorrect for the host in UP state after the db upgrade from 2.2.x to 3.0 Bug 14099 - Db upgrade for storage network status 14068: resovled fixed status 14099: resovled fixed --- .../com/cloud/upgrade/dao/Upgrade2214to30.java | 2 +- setup/db/db/schema-2214to30.sql | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) mode change 100644 => 100755 server/src/com/cloud/upgrade/dao/Upgrade2214to30.java diff --git a/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java b/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java old mode 100644 new mode 100755 index 8469a51c560..e509062be74 --- a/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java +++ b/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java @@ -845,7 +845,7 @@ public class Upgrade2214to30 implements DbUpgrade { throw new CloudRuntimeException("Unable to close statement for router table. ", e); } } - } + } protected void updateReduntantRouters(Connection conn) { PreparedStatement pstmt = null; diff --git a/setup/db/db/schema-2214to30.sql b/setup/db/db/schema-2214to30.sql index 4d84f67d795..55e20ed4265 100755 --- a/setup/db/db/schema-2214to30.sql +++ b/setup/db/db/schema-2214to30.sql @@ -314,12 +314,24 @@ ALTER TABLE `cloud`.`security_group_rule` ADD CONSTRAINT `fk_security_group_rule ALTER TABLE `cloud`.`security_group_rule` ADD INDEX `i_security_group_rule_network_id`(`security_group_id`); ALTER TABLE `cloud`.`security_group_rule` ADD INDEX `i_security_group_rule_allowed_network`(`allowed_network_id`); ALTER TABLE `cloud`.`vm_template` ADD COLUMN `enable_sshkey` int(1) unsigned NOT NULL default 0 COMMENT 'true if this template supports sshkey reset'; -ALTER TABLE `cloud`.`host` ADD COLUMN `resource_state` varchar(32) NOT NULL DEFAULT 'Disabled' COMMENT 'Is this host enabled for allocation for new resources'; ALTER TABLE `cloud`.`vm_template` ADD COLUMN `sort_key` int(32) NOT NULL default 0 COMMENT 'sort key used for customising sort method'; ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `sort_key` int(32) NOT NULL default 0 COMMENT 'sort key used for customising sort method'; ALTER TABLE `cloud`.`service_offering` ADD COLUMN `sort_key` int(32) NOT NULL default 0 COMMENT 'sort key used for customising sort method'; +---; +--- Resource State; +---; +ALTER TABLE `cloud`.`host` ADD COLUMN `resource_state` varchar(32) NOT NULL DEFAULT 'Disabled' COMMENT 'Is this host enabled for allocation for new resources'; +UPDATE TABLE `cloud`.`host` SET resource_state='Enabled' WHERE status in ('Connecting', 'Up', 'Down', 'Disconnected', 'Alert', 'Removed', 'Rebalancing'); +UPDATE TABLE `cloud`.`host` SET resource_state='PrepareForMaintenance', status='Disconnected' WHERE status = 'PrepareForMaintenance'; +UPDATE TABLE `cloud`.`host` SET resource_state='ErrorInMaintenance', status='Disconnected' WHERE status = 'ErrorInMaintenance'; +UPDATE TABLE `cloud`.`host` SET resource_state='Maintenance', status='Disconnected' WHERE status = 'Maintenance'; + +---; +--- Storage network +---; +update `cloud`.`networks` set guru_name='StorageNetworkGuru' where traffic_type='Storage'; --; --NAAS; @@ -595,7 +607,6 @@ CREATE TABLE `cloud`.`op_dc_storage_network_ip_address` ( CONSTRAINT `fk_storage_ip_address__range_id` FOREIGN KEY (`range_id`) REFERENCES `dc_storage_network_ip_range`(`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -update `cloud`.`networks` set guru_name='StorageNetworkGuru' where traffic_type='Storage'; ALTER TABLE `cloud`.`event` ADD COLUMN `domain_id` bigint unsigned NOT NULL; ALTER TABLE `cloud`.`op_host_capacity` ADD COLUMN `capacity_state` varchar(32) NOT NULL DEFAULT 'Enabled';