Skip to content

Commit d331b2f

Browse files
authored
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 <rohit.yadav@shapeblue.com>
1 parent 5516f74 commit d331b2f

File tree

3 files changed

+82
-5
lines changed

3 files changed

+82
-5
lines changed

engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@
2929

3030
import javax.inject.Inject;
3131

32-
import com.cloud.upgrade.dao.Upgrade41510to41520;
33-
import com.cloud.upgrade.dao.Upgrade41600to41610;
34-
import com.cloud.upgrade.dao.Upgrade41610to41700;
35-
import com.cloud.upgrade.dao.Upgrade41700to41710;
3632
import org.apache.cloudstack.utils.CloudStackVersion;
3733
import org.apache.commons.lang3.StringUtils;
3834
import org.apache.log4j.Logger;
@@ -75,7 +71,12 @@
7571
import com.cloud.upgrade.dao.Upgrade41310to41400;
7672
import com.cloud.upgrade.dao.Upgrade41400to41500;
7773
import com.cloud.upgrade.dao.Upgrade41500to41510;
74+
import com.cloud.upgrade.dao.Upgrade41510to41520;
7875
import com.cloud.upgrade.dao.Upgrade41520to41600;
76+
import com.cloud.upgrade.dao.Upgrade41600to41610;
77+
import com.cloud.upgrade.dao.Upgrade41610to41700;
78+
import com.cloud.upgrade.dao.Upgrade41700to41710;
79+
import com.cloud.upgrade.dao.Upgrade41710to41720;
7980
import com.cloud.upgrade.dao.Upgrade420to421;
8081
import com.cloud.upgrade.dao.Upgrade421to430;
8182
import com.cloud.upgrade.dao.Upgrade430to440;
@@ -209,6 +210,7 @@ public DatabaseUpgradeChecker() {
209210
.next("4.16.1.1", new Upgrade41610to41700())
210211
.next("4.17.0.0", new Upgrade41700to41710())
211212
.next("4.17.0.1", new Upgrade41700to41710())
213+
.next("4.17.1.0", new Upgrade41710to41720())
212214
.build();
213215
}
214216

engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41700to41710.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
public class Upgrade41700to41710 implements DbUpgrade, DbUpgradeSystemVmTemplate {
3636

37-
final static Logger LOG = Logger.getLogger(Upgrade41610to41700.class);
37+
final static Logger LOG = Logger.getLogger(Upgrade41700to41710.class);
3838
private SystemVmTemplateRegistration systemVmTemplateRegistration;
3939

4040
private PrimaryDataStoreDao storageDao;
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.upgrade.dao;
18+
19+
import com.cloud.upgrade.SystemVmTemplateRegistration;
20+
import com.cloud.utils.exception.CloudRuntimeException;
21+
import org.apache.log4j.Logger;
22+
23+
import java.io.InputStream;
24+
import java.sql.Connection;
25+
26+
public class Upgrade41710to41720 implements DbUpgrade, DbUpgradeSystemVmTemplate {
27+
28+
final static Logger LOG = Logger.getLogger(Upgrade41710to41720.class);
29+
30+
private SystemVmTemplateRegistration systemVmTemplateRegistration;
31+
32+
@Override
33+
public String[] getUpgradableVersionRange() {
34+
return new String[] {"4.17.1.0", "4.17.2.0"};
35+
}
36+
37+
@Override
38+
public String getUpgradedVersion() {
39+
return "4.17.2.0";
40+
}
41+
42+
@Override
43+
public boolean supportsRollingUpgrade() {
44+
return false;
45+
}
46+
47+
@Override
48+
public InputStream[] getPrepareScripts() {
49+
return null;
50+
}
51+
52+
@Override
53+
public void performDataMigration(Connection conn) {
54+
}
55+
56+
@Override
57+
public InputStream[] getCleanupScripts() {
58+
return null;
59+
}
60+
61+
private void initSystemVmTemplateRegistration() {
62+
systemVmTemplateRegistration = new SystemVmTemplateRegistration("");
63+
}
64+
65+
@Override
66+
public void updateSystemVmTemplates(Connection conn) {
67+
LOG.debug("Updating System Vm template IDs");
68+
initSystemVmTemplateRegistration();
69+
try {
70+
systemVmTemplateRegistration.updateSystemVmTemplates(conn);
71+
} catch (Exception e) {
72+
throw new CloudRuntimeException("Failed to find / register SystemVM template(s)");
73+
}
74+
}
75+
}

0 commit comments

Comments
 (0)