Skip to content

Commit 72b6ab9

Browse files
committed
Merge remote-tracking branch 'origin/4.17' into main
Due to merge conflict, and schema changes in 4.17 branch the previous 4.17.1->4.18.0 DB upgrade path class was renamed to 4.17.2->4.18.0 Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2 parents 01b79e7 + d331b2f commit 72b6ab9

File tree

6 files changed

+94
-16
lines changed

6 files changed

+94
-16
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +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;
36-
import com.cloud.upgrade.dao.Upgrade41710to41800;
3732
import org.apache.cloudstack.utils.CloudStackVersion;
3833
import org.apache.commons.lang3.StringUtils;
3934
import org.apache.log4j.Logger;
@@ -76,7 +71,13 @@
7671
import com.cloud.upgrade.dao.Upgrade41310to41400;
7772
import com.cloud.upgrade.dao.Upgrade41400to41500;
7873
import com.cloud.upgrade.dao.Upgrade41500to41510;
74+
import com.cloud.upgrade.dao.Upgrade41510to41520;
7975
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;
80+
import com.cloud.upgrade.dao.Upgrade41720to41800;
8081
import com.cloud.upgrade.dao.Upgrade420to421;
8182
import com.cloud.upgrade.dao.Upgrade421to430;
8283
import com.cloud.upgrade.dao.Upgrade430to440;
@@ -210,8 +211,8 @@ public DatabaseUpgradeChecker() {
210211
.next("4.16.1.1", new Upgrade41610to41700())
211212
.next("4.17.0.0", new Upgrade41700to41710())
212213
.next("4.17.0.1", new Upgrade41700to41710())
213-
.next("4.17.1.0", new Upgrade41710to41800())
214-
.next("4.17.2.0", new Upgrade41710to41800())
214+
.next("4.17.1.0", new Upgrade41710to41720())
215+
.next("4.17.2.0", new Upgrade41720to41800())
215216
.build();
216217
}
217218

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+
}

engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41710to41800.java renamed to engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41720to41800.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@
3535
import java.util.List;
3636
import java.util.Map;
3737

38-
public class Upgrade41710to41800 implements DbUpgrade, DbUpgradeSystemVmTemplate {
38+
public class Upgrade41720to41800 implements DbUpgrade, DbUpgradeSystemVmTemplate {
39+
40+
final static Logger LOG = Logger.getLogger(Upgrade41720to41800.class);
3941

40-
final static Logger LOG = Logger.getLogger(Upgrade41710to41800.class);
4142
private SystemVmTemplateRegistration systemVmTemplateRegistration;
4243

4344
@Override
4445
public String[] getUpgradableVersionRange() {
45-
return new String[] {"4.17.1.0", "4.18.0.0"};
46+
return new String[] {"4.17.2.0", "4.18.0.0"};
4647
}
4748

4849
@Override
@@ -57,7 +58,7 @@ public boolean supportsRollingUpgrade() {
5758

5859
@Override
5960
public InputStream[] getPrepareScripts() {
60-
final String scriptFile = "META-INF/db/schema-41710to41800.sql";
61+
final String scriptFile = "META-INF/db/schema-41720to41800.sql";
6162
final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
6263
if (script == null) {
6364
throw new CloudRuntimeException("Unable to find " + scriptFile);
@@ -74,7 +75,7 @@ public void performDataMigration(Connection conn) {
7475

7576
@Override
7677
public InputStream[] getCleanupScripts() {
77-
final String scriptFile = "META-INF/db/schema-41710to41800-cleanup.sql";
78+
final String scriptFile = "META-INF/db/schema-41720to41800-cleanup.sql";
7879
final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
7980
if (script == null) {
8081
throw new CloudRuntimeException("Unable to find " + scriptFile);

engine/schema/src/main/resources/META-INF/db/schema-41710to41800-cleanup.sql renamed to engine/schema/src/main/resources/META-INF/db/schema-41720to41800-cleanup.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
-- under the License.
1717

1818
--;
19-
-- Schema upgrade cleanup from 4.17.1.0 to 4.18.0.0
20-
--;
19+
-- Schema upgrade cleanup from 4.17.2.0 to 4.18.0.0
20+
--;

engine/schema/src/main/resources/META-INF/db/schema-41710to41800.sql renamed to engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
-- under the License.
1717

1818
--;
19-
-- Schema upgrade from 4.17.1.0 to 4.18.0.0
19+
-- Schema upgrade from 4.17.2.0 to 4.18.0.0
2020
--;
21+
2122
-- Enable CPU cap for default system offerings;
2223
UPDATE `cloud`.`service_offering` so
2324
SET so.limit_cpu_use = 1

0 commit comments

Comments
 (0)