@@ -3546,38 +3546,26 @@ private void orchestrateMigrateAway(final String vmUuid, final long srcHostId, f
35463546 DataCenterDeployment plan = getMigrationDeployment (vm , host , poolId , excludes );
35473547
35483548 DeployDestination dest = null ;
3549- while (true ) {
3550-
3551- try {
3552- plan .setMigrationPlan (true );
3553- dest = _dpMgr .planDeployment (profile , plan , excludes , planner );
3554- } catch (final AffinityConflictException e2 ) {
3555- String message = String .format ("Unable to create deployment, affinity rules associated to the %s conflict." , vm .toString ());
3556- logger .warn (message , e2 );
3557- throw new CloudRuntimeException (message , e2 );
3558- }
3559- if (dest == null ) {
3560- logger .warn ("Unable to find destination for migrating the vm {}" , profile );
3561- throw new InsufficientServerCapacityException ("Unable to find a server to migrate to." , DataCenter .class , host .getDataCenterId ());
3562- }
3563- logger .debug ("Found destination {} for migrating to." , dest );
3564-
3565- excludes .addHost (dest .getHost ().getId ());
3566- try {
3567- migrate (vm , srcHostId , dest );
3568- return ;
3569- } catch (ResourceUnavailableException | ConcurrentOperationException e ) {
3570- logger .warn ("Unable to migrate {} to {} due to [{}]" , vm .toString (), dest .getHost ().toString (), e .getMessage (), e );
3571- }
3549+ try {
3550+ plan .setMigrationPlan (true );
3551+ dest = _dpMgr .planDeployment (profile , plan , excludes , planner );
3552+ } catch (final AffinityConflictException e2 ) {
3553+ String message = String .format ("Unable to create deployment, affinity rules associated to the %s conflict." , vm .toString ());
3554+ logger .warn (message , e2 );
3555+ throw new CloudRuntimeException (message , e2 );
3556+ }
3557+ if (dest == null ) {
3558+ logger .warn ("Unable to find destination for migrating the vm {}" , profile );
3559+ throw new InsufficientServerCapacityException ("Unable to find a server to migrate to." , DataCenter .class , host .getDataCenterId ());
3560+ }
3561+ logger .debug ("Found destination {} for migrating to." , dest );
35723562
3573- try {
3574- advanceStop (vmUuid , true );
3575- throw new CloudRuntimeException ("Unable to migrate " + vm );
3576- } catch (final ResourceUnavailableException | ConcurrentOperationException | OperationTimedoutException e ) {
3577- logger .error ("Unable to stop {} due to [{}]." , vm .toString (), e .getMessage (), e );
3578- throw new CloudRuntimeException ("Unable to migrate " + vm );
3579- }
3563+ try {
3564+ migrate (vm , srcHostId , dest );
3565+ } catch (ResourceUnavailableException | ConcurrentOperationException e ) {
3566+ logger .warn ("Unable to migrate {} to {} due to [{}]" , vm .toString (), dest .getHost ().toString (), e .getMessage (), e );
35803567 }
3568+
35813569 }
35823570
35833571 /**
0 commit comments