Skip to content

Commit ebcf6b1

Browse files
committed
Revert "Fix fresh db install problem. (still pending one part of finding db"
This reverts commit 5b760f9.
1 parent 5b760f9 commit ebcf6b1

3 files changed

Lines changed: 8 additions & 20 deletions

File tree

server/src/com/cloud/upgrade/DatabaseCreator.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
import com.cloud.utils.PropertiesUtil;
3131

32-
import com.cloud.utils.component.ComponentContext;
3332
import com.cloud.utils.component.SystemIntegrityChecker;
3433
import com.cloud.utils.db.ScriptRunner;
3534
import com.cloud.utils.db.Transaction;
@@ -193,8 +192,6 @@ public static void main(String[] args) {
193192
}
194193
}
195194

196-
Transaction txn = Transaction.open(Transaction.CLOUD_DB);
197-
try {
198195
// Process db upgrade classes
199196
for (String upgradeClass: upgradeClasses) {
200197
System.out.println("========> Processing upgrade: " + upgradeClass);
@@ -205,22 +202,13 @@ public static void main(String[] args) {
205202
System.err.println("The class must be of SystemIntegrityChecker: " + clazz.getName());
206203
System.exit(1);
207204
}
208-
SystemIntegrityChecker checker = (SystemIntegrityChecker)clazz.newInstance();
209-
checker.check();
210205
} catch (ClassNotFoundException e) {
211206
System.err.println("Unable to find " + upgradeClass + ": " + e.getMessage());
212207
System.exit(1);
213-
} catch (InstantiationException e) {
214-
System.err.println("Unable to instantiate " + upgradeClass + ": " + e.getMessage());
215-
System.exit(1);
216-
} catch (IllegalAccessException e) {
217-
System.err.println("Unable to access " + upgradeClass + ": " + e.getMessage());
218-
System.exit(1);
219208
}
220209

221-
}
222-
} finally {
223-
txn.close();
210+
//SystemIntegrityChecker checker = (SystemIntegrityChecker)ComponentLocator.inject(clazz);
211+
//checker.check();
224212
}
225213
}
226214
}

server/src/com/cloud/upgrade/DatabaseUpgradeChecker.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.TreeMap;
3232

3333
import javax.ejb.Local;
34+
import javax.inject.Inject;
3435

3536
import org.apache.log4j.Logger;
3637

@@ -76,10 +77,9 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
7677

7778
protected HashMap<String, DbUpgrade[]> _upgradeMap = new HashMap<String, DbUpgrade[]>();
7879

79-
VersionDao _dao;
80+
@Inject VersionDao _dao;
8081

8182
public DatabaseUpgradeChecker() {
82-
_dao = new VersionDaoImpl();
8383
_upgradeMap.put("2.1.7", new DbUpgrade[] { new Upgrade217to218(), new Upgrade218to22(), new Upgrade221to222(),
8484
new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade224to225(), new Upgrade225to226(),
8585
new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
@@ -115,12 +115,12 @@ public DatabaseUpgradeChecker() {
115115

116116
_upgradeMap.put("2.2.4", new DbUpgrade[] { new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(),
117117
new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
118-
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
118+
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
119119
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420() });
120120

121121
_upgradeMap.put("2.2.5", new DbUpgrade[] { new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(),
122122
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
123-
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
123+
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
124124
new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420() });
125125

126126
_upgradeMap.put("2.2.6", new DbUpgrade[] { new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
@@ -159,7 +159,7 @@ public DatabaseUpgradeChecker() {
159159
_upgradeMap.put("3.0.1", new DbUpgrade[] { new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420() });
160160

161161
_upgradeMap.put("3.0.2", new DbUpgrade[] { new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420() });
162-
162+
163163
_upgradeMap.put("4.0.0", new DbUpgrade[] { new Upgrade40to41(), new Upgrade410to420() });
164164

165165
_upgradeMap.put("4.1.0", new DbUpgrade[] { new Upgrade410to420() });

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class VersionDaoImpl extends GenericDaoBase<VersionVO, Long> implements V
4747
final GenericSearchBuilder<VersionVO, String> CurrentVersionSearch;
4848
final SearchBuilder<VersionVO> AllFieldsSearch;
4949

50-
public VersionDaoImpl() {
50+
protected VersionDaoImpl() {
5151
super();
5252

5353
CurrentVersionSearch = createSearchBuilder(String.class);

0 commit comments

Comments
 (0)