From 46994153a92059c6fbc69e79ffb654dd9c7afa0e Mon Sep 17 00:00:00 2001 From: abhishek Date: Fri, 25 Feb 2011 17:03:13 -0800 Subject: [PATCH] bug 8601: these are the 2 sql files for the cloud and cloud_usage db migration. I have tested some of the most common cases, as well as some uncommon cases (create a direct and virtual network in same zone). --- setup/db/221to222.sql | 25 +++++++++++++++++++++++++ setup/db/221to222_usage.sql | 3 +++ 2 files changed, 28 insertions(+) create mode 100644 setup/db/221to222.sql create mode 100644 setup/db/221to222_usage.sql diff --git a/setup/db/221to222.sql b/setup/db/221to222.sql new file mode 100644 index 00000000000..a2c67a73210 --- /dev/null +++ b/setup/db/221to222.sql @@ -0,0 +1,25 @@ +update firewall_rules set purpose='StaticNat' where is_static_nat=1; +alter table firewall_rules drop column is_static_nat; +alter table user_ip_address add CONSTRAINT `fk_user_ip_address__vm_id` FOREIGN KEY (`vm_id`) REFERENCES `vm_instance`(`id`); +update network_offerings set system_only=1 where name='System-Guest-Network'; +update network_offerings set dns_service=1,userdata_service=1,dhcp_service=1 where system_only=0; +update network_offerings set firewall_service=1, lb_service=1,vpn_service=1,gateway_service=1 where traffic_type='guest' and system_only=0; +alter table domain add column `state` char(32) NOT NULL default 'Active' COMMENT 'state of the domain'; +alter table nics add column `vm_type` char(32) NOT NULL; +update nics set vm_type=(select type from vm_instance where vm_instance.id=nics.instance_id); +delete from configuration where name='router.cleanup'; +INSERT INTO configuration (`category`, `instance`, `component`, `name`, `value`, `description`) VALUES ('Network','DEFAULT','none','network.guest.cidr.limit','22','size limit for guest cidr; cant be less than this value'); +alter table user_statistics add column `network_id` bigint unsigned; +update op_networks set nics_count=1 where id in (select d.network_id from domain_router d, vm_instance i where i.state='Running' and i.id=d.id); +update network_offerings set traffic_type='Guest' where system_only=0; +alter table network_offerings add column `guest_type` char(32) NOT NULL; +update network_offerings set guest_type='System-Guest-Network' where traffic_type='Direct'; +update network_offerings set guest_type='DefaultVirtualizedNetworkOffering' where traffic_type='Virtual'; +update network_offerings set guest_type='DefaultDirectNetworkOffering' where traffic_type='Direct'; +alter table op_it_work add column `vm_type` char(32) NOT NULL; +update op_it_work set vm_type=(select type from vm_instance where vm_instance.id=op_it_work.instance_id); +alter table networks add column `is_security_group_enabled` tinyint NOT NULL DEFAULT 0 COMMENT '1: enabled, 0: not'; +update networks set is_security_group_enabled=0; +alter table data_center add column `is_security_group_enabled` tinyint NOT NULL DEFAULT 0 COMMENT '1: enabled, 0: not'; +update data_center set is_security_group_enabled=0; + diff --git a/setup/db/221to222_usage.sql b/setup/db/221to222_usage.sql new file mode 100644 index 00000000000..cd4a13f86e5 --- /dev/null +++ b/setup/db/221to222_usage.sql @@ -0,0 +1,3 @@ +alter table cloud_usage add column `network_id` bigint unsigned; +alter table usage_network add column `network_id` bigint unsigned; +alter table user_statistics add column `network_id` bigint unsigned;