Program: 14277
Project: 14277
Buggy source:
/** 
 * <ol> <li> Mark this cluster as gated. <li> Update node and resource information; describe resources. <li> Find all VMs and update their migration state and volumes <li> Send the MigrateInstances operation. <li> Update node and resource information; describe resources. <li> Unmark this cluster as gated. </ol>
 * @param sourceHost
 * @param destHostsWhiteList -- the destination host list is a white list when true and a black list when false
 * @param destHosts -- list of hosts which are either a white list or black list based on {@code destHostsWhiteList}
 * @throws EucalyptusCloudException 
 * @throws Exception
 */
public void migrateInstances(final String sourceHost,final Boolean destHostsWhiteList,final List<String> destHosts) throws Exception {
  if (this.gateLock.tryLock(30,TimeUnit.SECONDS)) {
    try {
      List<VmInstance> currentMigrations=this.lookupCurrentMigrations();
      if (!currentMigrations.isEmpty()) {
        throw Exceptions.toUndeclared("String_Node_Str" + Joiner.on("String_Node_Str").join(Iterables.transform(currentMigrations,CloudMetadatas.toDisplayName())));
      }
      this.retryCheck();
      this.prepareInstanceEvacuations(sourceHost);
      try {
        AsyncRequests.sendSync(this.getConfiguration(),new MigrateInstancesType(){
{
            this.setCorrelationId(Contexts.lookup().getCorrelationId());
            this.setSourceHost(sourceHost);
            this.setAllowHosts(destHostsWhiteList);
            this.getDestinationHosts().addAll(destHosts);
          }
        }
);
      }
 catch (      Exception ex) {
        this.rollbackInstanceEvacuations(sourceHost);
        throw ex;
      }
      this.retryCheck();
    }
 catch (    Exception ex) {
      LOG.error(ex);
      throw ex;
    }
 finally {
      this.gateLock.unlock();
    }
  }
 else {
    throw new ServiceStateException("String_Node_Str" + this.getPartition() + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * <ol> <li> Mark this cluster as gated. <li> Update node and resource information; describe resources. <li> Find all VMs and update their migration state and volumes <li> Send the MigrateInstances operation. <li> Update node and resource information; describe resources. <li> Unmark this cluster as gated. </ol>
 * @param sourceHost
 * @param destHostsWhiteList -- the destination host list is a white list when true and a black list when false
 * @param destHosts -- list of hosts which are either a white list or black list based on {@code destHostsWhiteList}
 * @throws EucalyptusCloudException 
 * @throws Exception
 */
public void migrateInstances(final String sourceHost,final Boolean destHostsWhiteList,final List<String> destHosts) throws Exception {
  if (this.gateLock.writeLock().tryLock(60,TimeUnit.SECONDS)) {
    try {
      List<VmInstance> currentMigrations=this.lookupCurrentMigrations();
      if (!currentMigrations.isEmpty()) {
        throw Exceptions.toUndeclared("String_Node_Str" + Joiner.on("String_Node_Str").join(Iterables.transform(currentMigrations,CloudMetadatas.toDisplayName())));
      }
      this.retryCheck();
      this.prepareInstanceEvacuations(sourceHost);
      try {
        AsyncRequests.sendSync(this.getConfiguration(),new MigrateInstancesType(){
{
            this.setCorrelationId(Contexts.lookup().getCorrelationId());
            this.setSourceHost(sourceHost);
            this.setAllowHosts(destHostsWhiteList);
            this.getDestinationHosts().addAll(destHosts);
          }
        }
);
      }
 catch (      Exception ex) {
        this.rollbackInstanceEvacuations(sourceHost);
        throw ex;
      }
      this.retryCheck();
    }
 catch (    Exception ex) {
      LOG.error(ex);
      throw ex;
    }
 finally {
      this.gateLock.writeLock().unlock();
    }
  }
 else {
    throw new ServiceStateException("String_Node_Str" + this.getPartition() + "String_Node_Str");
  }
}