8989import com .cloud .upgrade .dao .Upgrade41910to42000 ;
9090import com .cloud .upgrade .dao .Upgrade42000to42010 ;
9191import com .cloud .upgrade .dao .Upgrade42010to42100 ;
92- import com .cloud .upgrade .dao .Upgrade420to421 ;
9392import com .cloud .upgrade .dao .Upgrade42100to42200 ;
93+ import com .cloud .upgrade .dao .Upgrade42200to42210 ;
94+ import com .cloud .upgrade .dao .Upgrade420to421 ;
9495import com .cloud .upgrade .dao .Upgrade421to430 ;
95- import com .cloud .upgrade .dao .Upgrade42200to42300 ;
96+ import com .cloud .upgrade .dao .Upgrade42210to42300 ;
9697import com .cloud .upgrade .dao .Upgrade430to440 ;
9798import com .cloud .upgrade .dao .Upgrade431to440 ;
9899import com .cloud .upgrade .dao .Upgrade432to440 ;
@@ -237,7 +238,8 @@ public DatabaseUpgradeChecker() {
237238 .next ("4.20.0.0" , new Upgrade42000to42010 ())
238239 .next ("4.20.1.0" , new Upgrade42010to42100 ())
239240 .next ("4.21.0.0" , new Upgrade42100to42200 ())
240- .next ("4.22.0.0" , new Upgrade42200to42300 ())
241+ .next ("4.22.0.0" , new Upgrade42200to42210 ())
242+ .next ("4.22.1.0" , new Upgrade42210to42300 ())
241243 .build ();
242244 }
243245
@@ -315,20 +317,20 @@ protected void upgrade(CloudStackVersion dbVersion, CloudStackVersion currentVer
315317 }
316318
317319 protected void executeProcedureScripts () {
318- LOGGER .info (String . format ( "Executing Stored Procedure scripts that are under resource directory [%s ]." , PROCEDURES_DIRECTORY ) );
320+ LOGGER .info ("Executing Stored Procedure scripts that are under resource directory [{} ]." , PROCEDURES_DIRECTORY );
319321 List <String > filesPathUnderViewsDirectory = FileUtil .getFilesPathsUnderResourceDirectory (PROCEDURES_DIRECTORY );
320322
321323 try (TransactionLegacy txn = TransactionLegacy .open ("execute-procedure-scripts" )) {
322324 Connection conn = txn .getConnection ();
323325
324326 for (String filePath : filesPathUnderViewsDirectory ) {
325- LOGGER .debug (String . format ( "Executing PROCEDURE script [%s ]." , filePath ) );
327+ LOGGER .debug ("Executing PROCEDURE script [{} ]." , filePath );
326328
327329 InputStream viewScript = Thread .currentThread ().getContextClassLoader ().getResourceAsStream (filePath );
328330 runScript (conn , viewScript );
329331 }
330332
331- LOGGER .info (String . format ( "Finished execution of PROCEDURE scripts that are under resource directory [%s ]." , PROCEDURES_DIRECTORY ) );
333+ LOGGER .info ("Finished execution of PROCEDURE scripts that are under resource directory [{} ]." , PROCEDURES_DIRECTORY );
332334 } catch (SQLException e ) {
333335 String message = String .format ("Unable to execute PROCEDURE scripts due to [%s]." , e .getMessage ());
334336 LOGGER .error (message , e );
@@ -337,7 +339,7 @@ protected void executeProcedureScripts() {
337339 }
338340
339341 private DbUpgrade [] executeUpgrades (CloudStackVersion dbVersion , CloudStackVersion currentVersion ) {
340- LOGGER .info ("Database upgrade must be performed from " + dbVersion + " to " + currentVersion );
342+ LOGGER .info ("Database upgrade must be performed from {} to {}" , dbVersion , currentVersion );
341343
342344 final DbUpgrade [] upgrades = calculateUpgradePath (dbVersion , currentVersion );
343345
@@ -350,8 +352,8 @@ private DbUpgrade[] executeUpgrades(CloudStackVersion dbVersion, CloudStackVersi
350352
351353 private VersionVO executeUpgrade (DbUpgrade upgrade ) {
352354 VersionVO version ;
353- LOGGER .debug ("Running upgrade " + upgrade .getClass ().getSimpleName () + " to upgrade from " + upgrade .getUpgradableVersionRange ()[0 ] + "-" + upgrade
354- .getUpgradableVersionRange ()[1 ] + " to " + upgrade .getUpgradedVersion ());
355+ LOGGER .debug ("Running upgrade {} to upgrade from {}-{} to {}" , upgrade .getClass ().getSimpleName (), upgrade .getUpgradableVersionRange ()[0 ], upgrade
356+ .getUpgradableVersionRange ()[1 ], upgrade .getUpgradedVersion ());
355357 TransactionLegacy txn = TransactionLegacy .open ("Upgrade" );
356358 txn .start ();
357359 try {
@@ -394,8 +396,8 @@ private void executeUpgradeCleanup(DbUpgrade upgrade, VersionVO version) {
394396 // Run the corresponding '-cleanup.sql' script
395397 txn = TransactionLegacy .open ("Cleanup" );
396398 try {
397- LOGGER .info ("Cleanup upgrade " + upgrade .getClass ().getSimpleName () + " to upgrade from " + upgrade .getUpgradableVersionRange ()[0 ] + "-" + upgrade
398- .getUpgradableVersionRange ()[1 ] + " to " + upgrade .getUpgradedVersion ());
399+ LOGGER .info ("Cleanup upgrade {} to upgrade from {}-{} to {}" , upgrade .getClass ().getSimpleName (), upgrade .getUpgradableVersionRange ()[0 ], upgrade
400+ .getUpgradableVersionRange ()[1 ], upgrade .getUpgradedVersion ());
399401
400402 txn .start ();
401403 Connection conn ;
@@ -410,7 +412,7 @@ private void executeUpgradeCleanup(DbUpgrade upgrade, VersionVO version) {
410412 if (scripts != null ) {
411413 for (InputStream script : scripts ) {
412414 runScript (conn , script );
413- LOGGER .debug ("Cleanup script " + upgrade .getClass ().getSimpleName () + " is executed successfully" );
415+ LOGGER .debug ("Cleanup script {} is executed successfully" , upgrade .getClass ().getSimpleName ());
414416 }
415417 }
416418 txn .commit ();
@@ -420,27 +422,27 @@ private void executeUpgradeCleanup(DbUpgrade upgrade, VersionVO version) {
420422 version .setUpdated (new Date ());
421423 _dao .update (version .getId (), version );
422424 txn .commit ();
423- LOGGER .debug ("Upgrade completed for version " + version .getVersion ());
425+ LOGGER .debug ("Upgrade completed for version {}" , version .getVersion ());
424426 } finally {
425427 txn .close ();
426428 }
427429 }
428430
429431 protected void executeViewScripts () {
430- LOGGER .info (String . format ( "Executing VIEW scripts that are under resource directory [%s ]." , VIEWS_DIRECTORY ) );
432+ LOGGER .info ("Executing VIEW scripts that are under resource directory [{} ]." , VIEWS_DIRECTORY );
431433 List <String > filesPathUnderViewsDirectory = FileUtil .getFilesPathsUnderResourceDirectory (VIEWS_DIRECTORY );
432434
433435 try (TransactionLegacy txn = TransactionLegacy .open ("execute-view-scripts" )) {
434436 Connection conn = txn .getConnection ();
435437
436438 for (String filePath : filesPathUnderViewsDirectory ) {
437- LOGGER .debug (String . format ( "Executing VIEW script [%s ]." , filePath ) );
439+ LOGGER .debug ("Executing VIEW script [{} ]." , filePath );
438440
439441 InputStream viewScript = Thread .currentThread ().getContextClassLoader ().getResourceAsStream (filePath );
440442 runScript (conn , viewScript );
441443 }
442444
443- LOGGER .info (String . format ( "Finished execution of VIEW scripts that are under resource directory [%s ]." , VIEWS_DIRECTORY ) );
445+ LOGGER .info ("Finished execution of VIEW scripts that are under resource directory [{} ]." , VIEWS_DIRECTORY );
444446 } catch (SQLException e ) {
445447 String message = String .format ("Unable to execute VIEW scripts due to [%s]." , e .getMessage ());
446448 LOGGER .error (message , e );
@@ -470,10 +472,10 @@ public void check() {
470472 String csVersion = SystemVmTemplateRegistration .parseMetadataFile ();
471473 final CloudStackVersion sysVmVersion = CloudStackVersion .parse (csVersion );
472474 final CloudStackVersion currentVersion = CloudStackVersion .parse (currentVersionValue );
473- SystemVmTemplateRegistration .CS_MAJOR_VERSION = String . valueOf ( sysVmVersion .getMajorRelease ()) + "." + String . valueOf ( sysVmVersion .getMinorRelease () );
475+ SystemVmTemplateRegistration .CS_MAJOR_VERSION = sysVmVersion .getMajorRelease () + "." + sysVmVersion .getMinorRelease ();
474476 SystemVmTemplateRegistration .CS_TINY_VERSION = String .valueOf (sysVmVersion .getPatchRelease ());
475477
476- LOGGER .info ("DB version = " + dbVersion + " Code Version = " + currentVersion );
478+ LOGGER .info ("DB version = {} Code Version = {}" , dbVersion , currentVersion );
477479
478480 if (dbVersion .compareTo (currentVersion ) > 0 ) {
479481 throw new CloudRuntimeException ("Database version " + dbVersion + " is higher than management software version " + currentVersionValue );
@@ -522,7 +524,7 @@ private void decryptInit(Connection conn) throws SQLException {
522524 ResultSet result = pstmt .executeQuery ()) {
523525 if (result .next ()) {
524526 String init = result .getString (1 );
525- LOGGER .info ("init = " + DBEncryptionUtil .decrypt (init ));
527+ LOGGER .info ("init = {}" , DBEncryptionUtil .decrypt (init ));
526528 }
527529 }
528530 }
@@ -553,21 +555,11 @@ public String getUpgradedVersion() {
553555 return upgradedVersion ;
554556 }
555557
556- @ Override
557- public boolean supportsRollingUpgrade () {
558- return false ;
559- }
560-
561558 @ Override
562559 public InputStream [] getPrepareScripts () {
563560 return new InputStream [0 ];
564561 }
565562
566- @ Override
567- public void performDataMigration (Connection conn ) {
568-
569- }
570-
571563 @ Override
572564 public InputStream [] getCleanupScripts () {
573565 return new InputStream [0 ];
0 commit comments