Skip to content

Commit 2135e1e

Browse files
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 46a6f7a commit 2135e1e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,13 +462,13 @@ private void checkIfStandalone() throws CloudRuntimeException {
462462
boolean standalone = Transaction.execute(new TransactionCallback<>() {
463463
@Override
464464
public Boolean doInTransaction(TransactionStatus status) {
465-
String sql = "SELECT COUNT(*) FROM `cloud`.`mshosts` WHERE `state` = 'UP'";
466-
try (Connection conn = TransactionLegacy.getStandaloneConnection();
465+
String sql = "SELECT COUNT(*) FROM `cloud`.`mshost` WHERE `state` = 'UP'";
466+
try (Connection conn = TransactionLegacy.getStandaloneConnection();
467467
PreparedStatement pstmt = conn.prepareStatement(sql);
468468
ResultSet rs = pstmt.executeQuery()) {
469469
if (rs.next()) {
470470
int count = rs.getInt(1);
471-
return count = 0;
471+
return count == 0;
472472
}
473473
} catch (SQLException e) {
474474
String errorMessage = "Unable to check if the management server is running in standalone mode.";
@@ -479,7 +479,7 @@ public Boolean doInTransaction(TransactionStatus status) {
479479
}
480480
});
481481
if (! standalone) {
482-
String msg = "CloudStack is running multiple management servers and attempting to upgrade. Upgrades can only be run in standalone mode. Skipping database upgrade check.";
482+
String msg = "CloudStack is running multiple management servers while attempting to upgrade. Upgrades can only be run in standalone mode. Aborting.";
483483
LOGGER.info(msg);
484484
throw new CloudRuntimeException(msg);
485485
}

0 commit comments

Comments
 (0)