@@ -176,7 +176,7 @@ protected HostVO getLastVMHypervisorHost(VirtualMachine vm) {
176176 List <HostVO > altClusterHosts = hostDao .findHypervisorHostInCluster (host .getClusterId ());
177177 for (final HostVO candidateClusterHost : altClusterHosts ) {
178178 if ( candidateClusterHost .getStatus () == Status .Up ) {
179- LOG .debug (String . format ( "Found Host %s " , candidateClusterHost ) );
179+ LOG .debug ("Found Host {} " , candidateClusterHost );
180180 return candidateClusterHost ;
181181 }
182182 }
@@ -185,7 +185,7 @@ protected HostVO getLastVMHypervisorHost(VirtualMachine vm) {
185185 List <HostVO > altZoneHosts = hostDao .findByDataCenterId (host .getDataCenterId ());
186186 for (final HostVO candidateZoneHost : altZoneHosts ) {
187187 if ( candidateZoneHost .getStatus () == Status .Up && candidateZoneHost .getHypervisorType () == Hypervisor .HypervisorType .KVM ) {
188- LOG .debug ("Found Host " + candidateZoneHost );
188+ LOG .debug ("Found Host {}" , candidateZoneHost );
189189 return candidateZoneHost ;
190190 }
191191 }
@@ -236,13 +236,13 @@ private String executeBackupCommand(HostVO host, String username, String passwor
236236 Pair <Boolean , String > response = SshHelper .sshExecute (host .getPrivateIpAddress (), 22 ,
237237 username , null , password , command , 120000 , 120000 , 3600000 );
238238 if (!response .first ()) {
239- LOG .error (String . format ( "Backup Script failed on HYPERVISOR %s due to: %s " , host , response .second () ));
239+ LOG .error ("Backup Script failed on HYPERVISOR {} due to: {} " , host , response .second ());
240240 } else {
241- LOG .debug (String . format ( "Networker Backup Results: %s " , response .second () ));
241+ LOG .debug ("Networker Backup Results: {} " , response .second ());
242242 }
243243 Matcher saveTimeMatcher = saveTimePattern .matcher (response .second ());
244244 if (saveTimeMatcher .find ()) {
245- LOG .debug (String . format ( "Got saveTimeMatcher: %s " , saveTimeMatcher .group (1 ) ));
245+ LOG .debug ("Got saveTimeMatcher: {} " , saveTimeMatcher .group (1 ));
246246 return saveTimeMatcher .group (1 );
247247 }
248248 } catch (final Exception e ) {
@@ -258,9 +258,9 @@ private boolean executeRestoreCommand(HostVO host, String username, String passw
258258 username , null , password , command , 120000 , 120000 , 3600000 );
259259
260260 if (!response .first ()) {
261- LOG .error (String . format ( "Restore Script failed on HYPERVISOR %s due to: %s " , host , response .second () ));
261+ LOG .error ("Restore Script failed on HYPERVISOR {} due to: {} " , host , response .second ());
262262 } else {
263- LOG .debug (String . format ( "Networker Restore Results: %s " ,response .second () ));
263+ LOG .debug ("Networker Restore Results: {} " ,response .second ());
264264 return true ;
265265 }
266266 } catch (final Exception e ) {
@@ -317,7 +317,7 @@ public boolean removeVMFromBackupOffering(VirtualMachine vm) {
317317 List <String > backupsTaken = getClient (vm .getDataCenterId ()).getBackupsForVm (vm );
318318
319319 for (String backupId : backupsTaken ) {
320- LOG .debug ("Trying to remove backup with id" + backupId );
320+ LOG .debug ("Trying to remove backup with id {}" , backupId );
321321 getClient (vm .getDataCenterId ()).deleteBackupForVM (backupId );
322322 }
323323
@@ -334,18 +334,18 @@ public boolean restoreVMFromBackup(VirtualMachine vm, Backup backup) {
334334 final NetworkerBackup networkerBackup =getClient (zoneId ).getNetworkerBackupInfo (externalBackupId );
335335 final String SSID = networkerBackup .getShortId ();
336336
337- LOG .debug (String . format ( "Restoring vm %s from backup %s on the Networker Backup Provider" , vm , backup ) );
337+ LOG .debug ("Restoring vm {} from backup {} on the Networker Backup Provider" , vm , backup );
338338
339339 if ( SSID .isEmpty () ) {
340- LOG .debug ("There was an error retrieving the SSID for backup with id " + externalBackupId + " from EMC NEtworker" );
340+ LOG .debug ("There was an error retrieving the SSID for backup with id {} from EMC NEtworker" , externalBackupId );
341341 return false ;
342342 }
343343
344344 // Find where the VM was last running
345345 hostVO = getLastVMHypervisorHost (vm );
346346 // Get credentials for that host
347347 Ternary <String , String , String > credentials = getKVMHyperisorCredentials (hostVO );
348- LOG .debug ("The SSID was reported successfully " + externalBackupId );
348+ LOG .debug ("The SSID was reported successfully {}" , externalBackupId );
349349 try {
350350 networkerServer = getUrlDomain (NetworkerUrl .value ());
351351 } catch (URISyntaxException e ) {
@@ -362,14 +362,14 @@ public boolean restoreVMFromBackup(VirtualMachine vm, Backup backup) {
362362 script .add ("-v" );
363363
364364 Date restoreJobStart = new Date ();
365- LOG .debug (String . format ( "Starting Restore for VM %s and %s at %s " , vm , SSID , restoreJobStart ) );
365+ LOG .debug ("Starting Restore for VM {} and {} at {} " , vm , SSID , restoreJobStart );
366366
367367 if ( executeRestoreCommand (hostVO , credentials .first (), credentials .second (), script .toString ()) ) {
368368 Date restoreJobEnd = new Date ();
369- LOG .debug ("Restore Job for SSID " + SSID + " completed successfully at " + restoreJobEnd );
369+ LOG .debug ("Restore Job for SSID {} completed successfully at {}" , SSID , restoreJobEnd );
370370 return true ;
371371 } else {
372- LOG .debug ("Restore Job for SSID " + SSID + " failed!" );
372+ LOG .debug ("Restore Job for SSID {} failed!" , SSID );
373373 return false ;
374374 }
375375 }
@@ -390,7 +390,7 @@ public Pair<Boolean, String> restoreBackedUpVolume(Backup backup, String volumeU
390390 final String destinationNetworkerClient = hostVO .getName ().split ("\\ ." )[0 ];
391391 Long restoredVolumeDiskSize = 0L ;
392392
393- LOG .debug (String . format ( "Restoring volume %s with uuid %s from backup %s on the Networker Backup Provider" , volume , volumeUuid , backup ) );
393+ LOG .debug ("Restoring volume {} with uuid {} from backup {} on the Networker Backup Provider" , volume , volumeUuid , backup );
394394
395395 if ( SSID .isEmpty () ) {
396396 LOG .debug ("There was an error retrieving the SSID for backup with id " + externalBackupId + " from EMC NEtworker" );
@@ -543,8 +543,8 @@ public boolean deleteBackup(Backup backup, boolean forced) {
543543 @ Override
544544 public Map <VirtualMachine , Backup .Metric > getBackupMetrics (Long zoneId , List <VirtualMachine > vms ) {
545545 final Map <VirtualMachine , Backup .Metric > metrics = new HashMap <>();
546- Long vmBackupSize =0L ;
547- Long vmBackupProtectedSize =0L ;
546+ long vmBackupSize =0L ;
547+ long vmBackupProtectedSize =0L ;
548548
549549 if (CollectionUtils .isEmpty (vms )) {
550550 LOG .warn ("Unable to get VM Backup Metrics because the list of VMs is empty." );
@@ -577,7 +577,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
577577 final ArrayList <String > backupsInNetworker = getClient (zoneId ).getBackupsForVm (vm );
578578 final List <Long > removeList = backupsInDb .stream ().map (InternalIdentity ::getId ).collect (Collectors .toList ());
579579 for (final String networkerBackupId : backupsInNetworker ) {
580- Long vmBackupSize =0L ;
580+ long vmBackupSize =0L ;
581581 boolean backupExists = false ;
582582 for (final Backup backupInDb : backupsInDb ) {
583583 LOG .debug (String .format ("Checking if Backup %s with external ID %s for VM %s is valid" , backupsInDb , backupInDb .getName (), vm ));
@@ -671,7 +671,7 @@ public Backup createNewBackupEntryForRestorePoint(Backup.RestorePoint restorePoi
671671 throw new CloudRuntimeException (msg , e );
672672 }
673673 backup .setStatus (Backup .Status .BackedUp );
674- Long vmBackupProtectedSize =0L ;
674+ long vmBackupProtectedSize =0L ;
675675 for (Backup .VolumeInfo thisVMVol : vm .getBackupVolumeList ()) {
676676 vmBackupProtectedSize += (thisVMVol .getSize () / 1024L / 1024L );
677677 }
@@ -692,9 +692,7 @@ public Backup createNewBackupEntryForRestorePoint(Backup.RestorePoint restorePoi
692692 public List <Backup .RestorePoint > listRestorePoints (VirtualMachine vm ) {
693693 final Long zoneId = vm .getDataCenterId ();
694694 final ArrayList <String > backupIds = getClient (zoneId ).getBackupsForVm (vm );
695- List <Backup .RestorePoint > restorePoints =
696- backupIds .stream ().map (id -> new Backup .RestorePoint (id , null , null )).collect (Collectors .toList ());
697- return restorePoints ;
695+ return backupIds .stream ().map (id -> new Backup .RestorePoint (id , null , null )).collect (Collectors .toList ());
698696 }
699697
700698 @ Override
0 commit comments