You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2022/12/13 07:12:28 UTC
[cloudstack] branch 4.17 updated: schema: Add upgrade path from 4.17.1.0 to 4.17.2.0 (#6981)
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch 4.17
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.17 by this push:
new d331b2f98fd schema: Add upgrade path from 4.17.1.0 to 4.17.2.0 (#6981)
d331b2f98fd is described below
commit d331b2f98fd8f4e94459ca5dc14995e5ed3160fd
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Tue Dec 13 12:42:20 2022 +0530
schema: Add upgrade path from 4.17.1.0 to 4.17.2.0 (#6981)
This implements a blank/noop upgrade path from 4.17.1.0 to 4.17.2.0
which implements DbUpgradeSystemVmTemplate to kick the systemvm template
upgrade.
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
.../com/cloud/upgrade/DatabaseUpgradeChecker.java | 10 +--
.../com/cloud/upgrade/dao/Upgrade41700to41710.java | 2 +-
.../com/cloud/upgrade/dao/Upgrade41710to41720.java | 75 ++++++++++++++++++++++
3 files changed, 82 insertions(+), 5 deletions(-)
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 43957e3c6d0..b07328f9f24 100644
--- a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java
+++ b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java
@@ -29,10 +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 org.apache.cloudstack.utils.CloudStackVersion;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
@@ -75,7 +71,12 @@ 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.Upgrade420to421;
import com.cloud.upgrade.dao.Upgrade421to430;
import com.cloud.upgrade.dao.Upgrade430to440;
@@ -209,6 +210,7 @@ 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 Upgrade41710to41720())
.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)");
+ }
+ }
+}