@@ -3053,7 +3053,7 @@ private void orchestrateMigrate(final String vmUuid, final long srcHostId, final
30533053 }
30543054
30553055 protected void migrate (final VMInstanceVO vm , final long srcHostId , final DeployDestination dest ) throws ResourceUnavailableException , ConcurrentOperationException {
3056- logger .info ("Migrating {} to {}" , vm , dest );
3056+ logger .info ("Start preparing migration of the VM: {} to {}" , vm , dest );
30573057 final long dstHostId = dest .getHost ().getId ();
30583058 final Host fromHost = _hostDao .findById (srcHostId );
30593059 if (fromHost == null ) {
@@ -3118,9 +3118,11 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
31183118 if (pfma == null || !pfma .getResult ()) {
31193119 final String details = pfma != null ? pfma .getDetails () : "null answer returned" ;
31203120 final String msg = "Unable to prepare for migration due to " + details ;
3121+ logger .error ("Failed to prepare destination host {} for migration of VM {} : {}" , dstHostId , vm .getInstanceName (), details );
31213122 pfma = null ;
31223123 throw new AgentUnavailableException (msg , dstHostId );
31233124 }
3125+ logger .debug ("Successfully prepared destination host {} for migration of VM {} " , dstHostId , vm .getInstanceName ());
31243126 } catch (final OperationTimedoutException e1 ) {
31253127 throw new AgentUnavailableException ("Operation timed out" , dstHostId );
31263128 } finally {
@@ -3141,18 +3143,23 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
31413143 volumeMgr .release (vm .getId (), dstHostId );
31423144 }
31433145
3144- logger .info ("Migration cancelled because state has changed: {}" , vm );
3145- throw new ConcurrentOperationException ("Migration cancelled because state has changed: " + vm );
3146+ String msg = "Migration cancelled because state has changed: " + vm ;
3147+ logger .warn (msg );
3148+ throw new ConcurrentOperationException (msg );
31463149 }
31473150 } catch (final NoTransitionException e1 ) {
31483151 _networkMgr .rollbackNicForMigration (vmSrc , profile );
31493152 volumeMgr .release (vm .getId (), dstHostId );
3150- logger .info ("Migration cancelled because {}" , e1 .getMessage ());
3153+ String msg = String .format ("Migration cancelled for VM %s due to state transition failure: %s" ,
3154+ vm .getInstanceName (), e1 .getMessage ());
3155+ logger .warn (msg , e1 );
31513156 throw new ConcurrentOperationException ("Migration cancelled because " + e1 .getMessage ());
31523157 } catch (final CloudRuntimeException e2 ) {
31533158 _networkMgr .rollbackNicForMigration (vmSrc , profile );
31543159 volumeMgr .release (vm .getId (), dstHostId );
3155- logger .info ("Migration cancelled because {}" , e2 .getMessage ());
3160+ String msg = String .format ("Migration cancelled for VM %s due to runtime exception: %s" ,
3161+ vm .getInstanceName (), e2 .getMessage ());
3162+ logger .error (msg , e2 );
31563163 work .setStep (Step .Done );
31573164 _workDao .update (work .getId (), work );
31583165 try {
@@ -3172,8 +3179,12 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
31723179 final Answer ma = _agentMgr .send (vm .getLastHostId (), mc );
31733180 if (ma == null || !ma .getResult ()) {
31743181 final String details = ma != null ? ma .getDetails () : "null answer returned" ;
3182+ String msg = String .format ("Migration command failed for VM %s on source host id=%s to destination host %s: %s" ,
3183+ vm .getInstanceName (), vm .getLastHostId (), dstHostId , details );
3184+ logger .error (msg );
31753185 throw new CloudRuntimeException (details );
31763186 }
3187+ logger .info ("Migration command successful for VM {}" , vm .getInstanceName ());
31773188 } catch (final OperationTimedoutException e ) {
31783189 boolean success = false ;
31793190 if (HypervisorType .KVM .equals (vm .getHypervisorType ())) {
@@ -3210,7 +3221,7 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
32103221
32113222 try {
32123223 if (!checkVmOnHost (vm , dstHostId )) {
3213- logger .error ("Unable to complete migration for {} " , vm );
3224+ logger .error ("Migration verification failed for VM {} : VM not found on destination host {} " , vm . getInstanceName (), dstHostId );
32143225 try {
32153226 _agentMgr .send (srcHostId , new Commands (cleanup (vm , dpdkInterfaceMapping )), null );
32163227 } catch (final AgentUnavailableException e ) {
@@ -3225,7 +3236,7 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
32253236 migrated = true ;
32263237 } finally {
32273238 if (!migrated ) {
3228- logger .info ("Migration was unsuccessful. Cleaning up: {}" , vm );
3239+ logger .info ("Migration was unsuccessful. Cleaning up: {}" , vm );
32293240 _networkMgr .rollbackNicForMigration (vmSrc , profile );
32303241 volumeMgr .release (vm .getId (), dstHostId );
32313242 // deallocate GPU devices for the VM on the destination host
@@ -3237,7 +3248,7 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
32373248 try {
32383249 _agentMgr .send (dstHostId , new Commands (cleanup (vm , dpdkInterfaceMapping )), null );
32393250 } catch (final AgentUnavailableException ae ) {
3240- logger .warn ("Looks like the destination Host is unavailable for cleanup" , ae );
3251+ logger .warn ("Destination host {} unavailable for cleanup after failed migration of VM {}" , dstHostId , vm . getInstanceName () , ae );
32413252 }
32423253 _networkMgr .setHypervisorHostname (profile , dest , false );
32433254 try {
@@ -3246,6 +3257,7 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
32463257 logger .warn (e .getMessage ());
32473258 }
32483259 } else {
3260+ logger .info ("Migration completed successfully for VM %s" + vm );
32493261 _networkMgr .commitNicForMigration (vmSrc , profile );
32503262 volumeMgr .release (vm .getId (), srcHostId );
32513263 // deallocate GPU devices for the VM on the src host after migration is complete
@@ -3276,6 +3288,7 @@ protected MigrateCommand buildMigrateCommand(VMInstanceVO vmInstance, VirtualMac
32763288 migrateCommand .setVlanToPersistenceMap (vlanToPersistenceMap );
32773289 }
32783290
3291+ logger .debug ("Setting auto convergence to: {}" , StorageManager .KvmAutoConvergence .value ());
32793292 migrateCommand .setAutoConvergence (StorageManager .KvmAutoConvergence .value ());
32803293 migrateCommand .setHostGuid (destination .getHost ().getGuid ());
32813294
0 commit comments