Projects >> eucalyptus >>351b17d9a1cbc5f20e50b43c8eb9fa64f6857ff5

Chunk
Conflicting content
package com.eucalyptus.cloudwatch.domain.absolute;

import java.util.Date;
<<<<<<< HEAD
import java.util.Map;
=======
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
>>>>>>> 4c70cf1d135e778ce5149f7f9513450ed37ed3d3

import javax.persistence.Column;
import javax.persistence.EntityTransaction;
Solution content
package com.eucalyptus.cloudwatch.domain.absolute;

import java.util.Date;
import java.util.Map;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;

import javax.persistence.Column;
import javax.persistence.EntityTransaction;
File
AbsoluteMetricHelper.java
Developer's decision
Combination
Kind of conflict
Import
Chunk
Conflicting content
import org.hibernate.criterion.Restrictions;
import org.mortbay.log.Log;

<<<<<<< HEAD
import com.eucalyptus.cloudwatch.domain.metricdata.MetricDataQueue.AbsoluteMetricCache;
import com.eucalyptus.cloudwatch.domain.metricdata.MetricDataQueue.AbsoluteMetricCacheKey;
=======
import com.eucalyptus.cloudwatch.domain.alarms.AlarmHistory;
>>>>>>> 4c70cf1d135e778ce5149f7f9513450ed37ed3d3
import com.eucalyptus.entities.Entities;
import com.eucalyptus.records.Logs;
Solution content
import org.hibernate.criterion.Restrictions;
import org.mortbay.log.Log;

import com.eucalyptus.cloudwatch.domain.metricdata.MetricDataQueue.AbsoluteMetricCache;
import com.eucalyptus.cloudwatch.domain.metricdata.MetricDataQueue.AbsoluteMetricCacheKey;
import com.eucalyptus.entities.Entities;
import com.eucalyptus.records.Logs;
File
AbsoluteMetricHelper.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
    }
    return returnValue;
  }
<<<<<<< HEAD
  

=======

  /**
   * Delete all absolute metric history before a certain date
   * @param before the date to delete before (inclusive)
   */
  public static void deleteAbsoluteMetricHistory(Date before) {
    EntityTransaction db = Entities.get(AbsoluteMetricHistory.class);
    try {
      Map criteria = new HashMap();
      criteria.put("before", before);
      Entities.deleteAllMatching(AbsoluteMetricHistory.class, "WHERE timestamp < :before", criteria);
      db.commit();
    } catch (RuntimeException ex) {
      Logs.extreme().error(ex, ex);
      throw ex;
    } finally {
      if (db.isActive())
        db.rollback();
    }
  }
>>>>>>> 4c70cf1d135e778ce5149f7f9513450ed37ed3d3
}  
Solution content
    }
    return returnValue;
  }

  /**
   * Delete all absolute metric history before a certain date
   * @param before the date to delete before (inclusive)
   */
  public static void deleteAbsoluteMetricHistory(Date before) {
    EntityTransaction db = Entities.get(AbsoluteMetricHistory.class);
    try {
      Map criteria = new HashMap();
      criteria.put("before", before);
      Entities.deleteAllMatching(AbsoluteMetricHistory.class, "WHERE timestamp < :before", criteria);
      db.commit();
    } catch (RuntimeException ex) {
      Logs.extreme().error(ex, ex);
      throw ex;
    } finally {
      if (db.isActive())
        db.rollback();
    }
  }
}  
File
AbsoluteMetricHelper.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
<<<<<<< HEAD
=======

import edu.ucsb.eucalyptus.msgs.DeleteStorageVolumeResponseType;
import edu.ucsb.eucalyptus.msgs.DeleteStorageVolumeType;
>>>>>>> 4c70cf1d135e778ce5149f7f9513450ed37ed3d3
import edu.ucsb.eucalyptus.msgs.RunningInstancesItemType;

@ConfigurableClass( root = "cloud.vmstate",
Solution content
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import edu.ucsb.eucalyptus.msgs.RunningInstancesItemType;

@ConfigurableClass( root = "cloud.vmstate",
File
VmInstances.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
            
            try {
  }
  
  // EUCA-6935 Changing the way attached volumes are cleaned up.
<<<<<<< HEAD
  private static void cleanUpAttachedVolumes( final VmInstance vm ) {
    try {
      vm.eachVolumeAttachment( new Predicate( ) {
        @Override
        public boolean apply( final VmVolumeAttachment arg0 ) {
          try {
            
            if ( VmStateSet.DONE.apply( vm ) && !"/dev/sda1".equals( arg0.getDevice( ) ) ) {
              try {
            	VmInstance vmInstance = Entities.merge( arg0.getVmInstance( ) );
                vmInstance.getTransientVolumeState( ).removeVolumeAttachment( arg0.getVolumeId( ) );
              } catch ( NoSuchElementException ex ) {
                Logs.extreme( ).debug( ex );
              }
            }
            
            try {
            	//Send forcible detach. Detach is idempotent so calling on already detached volume should be no problem
              //final ServiceConfiguration sc = Topology.lookup( Storage.class, vm.lookupPartition( ) );
              //AsyncRequests.sendSync( sc, new DetachStorageVolumeType( arg0.getVolumeId( ) ) );
            } catch ( Exception ex ) {
              LOG.debug( ex );
              Logs.extreme( ).debug( ex, ex );
            } catch (Throwable ex) {
                LOG.debug( ex );
                Logs.extreme( ).debug( ex, ex );
            }
              //ebs with either default deleteOnTerminate or user specified deleteOnTerminate and TERMINATING
              if ( ( VmStateSet.DONE.apply( vm ) ) && arg0.getDeleteOnTerminate( ) ) {
                final ServiceConfiguration sc = Topology.lookup( Storage.class, vm.lookupPartition( ) );
                AsyncRequests.dispatch( sc, new DeleteStorageVolumeType( arg0.getVolumeId( ) ) );
                Volume volume = Volumes.lookup( null, arg0.getVolumeId( ) );
                Volumes.annihilateStorageVolume( volume );
              }
            } catch ( Exception ex ) {
              LOG.debug( ex );
              Logs.extreme( ).debug( ex, ex );
            } catch (Throwable ex) {
                LOG.debug( ex );
                Logs.extreme( ).debug( ex, ex );
            }
            
            return true;
          } catch ( final Exception e ) {
            LOG.error( "Failed to clean up attached volume: "
                       + arg0.getVolumeId( )
                       + " for instance "
                       + vm.getInstanceId( )
                       + ".  The request failed because of: "
                       + e.getMessage( ), e );
            return true;
          }
        }
      } );
    } catch ( final Exception ex ) {
      LOG.error( "Failed to lookup Storage Controller configuration for: " + vm.getInstanceId( ) + " (placement=" + vm.getPartition( ) + ").  " );
    }
=======
  private static void cleanUpAttachedVolumes(final VmInstance vm) {
    if (VmStateSet.DONE.apply(vm)) {
	  try {
		  
		if(vm.getTransientVolumeState() != null && vm.getTransientVolumeState().getAttachments() != null 
				&& !vm.getTransientVolumeState().getAttachments().isEmpty()) {
		  for (VmVolumeAttachment attachment : vm.getTransientVolumeState().getAttachments()) {
		    try {
		      final Volume volume = Volumes.lookup( null, attachment.getVolumeId());
		      if (State.BUSY.equals(volume.getState())) {
			    volume.setState( State.EXTANT );
			  }
		  	} catch (Exception ex) {
			  LOG.error(vm.getInstanceId() + ": Failed to cleanup transient volume attachment for " + attachment.getVolumeId(), ex);
			}
		  }
		}
		
		if(vm.getBootRecord() != null && vm.getBootRecord().getPersistentVolumes() != null
				&& !vm.getBootRecord().getPersistentVolumes().isEmpty()) {
		  final ServiceConfiguration sc = Topology.lookup(Storage.class, vm.lookupPartition());
		  for (VmVolumeAttachment attachment : vm.getBootRecord().getPersistentVolumes()) {
			// Check for the delete on terminate flag and fire the delete request.
		    if (attachment.getDeleteOnTerminate()) {
			  try {
				Volume volume = Volumes.lookup( null, attachment.getVolumeId());
				LOG.debug(vm.getInstanceId() + ": Firing delete request for " + attachment.getVolumeId());
				DeleteStorageVolumeResponseType reply = AsyncRequests.sendSync( sc, new DeleteStorageVolumeType(attachment.getVolumeId()));
	  		    if(null != reply && reply.get_return()) {
	              Volumes.annihilateStorageVolume(volume);
	  		    } else {
	  		      LOG.error(vm.getInstanceId() + ": Failed to delete volume " + attachment.getVolumeId());
	    		}
			  } catch (Exception ex) {
				LOG.error(vm.getInstanceId() + ": Failed to cleanup persistent volume attachment for " + attachment.getVolumeId(), ex);
			  }
		    }
		  }
		}
		
	  } catch (Exception ex) {
	    LOG.error(vm.getInstanceId() + ": Failed to cleanup attached volumes", ex);
	  }
  	}
>>>>>>> 4c70cf1d135e778ce5149f7f9513450ed37ed3d3
  }
  
  public static String asMacAddress( final String instanceId ) {
Solution content
			  }
		    }
		  }
		}
  }
  
  // EUCA-6935 Changing the way attached volumes are cleaned up.
  private static void cleanUpAttachedVolumes(final VmInstance vm) {
    if (VmStateSet.DONE.apply(vm)) {
	  try {
		  
		if(vm.getTransientVolumeState() != null && vm.getTransientVolumeState().getAttachments() != null 
				&& !vm.getTransientVolumeState().getAttachments().isEmpty()) {
		  for (VmVolumeAttachment attachment : vm.getTransientVolumeState().getAttachments()) {
		    try {
		      final Volume volume = Volumes.lookup( null, attachment.getVolumeId());
		      if (State.BUSY.equals(volume.getState())) {
			    volume.setState( State.EXTANT );
			  }
		  	} catch (Exception ex) {
			  LOG.error(vm.getInstanceId() + ": Failed to cleanup transient volume attachment for " + attachment.getVolumeId(), ex);
			}
		  }
		}
		
		if(vm.getBootRecord() != null && vm.getBootRecord().getPersistentVolumes() != null
				&& !vm.getBootRecord().getPersistentVolumes().isEmpty()) {
		  final ServiceConfiguration sc = Topology.lookup(Storage.class, vm.lookupPartition());
		  for (VmVolumeAttachment attachment : vm.getBootRecord().getPersistentVolumes()) {
			// Check for the delete on terminate flag and fire the delete request.
		    if (attachment.getDeleteOnTerminate()) {
			  try {
				Volume volume = Volumes.lookup( null, attachment.getVolumeId());
				LOG.debug(vm.getInstanceId() + ": Firing delete request for " + attachment.getVolumeId());
				DeleteStorageVolumeResponseType reply = AsyncRequests.sendSync( sc, new DeleteStorageVolumeType(attachment.getVolumeId()));
	  		    if(null != reply && reply.get_return()) {
	              Volumes.annihilateStorageVolume(volume);
	  		    } else {
	  		      LOG.error(vm.getInstanceId() + ": Failed to delete volume " + attachment.getVolumeId());
	    		}
			  } catch (Exception ex) {
				LOG.error(vm.getInstanceId() + ": Failed to cleanup persistent volume attachment for " + attachment.getVolumeId(), ex);
		
	  } catch (Exception ex) {
	    LOG.error(vm.getInstanceId() + ": Failed to cleanup attached volumes", ex);
	  }
  	}
  }
  
  public static String asMacAddress( final String instanceId ) {
File
VmInstances.java
Developer's decision
Version 2
Kind of conflict
If statement
Method signature
Try statement
Chunk
Conflicting content
import edu.ucsb.eucalyptus.util.SystemUtil;

import com.eucalyptus.system.Threads;
<<<<<<< HEAD:clc/modules/object-storage/src/main/java/com/eucalyptus/objectstorage/WalrusManager.java

=======
import com.eucalyptus.component.id.Walrus;
import com.google.common.base.Strings;
>>>>>>> 4c70cf1d135e778ce5149f7f9513450ed37ed3d3:clc/modules/walrus/src/main/java/edu/ucsb/eucalyptus/cloud/ws/WalrusManager.java

public class WalrusManager {
	private static Logger LOG = Logger.getLogger(WalrusManager.class);
Solution content
import edu.ucsb.eucalyptus.util.SystemUtil;

import com.eucalyptus.system.Threads;
import com.eucalyptus.component.id.Walrus;
import com.google.common.base.Strings;

public class WalrusManager {
	private static Logger LOG = Logger.getLogger(WalrusManager.class);
File
WalrusManager.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
		return reply;
	}

<<<<<<< HEAD:clc/modules/object-storage/src/main/java/com/eucalyptus/objectstorage/WalrusManager.java
	public GetObjectResponseType getObject(GetObjectType request) throws EucalyptusCloudException {
		GetObjectResponseType reply = (GetObjectResponseType) request.getReply();
		//Must explicitly set to true for streaming large objects.
		reply.setHasStreamingData(false);
=======
	public GetObjectResponseType getObject(GetObjectType request)
			throws EucalyptusCloudException {
		GetObjectResponseType reply = (GetObjectResponseType) request
				.getReply();
>>>>>>> 4c70cf1d135e778ce5149f7f9513450ed37ed3d3:clc/modules/walrus/src/main/java/edu/ucsb/eucalyptus/cloud/ws/WalrusManager.java
		String bucketName = request.getBucket();
		String objectKey = request.getKey();
		Context ctx = Contexts.lookup();
Solution content
		return reply;
	}

	public GetObjectResponseType getObject(GetObjectType request) throws EucalyptusCloudException {
		GetObjectResponseType reply = (GetObjectResponseType) request.getReply();
		//Must explicitly set to true for streaming large objects.
		reply.setHasStreamingData(false);
		String bucketName = request.getBucket();
		String objectKey = request.getKey();
		Context ctx = Contexts.lookup();
File
WalrusManager.java
Developer's decision
Version 1
Kind of conflict
Cast expression
Comment
Method invocation
Method signature
Variable
Chunk
Conflicting content
								throw new EucalyptusCloudException(e);
							}
							reply.setBase64Data(Hashes.base64encode(base64Data));
<<<<<<< HEAD:clc/modules/object-storage/src/main/java/com/eucalyptus/objectstorage/WalrusManager.java
							
							//fireUsageEvent For Get Object 
=======

							// fireUsageEvent For Get Object
>>>>>>> 4c70cf1d135e778ce5149f7f9513450ed37ed3d3:clc/modules/walrus/src/main/java/edu/ucsb/eucalyptus/cloud/ws/WalrusManager.java
						} else {
							reply.setHasStreamingData(true);
							// support for large objects
Solution content
								throw new EucalyptusCloudException(e);
							}
							reply.setBase64Data(Hashes.base64encode(base64Data));

							// fireUsageEvent For Get Object
						} else {
							reply.setHasStreamingData(true);
							// support for large objects
File
WalrusManager.java
Developer's decision
Version 1
Kind of conflict
Comment