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
This commit is contained in:
frank 2012-03-05 13:34:43 -08:00
parent 1955997fee
commit 77ba5d0f8e
2 changed files with 14 additions and 3 deletions

2
server/src/com/cloud/upgrade/dao/Upgrade2214to30.java Normal file → Executable file
View File

@ -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;

View File

@ -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';