Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4F503C83C for ; Fri, 28 Nov 2014 18:03:16 +0000 (UTC) Received: (qmail 75900 invoked by uid 500); 28 Nov 2014 18:03:15 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 75578 invoked by uid 500); 28 Nov 2014 18:03:15 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 75526 invoked by uid 99); 28 Nov 2014 18:03:15 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Nov 2014 18:03:15 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 4F48A8B645E; Fri, 28 Nov 2014 18:03:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bhaisaab@apache.org To: commits@cloudstack.apache.org Date: Fri, 28 Nov 2014 18:03:17 -0000 Message-Id: In-Reply-To: <22ac5e6bd91443c8904a13b31d7cd40d@git.apache.org> References: <22ac5e6bd91443c8904a13b31d7cd40d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [03/51] [abbrv] git commit: updated refs/heads/useraccount-refactoring to 1e25886 4.4.2 upgrade schema remove 441to450 ddl (cherry picked from commit 5578616143f2eb1aded26b86101c73858a67fa35) (cherry picked from commit f18d6238b0219061e5ad81dc8852de6290da9e55) Conflicts: engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java schema: Add upgrade paths from 4.3.2 to 4.4.0 Signed-off-by: Rohit Yadav (cherry picked from commit 73c62837b5f9e0c4acb1f513c32f3c9579316e00) Conflicts: engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java engine/schema/src/com/cloud/upgrade/dao/Upgrade441to450.java setup/db/db/schema-441to450.sql merged new work from schema-441to450.sql into schema-442to450.sql Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3cb78fc7 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3cb78fc7 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3cb78fc7 Branch: refs/heads/useraccount-refactoring Commit: 3cb78fc74221e521c205b21590e6d8a4a24e6b91 Parents: d475b62 Author: Daan Hoogland Authored: Thu Nov 13 20:01:35 2014 +0100 Committer: Daan Hoogland Committed: Mon Nov 24 16:25:44 2014 +0100 ---------------------------------------------------------------------- .../cloud/upgrade/DatabaseUpgradeChecker.java | 138 ++-- .../com/cloud/upgrade/dao/Upgrade441to442.java | 64 ++ .../com/cloud/upgrade/dao/Upgrade441to450.java | 239 ------ .../com/cloud/upgrade/dao/Upgrade442to450.java | 234 ++++++ setup/db/db/schema-441to442.sql | 21 + setup/db/db/schema-441to450-cleanup.sql | 33 - setup/db/db/schema-441to450.sql | 770 ------------------- setup/db/db/schema-442to450-cleanup.sql | 33 + setup/db/db/schema-442to450.sql | 770 +++++++++++++++++++ 9 files changed, 1203 insertions(+), 1099 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cb78fc7/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java b/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java index c7216cb..dcf32d8 100644 --- a/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java +++ b/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java @@ -69,7 +69,8 @@ import com.cloud.upgrade.dao.Upgrade430to440; import com.cloud.upgrade.dao.Upgrade431to440; import com.cloud.upgrade.dao.Upgrade432to440; import com.cloud.upgrade.dao.Upgrade440to441; -import com.cloud.upgrade.dao.Upgrade441to450; +import com.cloud.upgrade.dao.Upgrade441to442; +import com.cloud.upgrade.dao.Upgrade442to450; import com.cloud.upgrade.dao.Upgrade450to460; import com.cloud.upgrade.dao.UpgradeSnapshot217to224; import com.cloud.upgrade.dao.UpgradeSnapshot223to224; @@ -100,8 +101,8 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker { new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), - new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), - new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.1.8", new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(), @@ -109,7 +110,8 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker { new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), - new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.1.9", new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(), @@ -117,161 +119,183 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker { new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), - new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.1", new DbUpgrade[] {new Upgrade221to222(), new UpgradeSnapshot223to224(), new Upgrade222to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), - new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.2", new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), - new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.3", new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), - new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.4", new DbUpgrade[] {new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), - new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.5", new DbUpgrade[] {new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), - new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), - new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.6", new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), - new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.7", new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), - new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.8", new DbUpgrade[] {new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), - new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30() - , new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), - new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), + new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), + new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.9", new DbUpgrade[] {new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), - new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.10", new DbUpgrade[] {new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), - new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); - - _upgradeMap.put("2.2.10", new DbUpgrade[] {new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), - new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), - new Upgrade421to430(), - new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.12", new DbUpgrade[] {new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), - new Upgrade430to440(), new Upgrade440to441(), - new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.13", new DbUpgrade[] {new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), - new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), + new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.14", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), - new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); - - _upgradeMap.put("2.2.13", new DbUpgrade[] {new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), - new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); - - _upgradeMap.put("2.2.14", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), - new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("3.0.0", new DbUpgrade[] {new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), - new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("3.0.1", new DbUpgrade[] {new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), - new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("3.0.2", new DbUpgrade[] {new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), - new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450()}); + new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("4.0.0", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), - new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("4.0.1", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), - new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); + + _upgradeMap.put("4.0.1", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), + new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("4.0.2", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), - new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("4.1.0", new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), - new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("4.1.1", new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), - new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to460()}); - _upgradeMap.put("4.2.0", new DbUpgrade[] {new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), + _upgradeMap.put("4.2.0", new DbUpgrade[] {new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); - _upgradeMap.put("4.2.1", new DbUpgrade[] {new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + _upgradeMap.put("4.2.1", new DbUpgrade[] {new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); - _upgradeMap.put("4.3.0", new DbUpgrade[] {new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + _upgradeMap.put("4.3.0", new DbUpgrade[] {new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); - _upgradeMap.put("4.3.1", new DbUpgrade[] {new Upgrade431to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + _upgradeMap.put("4.3.1", new DbUpgrade[] {new Upgrade431to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); - _upgradeMap.put("4.3.2", new DbUpgrade[] {new Upgrade432to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + _upgradeMap.put("4.3.2", new DbUpgrade[] {new Upgrade432to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); - _upgradeMap.put("4.4.0", new DbUpgrade[] {new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + _upgradeMap.put("4.4.0", new DbUpgrade[] {new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); - _upgradeMap.put("4.4.1", new DbUpgrade[] {new Upgrade441to450(), new Upgrade450to460()}); + _upgradeMap.put("4.4.1", new DbUpgrade[] {new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to460()}); + + _upgradeMap.put("4.4.2", new DbUpgrade[] {new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("4.5.0", new DbUpgrade[] {new Upgrade450to460()}); //CP Upgrades _upgradeMap.put("3.0.3", new DbUpgrade[] {new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), - new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade440to441(), - new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("3.0.4", new DbUpgrade[] {new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), - new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade440to441(), new Upgrade441to450(), - new Upgrade450to460()}); + new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("3.0.5", new DbUpgrade[] {new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), - new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("3.0.6", new DbUpgrade[] {new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), - new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("3.0.7", new DbUpgrade[] {new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), - new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.15", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), - new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); _upgradeMap.put("2.2.16", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), - new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to450(), new Upgrade450to460()}); + new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), + new Upgrade442to450(), new Upgrade450to460()}); } protected void runScript(Connection conn, File file) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cb78fc7/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to442.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to442.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to442.java new file mode 100644 index 0000000..bd50dfb --- /dev/null +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to442.java @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.upgrade.dao; + +import java.io.File; +import java.sql.Connection; + +import org.apache.log4j.Logger; + +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.script.Script; + +public class Upgrade441to442 implements DbUpgrade { + final static Logger s_logger = Logger.getLogger(Upgrade441to442.class); + + @Override + public String[] getUpgradableVersionRange() { + return new String[] {"4.4.1", "4.4.2"}; + } + + @Override + public String getUpgradedVersion() { + return "4.4.2"; + } + + @Override + public boolean supportsRollingUpgrade() { + return false; + } + + @Override + public File[] getPrepareScripts() { + String script = Script.findScript("", "db/schema-441to442.sql"); + if (script == null) { + throw new CloudRuntimeException("Unable to find db/schema-441to442.sql"); + } + + return new File[] {new File(script)}; + } + + @Override + public void performDataMigration(Connection conn) { + } + + @Override + public File[] getCleanupScripts() { + return null; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cb78fc7/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to450.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to450.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to450.java deleted file mode 100644 index 4e2bcad..0000000 --- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to450.java +++ /dev/null @@ -1,239 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.upgrade.dao; - -import java.io.File; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.cloud.hypervisor.Hypervisor; -import org.apache.log4j.Logger; - -import com.cloud.utils.exception.CloudRuntimeException; -import com.cloud.utils.script.Script; - -public class Upgrade441to450 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade441to450.class); - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.4.1", "4.5.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.5.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public File[] getPrepareScripts() { - String script = Script.findScript("", "db/schema-441to450.sql"); - if (script == null) { - throw new CloudRuntimeException("Unable to find db/schema-441to450.sql"); - } - - return new File[] {new File(script)}; - } - - @Override - public void performDataMigration(Connection conn) { - updateSystemVmTemplates(conn); - dropInvalidKeyFromStoragePoolTable(conn); - dropDuplicatedForeignKeyFromAsyncJobTable(conn); - } - - - @Override - public File[] getCleanupScripts() { - String script = Script.findScript("", "db/schema-441to450-cleanup.sql"); - if (script == null) { - throw new CloudRuntimeException("Unable to find db/schema-441to450-cleanup.sql"); - } - - return new File[] {new File(script)}; - } - - private void updateSystemVmTemplates(Connection conn) { - s_logger.debug("Updating System Vm template IDs"); - try { - //Get all hypervisors in use - Set hypervisorsListInUse = new HashSet(); - try (PreparedStatement sel_hyp_type_pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null");) { - try (ResultSet hyp_type_rs = sel_hyp_type_pstmt.executeQuery();) { - while (hyp_type_rs.next()) { - switch (Hypervisor.HypervisorType.getType(hyp_type_rs.getString(1))) { - case XenServer: - hypervisorsListInUse.add(Hypervisor.HypervisorType.XenServer); - break; - case KVM: - hypervisorsListInUse.add(Hypervisor.HypervisorType.KVM); - break; - case VMware: - hypervisorsListInUse.add(Hypervisor.HypervisorType.VMware); - break; - case Hyperv: - hypervisorsListInUse.add(Hypervisor.HypervisorType.Hyperv); - break; - case LXC: - hypervisorsListInUse.add(Hypervisor.HypervisorType.LXC); - break; - } - } - } catch (SQLException e) { - throw new CloudRuntimeException("updateSystemVmTemplates:Exception:" + e.getMessage(), e); - } - } catch (SQLException e) { - throw new CloudRuntimeException("updateSystemVmTemplates:Exception:" + e.getMessage(), e); - } - Map NewTemplateNameList = new HashMap() { - { - put(Hypervisor.HypervisorType.XenServer, "systemvm-xenserver-4.5"); - put(Hypervisor.HypervisorType.VMware, "systemvm-vmware-4.5"); - put(Hypervisor.HypervisorType.KVM, "systemvm-kvm-4.5"); - put(Hypervisor.HypervisorType.LXC, "systemvm-lxc-4.5"); - put(Hypervisor.HypervisorType.Hyperv, "systemvm-hyperv-4.5"); - } - }; - Map routerTemplateConfigurationNames = new HashMap() { - { - put(Hypervisor.HypervisorType.XenServer, "router.template.xen"); - put(Hypervisor.HypervisorType.VMware, "router.template.vmware"); - put(Hypervisor.HypervisorType.KVM, "router.template.kvm"); - put(Hypervisor.HypervisorType.LXC, "router.template.lxc"); - put(Hypervisor.HypervisorType.Hyperv, "router.template.hyperv"); - } - }; - Map newTemplateUrl = new HashMap() { - { - put(Hypervisor.HypervisorType.XenServer, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-xen.vhd.bz2"); - put(Hypervisor.HypervisorType.VMware, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-vmware.ova"); - put(Hypervisor.HypervisorType.KVM, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-kvm.qcow2.bz2"); - put(Hypervisor.HypervisorType.LXC, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-kvm.qcow2.bz2"); - put(Hypervisor.HypervisorType.Hyperv, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-hyperv.vhd.zip"); - } - }; - Map newTemplateChecksum = new HashMap() { - { - put(Hypervisor.HypervisorType.XenServer, "2b15ab4401c2d655264732d3fc600241"); - put(Hypervisor.HypervisorType.VMware, "3106a79a4ce66cd7f6a7c50e93f2db57"); - put(Hypervisor.HypervisorType.KVM, "aa9f501fecd3de1daeb9e2f357f6f002"); - put(Hypervisor.HypervisorType.LXC, "aa9f501fecd3de1daeb9e2f357f6f002"); - put(Hypervisor.HypervisorType.Hyperv, "70bd30ea02ee9ed67d2c6b85c179cee9"); - } - }; - for (Map.Entry hypervisorAndTemplateName : NewTemplateNameList.entrySet()) { - s_logger.debug("Updating " + hypervisorAndTemplateName.getKey() + " System Vms"); - try (PreparedStatement sel_templ_pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = ? and removed is null order by id desc limit 1");) - { - //Get 4.5.0 system Vm template Id for corresponding hypervisor - sel_templ_pstmt.setString(1, hypervisorAndTemplateName.getValue()); - try (ResultSet rs = sel_templ_pstmt.executeQuery();) - { - if (rs.next()) { - long templateId = rs.getLong(1); - try(PreparedStatement update_cloud_templ_pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");) - { - update_cloud_templ_pstmt.setLong(1, templateId); - update_cloud_templ_pstmt.executeUpdate(); - // update templete ID of system Vms - }catch (SQLException e) { - throw new CloudRuntimeException("updateSystemVmTemplates:Exception:" + e.getMessage(), e); - } - try(PreparedStatement update_instance_pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = ?");) { - update_instance_pstmt.setLong(1, templateId); - update_instance_pstmt.setString(2, hypervisorAndTemplateName.getKey().toString()); - update_instance_pstmt.executeUpdate(); - }catch (SQLException e) { - throw new CloudRuntimeException("updateSystemVmTemplates:Exception:" + e.getMessage(), e); - } - // Change value of global configuration parameter router.template.* for the corresponding hypervisor - try(PreparedStatement update_cloud_pstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value = ? WHERE name = ?");) - { - update_cloud_pstmt.setString(1, hypervisorAndTemplateName.getValue()); - update_cloud_pstmt.setString(2, routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey())); - update_cloud_pstmt.executeUpdate(); - }catch (SQLException e) { - throw new CloudRuntimeException("updateSystemVmTemplates:Exception:" + e.getMessage(), e); - } - } else { - if (hypervisorsListInUse.contains(hypervisorAndTemplateName.getKey())) { - throw new CloudRuntimeException("4.5.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. Cannot upgrade system Vms"); - } else { - s_logger.warn("4.5.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. " + hypervisorAndTemplateName.getKey() + " hypervisor is not used, so not failing upgrade"); - // Update the latest template URLs for corresponding hypervisor - try (PreparedStatement update_pstmt = conn.prepareStatement("UPDATE `cloud`.`vm_template` SET url = ? , checksum = ? WHERE hypervisor_type = ? AND type = 'SYSTEM' AND removed is null order by id desc limit 1");) { - update_pstmt.setString(1, newTemplateUrl.get(hypervisorAndTemplateName.getKey())); - update_pstmt.setString(2, newTemplateChecksum.get(hypervisorAndTemplateName.getKey())); - update_pstmt.setString(3, hypervisorAndTemplateName.getKey().toString()); - update_pstmt.executeUpdate(); - } catch (SQLException e) { - throw new CloudRuntimeException("updateSystemVmTemplates:Exception:" + e.getMessage(), e); - } - } - } - } catch (SQLException e) { - throw new CloudRuntimeException("updateSystemVmTemplates:Exception:" + e.getMessage(), e); - } - } - s_logger.debug("Updating System Vm Template IDs Complete"); - } - }catch(SQLException e){ - throw new CloudRuntimeException("updateSystemVmTemplates:Exception:" + e.getMessage(), e); - } - } - - - private void dropInvalidKeyFromStoragePoolTable(Connection conn) { - HashMap> uniqueKeys = new HashMap>(); - List keys = new ArrayList(); - - keys.add("id_2"); - uniqueKeys.put("storage_pool", keys); - - s_logger.debug("Dropping id_2 key from storage_pool table"); - for (Map.Entry> entry: uniqueKeys.entrySet()) { - DbUpgradeUtils.dropKeysIfExist(conn,entry.getKey(), entry.getValue(), false); - } - } - - private void dropDuplicatedForeignKeyFromAsyncJobTable(Connection conn) { - HashMap> foreignKeys = new HashMap>(); - List keys = new ArrayList(); - - keys.add("fk_async_job_join_map__join_job_id"); - foreignKeys.put("async_job_join_map", keys); - - s_logger.debug("Dropping fk_async_job_join_map__join_job_id key from async_job_join_map table"); - for (Map.Entry> entry: foreignKeys.entrySet()) { - DbUpgradeUtils.dropKeysIfExist(conn,entry.getKey(), entry.getValue(), true); - } - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cb78fc7/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java new file mode 100644 index 0000000..dc1057f --- /dev/null +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java @@ -0,0 +1,234 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.upgrade.dao; + +import java.io.File; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.cloud.hypervisor.Hypervisor; +import org.apache.log4j.Logger; + +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.script.Script; + +public class Upgrade442to450 implements DbUpgrade { + final static Logger s_logger = Logger.getLogger(Upgrade442to450.class); + + @Override + public String[] getUpgradableVersionRange() { + return new String[] {"4.4.2", "4.5.0"}; + } + + @Override + public String getUpgradedVersion() { + return "4.5.0"; + } + + @Override + public boolean supportsRollingUpgrade() { + return false; + } + + @Override + public File[] getPrepareScripts() { + String script = Script.findScript("", "db/schema-442to450.sql"); + if (script == null) { + throw new CloudRuntimeException("Unable to find db/schema-442to450.sql"); + } + + return new File[] {new File(script)}; + } + + @Override + public void performDataMigration(Connection conn) { + updateSystemVmTemplates(conn); + dropInvalidKeyFromStoragePoolTable(conn); + dropDuplicatedForeignKeyFromAsyncJobTable(conn); + } + + + @Override + public File[] getCleanupScripts() { + String script = Script.findScript("", "db/schema-442to450-cleanup.sql"); + if (script == null) { + throw new CloudRuntimeException("Unable to find db/schema-442to450-cleanup.sql"); + } + + return new File[] {new File(script)}; + } + + private void updateSystemVmTemplates(Connection conn) { + PreparedStatement pstmt = null; + ResultSet rs = null; + s_logger.debug("Updating System Vm template IDs"); + try{ + //Get all hypervisors in use + Set hypervisorsListInUse = new HashSet(); + try { + pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null"); + rs = pstmt.executeQuery(); + while(rs.next()){ + switch (Hypervisor.HypervisorType.getType(rs.getString(1))) { + case XenServer: hypervisorsListInUse.add(Hypervisor.HypervisorType.XenServer); + break; + case KVM: hypervisorsListInUse.add(Hypervisor.HypervisorType.KVM); + break; + case VMware: hypervisorsListInUse.add(Hypervisor.HypervisorType.VMware); + break; + case Hyperv: hypervisorsListInUse.add(Hypervisor.HypervisorType.Hyperv); + break; + case LXC: hypervisorsListInUse.add(Hypervisor.HypervisorType.LXC); + break; + } + } + } catch (SQLException e) { + throw new CloudRuntimeException("Error while listing hypervisors in use", e); + } + + Map NewTemplateNameList = new HashMap(){ + { put(Hypervisor.HypervisorType.XenServer, "systemvm-xenserver-4.5"); + put(Hypervisor.HypervisorType.VMware, "systemvm-vmware-4.5"); + put(Hypervisor.HypervisorType.KVM, "systemvm-kvm-4.5"); + put(Hypervisor.HypervisorType.LXC, "systemvm-lxc-4.5"); + put(Hypervisor.HypervisorType.Hyperv, "systemvm-hyperv-4.5"); + } + }; + + Map routerTemplateConfigurationNames = new HashMap(){ + { put(Hypervisor.HypervisorType.XenServer, "router.template.xen"); + put(Hypervisor.HypervisorType.VMware, "router.template.vmware"); + put(Hypervisor.HypervisorType.KVM, "router.template.kvm"); + put(Hypervisor.HypervisorType.LXC, "router.template.lxc"); + put(Hypervisor.HypervisorType.Hyperv, "router.template.hyperv"); + } + }; + + Map newTemplateUrl = new HashMap(){ + { put(Hypervisor.HypervisorType.XenServer, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-xen.vhd.bz2"); + put(Hypervisor.HypervisorType.VMware, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-vmware.ova"); + put(Hypervisor.HypervisorType.KVM, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-kvm.qcow2.bz2"); + put(Hypervisor.HypervisorType.LXC, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-kvm.qcow2.bz2"); + put(Hypervisor.HypervisorType.Hyperv, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-hyperv.vhd.zip"); + } + }; + + Map newTemplateChecksum = new HashMap(){ + { put(Hypervisor.HypervisorType.XenServer, "2b15ab4401c2d655264732d3fc600241"); + put(Hypervisor.HypervisorType.VMware, "3106a79a4ce66cd7f6a7c50e93f2db57"); + put(Hypervisor.HypervisorType.KVM, "aa9f501fecd3de1daeb9e2f357f6f002"); + put(Hypervisor.HypervisorType.LXC, "aa9f501fecd3de1daeb9e2f357f6f002"); + put(Hypervisor.HypervisorType.Hyperv, "70bd30ea02ee9ed67d2c6b85c179cee9"); + } + }; + + for (Map.Entry hypervisorAndTemplateName : NewTemplateNameList.entrySet()){ + s_logger.debug("Updating " + hypervisorAndTemplateName.getKey() + " System Vms"); + try { + //Get 4.5.0 system Vm template Id for corresponding hypervisor + pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = ? and removed is null order by id desc limit 1"); + pstmt.setString(1, hypervisorAndTemplateName.getValue()); + rs = pstmt.executeQuery(); + if(rs.next()){ + long templateId = rs.getLong(1); + rs.close(); + pstmt.close(); + pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?"); + pstmt.setLong(1, templateId); + pstmt.executeUpdate(); + pstmt.close(); + // update templete ID of system Vms + pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = ?"); + pstmt.setLong(1, templateId); + pstmt.setString(2, hypervisorAndTemplateName.getKey().toString()); + pstmt.executeUpdate(); + pstmt.close(); + // Change value of global configuration parameter router.template.* for the corresponding hypervisor + pstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value = ? WHERE name = ?"); + pstmt.setString(1, hypervisorAndTemplateName.getValue()); + pstmt.setString(2, routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey())); + pstmt.executeUpdate(); + pstmt.close(); + } else { + if (hypervisorsListInUse.contains(hypervisorAndTemplateName.getKey())){ + throw new CloudRuntimeException("4.5.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. Cannot upgrade system Vms"); + } else { + s_logger.warn("4.5.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. " + hypervisorAndTemplateName.getKey() + " hypervisor is not used, so not failing upgrade"); + // Update the latest template URLs for corresponding hypervisor + pstmt = conn.prepareStatement("UPDATE `cloud`.`vm_template` SET url = ? , checksum = ? WHERE hypervisor_type = ? AND type = 'SYSTEM' AND removed is null order by id desc limit 1"); + pstmt.setString(1, newTemplateUrl.get(hypervisorAndTemplateName.getKey())); + pstmt.setString(2, newTemplateChecksum.get(hypervisorAndTemplateName.getKey())); + pstmt.setString(3, hypervisorAndTemplateName.getKey().toString()); + pstmt.executeUpdate(); + pstmt.close(); + } + } + } catch (SQLException e) { + throw new CloudRuntimeException("Error while updating "+ hypervisorAndTemplateName.getKey() +" systemVm template", e); + } + } + s_logger.debug("Updating System Vm Template IDs Complete"); + } finally { + try { + if (rs != null) { + rs.close(); + } + + if (pstmt != null) { + pstmt.close(); + } + } catch (SQLException e) { + } + } + } + + + private void dropInvalidKeyFromStoragePoolTable(Connection conn) { + HashMap> uniqueKeys = new HashMap>(); + List keys = new ArrayList(); + + keys.add("id_2"); + uniqueKeys.put("storage_pool", keys); + + s_logger.debug("Dropping id_2 key from storage_pool table"); + for (Map.Entry> entry: uniqueKeys.entrySet()) { + DbUpgradeUtils.dropKeysIfExist(conn,entry.getKey(), entry.getValue(), false); + } + } + + private void dropDuplicatedForeignKeyFromAsyncJobTable(Connection conn) { + HashMap> foreignKeys = new HashMap>(); + List keys = new ArrayList(); + + keys.add("fk_async_job_join_map__join_job_id"); + foreignKeys.put("async_job_join_map", keys); + + s_logger.debug("Dropping fk_async_job_join_map__join_job_id key from async_job_join_map table"); + for (Map.Entry> entry: foreignKeys.entrySet()) { + DbUpgradeUtils.dropKeysIfExist(conn,entry.getKey(), entry.getValue(), true); + } + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cb78fc7/setup/db/db/schema-441to442.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-441to442.sql b/setup/db/db/schema-441to442.sql new file mode 100644 index 0000000..3b1618c --- /dev/null +++ b/setup/db/db/schema-441to442.sql @@ -0,0 +1,21 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you under the Apache License, Version 2.0 (the +-- "License"); you may not use this file except in compliance +-- with the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, +-- software distributed under the License is distributed on an +-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +-- KIND, either express or implied. See the License for the +-- specific language governing permissions and limitations +-- under the License. + +--; +-- Schema upgrade from 4.4.1 to 4.4.2; +--; + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cb78fc7/setup/db/db/schema-441to450-cleanup.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-441to450-cleanup.sql b/setup/db/db/schema-441to450-cleanup.sql deleted file mode 100644 index d657d2e..0000000 --- a/setup/db/db/schema-441to450-cleanup.sql +++ /dev/null @@ -1,33 +0,0 @@ --- Licensed to the Apache Software Foundation (ASF) under one --- or more contributor license agreements. See the NOTICE file --- distributed with this work for additional information --- regarding copyright ownership. The ASF licenses this file --- to you under the Apache License, Version 2.0 (the --- "License"); you may not use this file except in compliance --- with the License. You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, --- software distributed under the License is distributed on an --- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY --- KIND, either express or implied. See the License for the --- specific language governing permissions and limitations --- under the License. - --- --- Schema cleanup from 4.4.0 to 4.5.0 --- - -UPDATE `cloud`.`configuration` -SET name = 'router.template.xenserver' -Where name = 'router.template.xen'; - -UPDATE `cloud`.`configuration` -SET name = 'xenserver.nics.max', -description = 'Maximum allowed nics for Vms created on XenServer' -Where name = 'xen.nics.max'; - -UPDATE `cloud`.`configuration` -SET value = 'XenServer' -Where value = 'Xen'; \ No newline at end of file