@@ -3065,7 +3065,7 @@ private void orchestrateMigrate(final String vmUuid, final long srcHostId, final
30653065 }
30663066
30673067 protected void migrate (final VMInstanceVO vm , final long srcHostId , final DeployDestination dest ) throws ResourceUnavailableException , ConcurrentOperationException {
3068- logger .info ("Migrating {} to {}" , vm , dest );
3068+ logger .info ("Start preparing migration of the VM: {} to {}" , vm , dest );
30693069 final long dstHostId = dest .getHost ().getId ();
30703070 final Host fromHost = _hostDao .findById (srcHostId );
30713071 String provider = "" ;
@@ -3131,9 +3131,11 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
31313131 if (pfma == null || !pfma .getResult ()) {
31323132 final String details = pfma != null ? pfma .getDetails () : "null answer returned" ;
31333133 final String msg = "Unable to prepare for migration due to " + details ;
3134+ logger .error ("Failed to prepare destination host {} for migration of VM {} : {}" , dstHostId , vm .getInstanceName (), details );
31343135 pfma = null ;
31353136 throw new AgentUnavailableException (msg , dstHostId );
31363137 }
3138+ logger .debug ("Successfully prepared destination host {} for migration of VM {} " , dstHostId , vm .getInstanceName ());
31373139 } catch (final OperationTimedoutException e1 ) {
31383140 throw new AgentUnavailableException ("Operation timed out" , dstHostId );
31393141 } finally {
@@ -3154,18 +3156,23 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
31543156 volumeMgr .release (vm .getId (), dstHostId );
31553157 }
31563158
3157- logger .info ("Migration cancelled because state has changed: {}" , vm );
3158- throw new ConcurrentOperationException ("Migration cancelled because state has changed: " + vm );
3159+ String msg = "Migration cancelled because state has changed: " + vm ;
3160+ logger .warn (msg );
3161+ throw new ConcurrentOperationException (msg );
31593162 }
31603163 } catch (final NoTransitionException e1 ) {
31613164 _networkMgr .rollbackNicForMigration (vmSrc , profile );
31623165 volumeMgr .release (vm .getId (), dstHostId );
3163- logger .info ("Migration cancelled because {}" , e1 .getMessage ());
3166+ String msg = String .format ("Migration cancelled for VM %s due to state transition failure: %s" ,
3167+ vm .getInstanceName (), e1 .getMessage ());
3168+ logger .warn (msg , e1 );
31643169 throw new ConcurrentOperationException ("Migration cancelled because " + e1 .getMessage ());
31653170 } catch (final CloudRuntimeException e2 ) {
31663171 _networkMgr .rollbackNicForMigration (vmSrc , profile );
31673172 volumeMgr .release (vm .getId (), dstHostId );
3168- logger .info ("Migration cancelled because {}" , e2 .getMessage ());
3173+ String msg = String .format ("Migration cancelled for VM %s due to runtime exception: %s" ,
3174+ vm .getInstanceName (), e2 .getMessage ());
3175+ logger .error (msg , e2 );
31693176 work .setStep (Step .Done );
31703177 _workDao .update (work .getId (), work );
31713178 try {
@@ -3185,8 +3192,12 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
31853192 final Answer ma = _agentMgr .send (vm .getLastHostId (), mc );
31863193 if (ma == null || !ma .getResult ()) {
31873194 final String details = ma != null ? ma .getDetails () : "null answer returned" ;
3195+ String msg = String .format ("Migration command failed for VM %s on source host id=%s to destination host %s: %s" ,
3196+ vm .getInstanceName (), vm .getLastHostId (), dstHostId , details );
3197+ logger .error (msg );
31883198 throw new CloudRuntimeException (details );
31893199 }
3200+ logger .info ("Migration command successful for VM {}" , vm .getInstanceName ());
31903201 } catch (final OperationTimedoutException e ) {
31913202 boolean success = false ;
31923203 if (HypervisorType .KVM .equals (vm .getHypervisorType ())) {
@@ -3223,7 +3234,7 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
32233234
32243235 try {
32253236 if (!checkVmOnHost (vm , dstHostId )) {
3226- logger .error ("Unable to complete migration for {} " , vm );
3237+ logger .error ("Migration verification failed for VM {} : VM not found on destination host {} " , vm . getInstanceName (), dstHostId );
32273238 try {
32283239 _agentMgr .send (srcHostId , new Commands (cleanup (vm , dpdkInterfaceMapping )), null );
32293240 } catch (final AgentUnavailableException e ) {
@@ -3238,7 +3249,7 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
32383249 migrated = true ;
32393250 } finally {
32403251 if (!migrated ) {
3241- logger .info ("Migration was unsuccessful. Cleaning up: {}" , vm );
3252+ logger .info ("Migration was unsuccessful. Cleaning up: {}" , vm );
32423253 _networkMgr .rollbackNicForMigration (vmSrc , profile );
32433254 volumeMgr .release (vm .getId (), dstHostId );
32443255 // deallocate GPU devices for the VM on the destination host
@@ -3250,7 +3261,7 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
32503261 try {
32513262 _agentMgr .send (dstHostId , new Commands (cleanup (vm , dpdkInterfaceMapping )), null );
32523263 } catch (final AgentUnavailableException ae ) {
3253- logger .warn ("Looks like the destination Host is unavailable for cleanup" , ae );
3264+ logger .warn ("Destination host {} unavailable for cleanup after failed migration of VM {}" , dstHostId , vm . getInstanceName () , ae );
32543265 }
32553266 _networkMgr .setHypervisorHostname (profile , dest , false );
32563267 try {
@@ -3259,6 +3270,7 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
32593270 logger .warn (e .getMessage ());
32603271 }
32613272 } else {
3273+ logger .info ("Migration completed successfully for VM %s" + vm );
32623274 _networkMgr .commitNicForMigration (vmSrc , profile );
32633275 volumeMgr .release (vm .getId (), srcHostId );
32643276 // deallocate GPU devices for the VM on the src host after migration is complete
@@ -3294,6 +3306,7 @@ protected MigrateCommand buildMigrateCommand(VMInstanceVO vmInstance, VirtualMac
32943306 migrateCommand .setVlanToPersistenceMap (vlanToPersistenceMap );
32953307 }
32963308
3309+ logger .debug ("Setting auto convergence to: {}" , StorageManager .KvmAutoConvergence .value ());
32973310 migrateCommand .setAutoConvergence (StorageManager .KvmAutoConvergence .value ());
32983311 migrateCommand .setHostGuid (destination .getHost ().getGuid ());
32993312
0 commit comments