@@ -1981,8 +1981,7 @@ private void orchestrateStorageMigration(final String vmUuid, final StoragePool
19811981
19821982 try {
19831983 if (s_logger .isDebugEnabled ()) {
1984- s_logger .debug (
1985- String .format ("Offline migration of %s vm %s with volumes" ,
1984+ s_logger .debug (String .format ("Offline migration of %s vm %s with volumes" ,
19861985 vm .getHypervisorType ().toString (),
19871986 vm .getInstanceName ()));
19881987 }
@@ -1992,20 +1991,21 @@ private void orchestrateStorageMigration(final String vmUuid, final StoragePool
19921991 } catch (ConcurrentOperationException
19931992 | InsufficientCapacityException // possibly InsufficientVirtualNetworkCapacityException or InsufficientAddressCapacityException
19941993 | StorageUnavailableException e ) {
1995- s_logger .debug ("Failed to migration: " + e .toString ());
1996- throw new CloudRuntimeException ("Failed to migration: " + e .toString ());
1994+ String msg = String .format ("Failed to migrate VM: %s" , vmUuid );
1995+ s_logger .debug (msg );
1996+ throw new CloudRuntimeException (msg , e );
19971997 } finally {
19981998 try {
19991999 stateTransitTo (vm , Event .AgentReportStopped , null );
20002000 } catch (final NoTransitionException e ) {
2001- s_logger .debug ("Failed to change vm state: " + e .toString ());
2002- throw new CloudRuntimeException ("Failed to change vm state: " + e .toString ());
2001+ String anotherMEssage = String .format ("failed to change vm state of VM: %s" , vmUuid );
2002+ s_logger .debug (anotherMEssage );
2003+ throw new CloudRuntimeException (anotherMEssage , e );
20032004 }
20042005 }
20052006 }
20062007
20072008 private Answer [] attemptHypervisorMigration (StoragePool destPool , VMInstanceVO vm ) {
2008- boolean migrationResult = false ;
20092009 final HypervisorGuru hvGuru = _hvGuruMgr .getGuru (vm .getHypervisorType ());
20102010 // OfflineVmwareMigration: in case of vmware call vcenter to do it for us.
20112011 // OfflineVmwareMigration: should we check the proximity of source and destination
@@ -2014,7 +2014,7 @@ private Answer[] attemptHypervisorMigration(StoragePool destPool, VMInstanceVO v
20142014 List <Command > commandsToSend = hvGuru .finalizeMigrate (vm , destPool );
20152015
20162016 Long hostId = vm .getHostId ();
2017- // OfflineVmwareMigration: probaby this is null when vm is stopped
2017+ // OfflineVmwareMigration: probably this is null when vm is stopped
20182018 if (hostId == null ) {
20192019 hostId = vm .getLastHostId ();
20202020 if (s_logger .isDebugEnabled ()) {
@@ -2027,17 +2027,17 @@ private Answer[] attemptHypervisorMigration(StoragePool destPool, VMInstanceVO v
20272027 try {
20282028 // OfflineVmwareMigration: change to the call back variety?
20292029 // OfflineVmwareMigration: getting a Long seq to be filled with _agentMgr.send(hostId, commandsContainer, this)
2030- Answer [] answers = _agentMgr .send (hostId , commandsContainer );
2031- return answers ;
2030+ return _agentMgr .send (hostId , commandsContainer );
20322031 } catch (AgentUnavailableException | OperationTimedoutException e ) {
2033- throw new CloudRuntimeException ("Failed to migration: " + e . toString () );
2032+ throw new CloudRuntimeException (String . format ( "Failed to migrate VM: %s" , vm . getUuid ()), e );
20342033 }
20352034 }
20362035 return null ;
20372036 }
20382037
20392038 private void afterHypervisorMigrationCleanup (StoragePool destPool , VMInstanceVO vm , HostVO srcHost , Long srcClusterId , Answer [] hypervisorMigrationResults ) throws InsufficientCapacityException {
2040- if (s_logger .isDebugEnabled ()) {
2039+ boolean isDebugEnabled = s_logger .isDebugEnabled ();
2040+ if (isDebugEnabled ) {
20412041 String msg = String .format ("cleaning up after hypervisor pool migration volumes for VM %s(%s) to pool %s(%s)" , vm .getInstanceName (), vm .getUuid (), destPool .getName (), destPool .getUuid ());
20422042 s_logger .debug (msg );
20432043 }
@@ -2046,7 +2046,7 @@ private void afterHypervisorMigrationCleanup(StoragePool destPool, VMInstanceVO
20462046 Long destPodId = destPool .getPodId ();
20472047 Long vmPodId = vm .getPodIdToDeployIn ();
20482048 if (destPodId == null || ! destPodId .equals (vmPodId )) {
2049- if (s_logger . isDebugEnabled () ) {
2049+ if (isDebugEnabled ) {
20502050 String msg = String .format ("resetting lasHost for VM %s(%s) as pod (%s) is no good." , vm .getInstanceName (), vm .getUuid (), destPodId );
20512051 s_logger .debug (msg );
20522052 }
@@ -2064,7 +2064,7 @@ private void markVolumesInPool(VMInstanceVO vm, StoragePool destPool, Answer[] h
20642064 MigrateVmToPoolAnswer relevantAnswer = null ;
20652065 for (Answer answer : hypervisorMigrationResults ) {
20662066 if (s_logger .isTraceEnabled ()) {
2067- s_logger .trace (String .format ("recieved an %s: %s" , answer .getClass ().getSimpleName (), answer ));
2067+ s_logger .trace (String .format ("received an %s: %s" , answer .getClass ().getSimpleName (), answer ));
20682068 }
20692069 if (answer instanceof MigrateVmToPoolAnswer ) {
20702070 relevantAnswer = (MigrateVmToPoolAnswer ) answer ;
@@ -2118,14 +2118,15 @@ private void preStorageMigrationStateCheck(StoragePool destPool, VMInstanceVO vm
21182118 try {
21192119 stateTransitTo (vm , Event .StorageMigrationRequested , null );
21202120 } catch (final NoTransitionException e ) {
2121- s_logger .debug ("Unable to migrate vm: " + e .toString ());
2122- throw new CloudRuntimeException ("Unable to migrate vm: " + e .toString ());
2121+ String msg = String .format ("Unable to migrate vm: %s" , vm .getUuid ());
2122+ s_logger .debug (msg );
2123+ throw new CloudRuntimeException (msg , e );
21232124 }
21242125 }
21252126
21262127 private void checkDestinationForTags (StoragePool destPool , VMInstanceVO vm ) {
21272128 List <VolumeVO > vols = _volsDao .findUsableVolumesForInstance (vm .getId ());
2128- // OfflineVmwareMigration: itterate over volumes
2129+ // OfflineVmwareMigration: iterate over volumes
21292130 // OfflineVmwareMigration: get disk offering
21302131 List <String > storageTags = storageMgr .getStoragePoolTagList (destPool .getId ());
21312132 for (Volume vol : vols ) {
0 commit comments