Skip to content

Commit 46ab973

Browse files
committed
db: Fix Upgrade40to41 and add cleaning path schema-40to410-cleanup.sql
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
1 parent 87b668b commit 46ab973

2 files changed

Lines changed: 27 additions & 31 deletions

File tree

server/src/com/cloud/upgrade/dao/Upgrade40to41.java

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,47 +32,24 @@
3232

3333
import org.apache.log4j.Logger;
3434

35-
/**
36-
* @author htrippaers
37-
*
38-
*/
3935
public class Upgrade40to41 implements DbUpgrade {
4036
final static Logger s_logger = Logger.getLogger(Upgrade40to41.class);
4137

42-
/**
43-
*
44-
*/
45-
public Upgrade40to41() {
46-
// TODO Auto-generated constructor stub
47-
}
48-
49-
/* (non-Javadoc)
50-
* @see com.cloud.upgrade.dao.DbUpgrade#getUpgradableVersionRange()
51-
*/
5238
@Override
5339
public String[] getUpgradableVersionRange() {
5440
return new String[] { "4.0.0", "4.1.0" };
5541
}
5642

57-
/* (non-Javadoc)
58-
* @see com.cloud.upgrade.dao.DbUpgrade#getUpgradedVersion()
59-
*/
6043
@Override
6144
public String getUpgradedVersion() {
6245
return "4.1.0";
6346
}
6447

65-
/* (non-Javadoc)
66-
* @see com.cloud.upgrade.dao.DbUpgrade#supportsRollingUpgrade()
67-
*/
6848
@Override
6949
public boolean supportsRollingUpgrade() {
7050
return false;
7151
}
7252

73-
/* (non-Javadoc)
74-
* @see com.cloud.upgrade.dao.DbUpgrade#getPrepareScripts()
75-
*/
7653
@Override
7754
public File[] getPrepareScripts() {
7855
String script = Script.findScript("", "db/schema-40to410.sql");
@@ -83,21 +60,20 @@ public File[] getPrepareScripts() {
8360
return new File[] { new File(script) };
8461
}
8562

86-
/* (non-Javadoc)
87-
* @see com.cloud.upgrade.dao.DbUpgrade#performDataMigration(java.sql.Connection)
88-
*/
8963
@Override
9064
public void performDataMigration(Connection conn) {
9165
upgradeEIPNetworkOfferings(conn);
9266
upgradeEgressFirewallRules(conn);
9367
}
9468

95-
/* (non-Javadoc)
96-
* @see com.cloud.upgrade.dao.DbUpgrade#getCleanupScripts()
97-
*/
9869
@Override
9970
public File[] getCleanupScripts() {
100-
return new File[0];
71+
String script = Script.findScript("", "db/schema-40to410-cleanup.sql");
72+
if (script == null) {
73+
throw new CloudRuntimeException("Unable to find db/schema-302to40-cleanup.sql");
74+
}
75+
76+
return new File[] { new File(script) };
10177
}
10278

10379
private void upgradeEIPNetworkOfferings(Connection conn) {
@@ -133,7 +109,6 @@ private void upgradeEIPNetworkOfferings(Connection conn) {
133109
}
134110
}
135111

136-
137112
private void upgradeEgressFirewallRules(Connection conn) {
138113
PreparedStatement pstmt = null;
139114
ResultSet rs = null;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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 cleanup from 4.0.0 to 4.1.0;
20+
--;
21+

0 commit comments

Comments
 (0)