From e8720cc1f75080ea347ebac73295910dcf0be912 Mon Sep 17 00:00:00 2001 From: Alex Huang Date: Mon, 4 Apr 2011 13:52:38 -0700 Subject: [PATCH] bug 9300: changed the network id to management from storage for ssvm --- server/src/com/cloud/upgrade/dao/Upgrade218to22.java | 4 ++-- setup/db/create-schema.sql | 3 ++- setup/db/db/schema-21to22.sql | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/com/cloud/upgrade/dao/Upgrade218to22.java b/server/src/com/cloud/upgrade/dao/Upgrade218to22.java index e9017ba50d7..9f2c18ae5e9 100644 --- a/server/src/com/cloud/upgrade/dao/Upgrade218to22.java +++ b/server/src/com/cloud/upgrade/dao/Upgrade218to22.java @@ -773,7 +773,7 @@ public class Upgrade218to22 implements DbUpgrade { upgradeDomR(conn, (Long)router[0], null, basicDefaultDirectNetworkId, controlNetworkId, "Basic"); } - upgradeSsvm(conn, dcId, basicDefaultDirectNetworkId, storageNetworkId, controlNetworkId, "Basic"); + upgradeSsvm(conn, dcId, basicDefaultDirectNetworkId, mgmtNetworkId, controlNetworkId, "Basic"); pstmt = conn.prepareStatement("SELECT vm_instance.id FROM vm_instance WHERE removed IS NULL AND type='ConsoleProxy' AND data_center_id=?"); pstmt.setLong(1, dcId); @@ -880,7 +880,7 @@ public class Upgrade218to22 implements DbUpgrade { upgradeDirectUserIpAddress(conn, dcId, vlanNetworkMap.get(tag), "DirectAttached"); } - upgradeSsvm(conn, dcId, publicNetworkId, storageNetworkId, controlNetworkId, "Advanced"); + upgradeSsvm(conn, dcId, publicNetworkId, mgmtNetworkId, controlNetworkId, "Advanced"); pstmt = conn.prepareStatement("SELECT vm_instance.id FROM vm_instance WHERE removed IS NULL AND type='ConsoleProxy' AND data_center_id=?"); pstmt.setLong(1, dcId); diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql index 73869d5fba1..8b8a3cf9dd7 100755 --- a/setup/db/create-schema.sql +++ b/setup/db/create-schema.sql @@ -492,6 +492,7 @@ CREATE TABLE `cloud`.`data_center` ( `allocation_state` varchar(32) NOT NULL DEFAULT 'Enabled' COMMENT 'Is this data center enabled for allocation for new resources', PRIMARY KEY (`id`), CONSTRAINT `fk_data_center__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain`(`id`), + INDEX `i_data_center__domain_id`(`domain_id`), INDEX `i_data_center__allocation_state`(`allocation_state`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -960,7 +961,7 @@ CREATE TABLE `cloud`.`domain` ( `parent` bigint unsigned, `name` varchar(255), `owner` bigint unsigned NOT NULL, - `path` varchar(255), + `path` varchar(255) UNIQUE NOT NULL, `level` int(10) NOT NULL DEFAULT 0, `child_count` int(10) NOT NULL DEFAULT 0, `next_child_seq` bigint unsigned NOT NULL DEFAULT 1, diff --git a/setup/db/db/schema-21to22.sql b/setup/db/db/schema-21to22.sql index e8e2e4c6b45..93d7bef2c46 100755 --- a/setup/db/db/schema-21to22.sql +++ b/setup/db/db/schema-21to22.sql @@ -949,3 +949,4 @@ ALTER TABLE `cloud`.`instance_group` ADD CONSTRAINT `fk_instance_group__account_ ALTER TABLE `cloud`.`instance_group_vm_map` ADD CONSTRAINT `fk_instance_group_vm_map___group_id` FOREIGN KEY `fk_instance_group_vm_map___group_id` (`group_id`) REFERENCES `instance_group` (`id`) ON DELETE CASCADE; ALTER TABLE `cloud`.`instance_group_vm_map` ADD CONSTRAINT `fk_instance_group_vm_map___instance_id` FOREIGN KEY `fk_instance_group_vm_map___instance_id` (`instance_id`) REFERENCES `user_vm` (`id`) ON DELETE CASCADE; +ALTER TABLE `cloud`.`domain` MODIFY COLUMN `path` varchar(255) UNIQUE NOT NULL;