diff --git a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java index 51fb135e771..728b30fc506 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java @@ -29,11 +29,6 @@ import java.util.Date; import javax.inject.Inject; -import com.cloud.upgrade.dao.Upgrade41510to41520; -import com.cloud.upgrade.dao.Upgrade41600to41610; -import com.cloud.upgrade.dao.Upgrade41610to41700; -import com.cloud.upgrade.dao.Upgrade41700to41710; -import com.cloud.upgrade.dao.Upgrade41710to41800; import org.apache.cloudstack.utils.CloudStackVersion; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; @@ -76,7 +71,13 @@ import com.cloud.upgrade.dao.Upgrade41300to41310; import com.cloud.upgrade.dao.Upgrade41310to41400; import com.cloud.upgrade.dao.Upgrade41400to41500; import com.cloud.upgrade.dao.Upgrade41500to41510; +import com.cloud.upgrade.dao.Upgrade41510to41520; import com.cloud.upgrade.dao.Upgrade41520to41600; +import com.cloud.upgrade.dao.Upgrade41600to41610; +import com.cloud.upgrade.dao.Upgrade41610to41700; +import com.cloud.upgrade.dao.Upgrade41700to41710; +import com.cloud.upgrade.dao.Upgrade41710to41720; +import com.cloud.upgrade.dao.Upgrade41720to41800; import com.cloud.upgrade.dao.Upgrade420to421; import com.cloud.upgrade.dao.Upgrade421to430; import com.cloud.upgrade.dao.Upgrade430to440; @@ -210,8 +211,8 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker { .next("4.16.1.1", new Upgrade41610to41700()) .next("4.17.0.0", new Upgrade41700to41710()) .next("4.17.0.1", new Upgrade41700to41710()) - .next("4.17.1.0", new Upgrade41710to41800()) - .next("4.17.2.0", new Upgrade41710to41800()) + .next("4.17.1.0", new Upgrade41710to41720()) + .next("4.17.2.0", new Upgrade41720to41800()) .build(); } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41700to41710.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41700to41710.java index 5959dd46990..a228a01b9e8 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41700to41710.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41700to41710.java @@ -34,7 +34,7 @@ import com.cloud.utils.exception.CloudRuntimeException; public class Upgrade41700to41710 implements DbUpgrade, DbUpgradeSystemVmTemplate { - final static Logger LOG = Logger.getLogger(Upgrade41610to41700.class); + final static Logger LOG = Logger.getLogger(Upgrade41700to41710.class); private SystemVmTemplateRegistration systemVmTemplateRegistration; private PrimaryDataStoreDao storageDao; diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41710to41720.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41710to41720.java new file mode 100644 index 00000000000..91b7cfe978d --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41710to41720.java @@ -0,0 +1,75 @@ +// 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 com.cloud.upgrade.SystemVmTemplateRegistration; +import com.cloud.utils.exception.CloudRuntimeException; +import org.apache.log4j.Logger; + +import java.io.InputStream; +import java.sql.Connection; + +public class Upgrade41710to41720 implements DbUpgrade, DbUpgradeSystemVmTemplate { + + final static Logger LOG = Logger.getLogger(Upgrade41710to41720.class); + + private SystemVmTemplateRegistration systemVmTemplateRegistration; + + @Override + public String[] getUpgradableVersionRange() { + return new String[] {"4.17.1.0", "4.17.2.0"}; + } + + @Override + public String getUpgradedVersion() { + return "4.17.2.0"; + } + + @Override + public boolean supportsRollingUpgrade() { + return false; + } + + @Override + public InputStream[] getPrepareScripts() { + return null; + } + + @Override + public void performDataMigration(Connection conn) { + } + + @Override + public InputStream[] getCleanupScripts() { + return null; + } + + private void initSystemVmTemplateRegistration() { + systemVmTemplateRegistration = new SystemVmTemplateRegistration(""); + } + + @Override + public void updateSystemVmTemplates(Connection conn) { + LOG.debug("Updating System Vm template IDs"); + initSystemVmTemplateRegistration(); + try { + systemVmTemplateRegistration.updateSystemVmTemplates(conn); + } catch (Exception e) { + throw new CloudRuntimeException("Failed to find / register SystemVM template(s)"); + } + } +} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41710to41800.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41720to41800.java similarity index 97% rename from engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41710to41800.java rename to engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41720to41800.java index baa2860b84b..fae91310035 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41710to41800.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41720to41800.java @@ -35,14 +35,15 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -public class Upgrade41710to41800 implements DbUpgrade, DbUpgradeSystemVmTemplate { +public class Upgrade41720to41800 implements DbUpgrade, DbUpgradeSystemVmTemplate { + + final static Logger LOG = Logger.getLogger(Upgrade41720to41800.class); - final static Logger LOG = Logger.getLogger(Upgrade41710to41800.class); private SystemVmTemplateRegistration systemVmTemplateRegistration; @Override public String[] getUpgradableVersionRange() { - return new String[] {"4.17.1.0", "4.18.0.0"}; + return new String[] {"4.17.2.0", "4.18.0.0"}; } @Override @@ -57,7 +58,7 @@ public class Upgrade41710to41800 implements DbUpgrade, DbUpgradeSystemVmTemplate @Override public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-41710to41800.sql"; + final String scriptFile = "META-INF/db/schema-41720to41800.sql"; final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); if (script == null) { throw new CloudRuntimeException("Unable to find " + scriptFile); @@ -74,7 +75,7 @@ public class Upgrade41710to41800 implements DbUpgrade, DbUpgradeSystemVmTemplate @Override public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-41710to41800-cleanup.sql"; + final String scriptFile = "META-INF/db/schema-41720to41800-cleanup.sql"; final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); if (script == null) { throw new CloudRuntimeException("Unable to find " + scriptFile); diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41710to41800-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/schema-41720to41800-cleanup.sql similarity index 93% rename from engine/schema/src/main/resources/META-INF/db/schema-41710to41800-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/schema-41720to41800-cleanup.sql index d3d586d3e2e..9e200d76fb4 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41710to41800-cleanup.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41720to41800-cleanup.sql @@ -16,5 +16,5 @@ -- under the License. --; --- Schema upgrade cleanup from 4.17.1.0 to 4.18.0.0 ---; \ No newline at end of file +-- Schema upgrade cleanup from 4.17.2.0 to 4.18.0.0 +--; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41710to41800.sql b/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql similarity index 99% rename from engine/schema/src/main/resources/META-INF/db/schema-41710to41800.sql rename to engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql index a0c455e6ba7..7d2aa8e67c1 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41710to41800.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql @@ -16,8 +16,9 @@ -- under the License. --; --- Schema upgrade from 4.17.1.0 to 4.18.0.0 +-- Schema upgrade from 4.17.2.0 to 4.18.0.0 --; + -- Enable CPU cap for default system offerings; UPDATE `cloud`.`service_offering` so SET so.limit_cpu_use = 1