File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed
engine/schema/src/main/java/com/cloud/upgrade Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -451,15 +451,15 @@ public void check() {
451451 throw new CloudRuntimeException ("Unable to acquire lock to check for database integrity." );
452452 }
453453
454- // not sure about the right moment to do this yet
455- checkIfStandalone ( );
456- doUpgrades ( lock );
454+ if ( isStandalone ()) {
455+ doUpgrades ( lock );
456+ }
457457 } finally {
458458 lock .releaseRef ();
459459 }
460460 }
461- private void checkIfStandalone () throws CloudRuntimeException {
462- boolean standalone = Transaction .execute (new TransactionCallback <>() {
461+ private boolean isStandalone () throws CloudRuntimeException {
462+ return Transaction .execute (new TransactionCallback <>() {
463463 @ Override
464464 public Boolean doInTransaction (TransactionStatus status ) {
465465 String sql = "SELECT COUNT(*) FROM `cloud`.`mshost` WHERE `state` = 'UP'" ;
@@ -473,16 +473,11 @@ public Boolean doInTransaction(TransactionStatus status) {
473473 } catch (SQLException e ) {
474474 String errorMessage = "Unable to check if the management server is running in standalone mode." ;
475475 LOGGER .error (errorMessage , e );
476- throw new CloudRuntimeException ( errorMessage , e ) ;
476+ return false ;
477477 }
478478 return true ;
479479 }
480480 });
481- if (! standalone ) {
482- String msg = "CloudStack is running multiple management servers while attempting to upgrade. Upgrades can only be run in standalone mode. Aborting." ;
483- LOGGER .info (msg );
484- throw new CloudRuntimeException (msg );
485- }
486481 }
487482
488483 private void doUpgrades (GlobalLock lock ) {
You can’t perform that action at this time.
0 commit comments