Skip to content

Commit bdeebb0

Browse files
Added upgrade path from 4.19.3.0 to 4.19.4.0, and changes in networks table columns for cidr/gateway list
1 parent 3862a9b commit bdeebb0

File tree

5 files changed

+177
-1
lines changed

5 files changed

+177
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
import javax.inject.Inject;
3535

36-
import com.cloud.upgrade.dao.Upgrade41910to41920;
3736
import com.cloud.utils.FileUtil;
3837
import org.apache.cloudstack.utils.CloudStackVersion;
3938
import org.apache.commons.lang3.StringUtils;
@@ -87,6 +86,9 @@
8786
import com.cloud.upgrade.dao.Upgrade41800to41810;
8887
import com.cloud.upgrade.dao.Upgrade41810to41900;
8988
import com.cloud.upgrade.dao.Upgrade41900to41910;
89+
import com.cloud.upgrade.dao.Upgrade41910to41920;
90+
import com.cloud.upgrade.dao.Upgrade41920to41930;
91+
import com.cloud.upgrade.dao.Upgrade41930to41940;
9092
import com.cloud.upgrade.dao.Upgrade420to421;
9193
import com.cloud.upgrade.dao.Upgrade421to430;
9294
import com.cloud.upgrade.dao.Upgrade430to440;
@@ -229,6 +231,8 @@ public DatabaseUpgradeChecker() {
229231
.next("4.18.1.0", new Upgrade41810to41900())
230232
.next("4.19.0.0", new Upgrade41900to41910())
231233
.next("4.19.1.0", new Upgrade41910to41920())
234+
.next("4.19.2.0", new Upgrade41920to41930())
235+
.next("4.19.3.0", new Upgrade41930to41940())
232236
.build();
233237
}
234238

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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 org.apache.log4j.Logger;
20+
21+
import java.io.InputStream;
22+
import java.sql.Connection;
23+
24+
public class Upgrade41920to41930 implements DbUpgrade {
25+
26+
final static Logger LOG = Logger.getLogger(Upgrade41920to41930.class);
27+
28+
@Override
29+
public String[] getUpgradableVersionRange() {
30+
return new String[] {"4.19.2.0", "4.19.3.0"};
31+
}
32+
33+
@Override
34+
public String getUpgradedVersion() {
35+
return "4.19.3.0";
36+
}
37+
38+
@Override
39+
public boolean supportsRollingUpgrade() {
40+
return false;
41+
}
42+
43+
@Override
44+
public InputStream[] getPrepareScripts() {
45+
return null;
46+
}
47+
48+
@Override
49+
public void performDataMigration(Connection conn) {
50+
}
51+
52+
@Override
53+
public InputStream[] getCleanupScripts() {
54+
return null;
55+
}
56+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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.utils.exception.CloudRuntimeException;
20+
21+
import java.io.InputStream;
22+
import java.sql.Connection;
23+
24+
import org.apache.log4j.Logger;
25+
26+
public class Upgrade41930to41940 implements DbUpgrade {
27+
28+
final static Logger LOG = Logger.getLogger(Upgrade41930to41940.class);
29+
30+
@Override
31+
public String[] getUpgradableVersionRange() {
32+
return new String[]{"4.19.3.0", "4.19.4.0"};
33+
}
34+
35+
@Override
36+
public String getUpgradedVersion() {
37+
return "4.19.4.0";
38+
}
39+
40+
@Override
41+
public boolean supportsRollingUpgrade() {
42+
return false;
43+
}
44+
45+
@Override
46+
public InputStream[] getPrepareScripts() {
47+
final String scriptFile = "META-INF/db/schema-41930to41940.sql";
48+
final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
49+
if (script == null) {
50+
throw new CloudRuntimeException("Unable to find " + scriptFile);
51+
}
52+
53+
return new InputStream[] {script};
54+
}
55+
56+
@Override
57+
public void performDataMigration(Connection conn) {
58+
// nothing to do
59+
}
60+
61+
@Override
62+
public InputStream[] getCleanupScripts() {
63+
final String scriptFile = "META-INF/db/schema-41930to41940-cleanup.sql";
64+
final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
65+
if (script == null) {
66+
throw new CloudRuntimeException("Unable to find " + scriptFile);
67+
}
68+
69+
return new InputStream[] {script};
70+
}
71+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
18+
--;
19+
-- Schema upgrade cleanup from 4.19.3.0 to 4.19.4.0
20+
--;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
18+
--;
19+
-- Schema upgrade from 4.19.3.0 to 4.19.4.0
20+
--;
21+
22+
ALTER TABLE `cloud`.`networks` MODIFY COLUMN `cidr` varchar(255) DEFAULT NULL COMMENT 'CloudStack managed vms get IP address from cidr.In general this cidr also serves as the network CIDR. But in case IP reservation feature is being used by a Guest network, networkcidr is the Effective network CIDR for that network';
23+
ALTER TABLE `cloud`.`networks` MODIFY COLUMN `gateway` varchar(255) DEFAULT NULL COMMENT 'gateway(s) for this network configuration';
24+
ALTER TABLE `cloud`.`networks` MODIFY COLUMN `ip6_cidr` varchar(1024) DEFAULT NULL COMMENT 'IPv6 gateway(s) for this network';
25+
ALTER TABLE `cloud`.`networks` MODIFY COLUMN `ip6_gateway` varchar(1024) DEFAULT NULL COMMENT 'IPv6 cidr(s) for this network';

0 commit comments

Comments
 (0)