=== modified file 'debian/changelog' --- debian/changelog 2010-06-04 00:39:00 +0000 +++ debian/changelog 2010-06-29 23:12:00 +0000 @@ -1,3 +1,11 @@ +eucalyptus (1.6.2-0ubuntu30.3) lucid-proposed; urgency=low + + * debian/patches/lp566792-metadata-service.patch: Prevent invalid state + transitions and fix address handling which mangled in-flight state + changes. Cherry pick from upstream 1.6.2 branch (r1230..1232). (LP: #566792) + + -- Dave Walker (Daviey) Wed, 30 Jun 2010 00:10:43 +0100 + eucalyptus (1.6.2-0ubuntu30.2) lucid-proposed; urgency=low * Revert: node/handlers_kvm.c: fix console bug (was only showing first 64K), === added file 'debian/patches/lp566792-metadata-service.patch' --- debian/patches/lp566792-metadata-service.patch 1970-01-01 00:00:00 +0000 +++ debian/patches/lp566792-metadata-service.patch 2010-06-29 23:09:23 +0000 @@ -0,0 +1,562 @@ +Description: Prevent invalid state transitions and fix address handling which mangled in-flight state changes. +Origin: Cherry pick from upstream 1.6.2 branch (r1230..1232) +Bug: https://launchpad.net/bugs/566792 +--- a/clc/modules/cluster-manager/src/main/java/com/eucalyptus/address/AbstractSystemAddressManager.java ++++ b/clc/modules/cluster-manager/src/main/java/com/eucalyptus/address/AbstractSystemAddressManager.java +@@ -45,12 +45,12 @@ + Helper.loadStoredAddresses( cluster ); + cluster.getState( ).setAddressingInitialized( true ); + } +- for( ClusterAddressInfo addrInfo : ccList ) { ++ for ( ClusterAddressInfo addrInfo : ccList ) { + try { + Address address = Helper.lookupOrCreate( cluster, addrInfo ); + if ( address.isAssigned( ) ) { +- if( Address.UNALLOCATED_USERID.equals( address.getUserId( ) ) ) { +- this.markAsAllocated( cluster, addrInfo, address ); ++ if ( Address.UNALLOCATED_USERID.equals( address.getUserId( ) ) ) { ++ Helper.markAsAllocated( cluster, addrInfo, address ); + } + try { + VmInstance vm = VmInstances.getInstance( ).lookupByInstanceIp( addrInfo.getInstanceIp( ) ); +@@ -62,95 +62,138 @@ + } catch ( UnknownHostException e1 ) { + LOG.debug( e1, e1 ); + } +- if ( addr == null || !addr.isLoopbackAddress( ) ) { +- cluster.getState().handleOrphan( addrInfo ); ++ if ( addr == null || !addr.isLoopbackAddress( ) ) { ++ cluster.getState( ).handleOrphan( addrInfo ); + } + } +- } else if( address.isAllocated( ) && Address.UNALLOCATED_USERID.equals( address.getUserId( ) ) ) { +- this.markAsAllocated( cluster, addrInfo, address ); +- } ++ } else if ( address.isAllocated( ) && Address.UNALLOCATED_USERID.equals( address.getUserId( ) ) && !address.isPending( ) ) { ++ Helper.markAsAllocated( cluster, addrInfo, address ); ++ } + } catch ( Throwable e ) { + LOG.debug( e, e ); + } + } + } +- +- private void markAsAllocated( Cluster cluster, ClusterAddressInfo addrInfo, Address address ) { +- address.allocate( Component.eucalyptus.name( ) ); +- try { +- address.clearPending( ); +- } catch ( IllegalStateException e ) {/* might not be pending still valid. */} +- cluster.getState( ).clearOrphan( addrInfo ); +- } +- ++ + protected static class Helper { + protected static Address lookupOrCreate( Cluster cluster, ClusterAddressInfo addrInfo ) { + Address addr = null; ++ VmInstance vm = null; + try { + addr = Addresses.getInstance( ).lookupDisabled( addrInfo.getAddress( ) ); ++ LOG.trace( "Found address in the inactive set cache: " + addr ); + } catch ( NoSuchElementException e1 ) { + try { + addr = Addresses.getInstance( ).lookup( addrInfo.getAddress( ) ); +- } catch ( NoSuchElementException e ) { +- addr = new Address(addrInfo.getAddress( ), cluster.getName( )); +- } ++ LOG.trace( "Found address in the active set cache: " + addr ); ++ } catch ( NoSuchElementException e ) {} + } +- if( addrInfo.getInstanceIp( ) != null && !"".equals(addrInfo.getInstanceIp( ))) { +- try { +- VmInstance vm = VmInstances.getInstance( ).lookupByInstanceIp( addrInfo.getInstanceIp( ) ); +- if( VmInstance.DEFAULT_IP.equals( vm.getNetworkConfig().getIgnoredPublicIp( ) ) ) { +- vm.getNetworkConfig( ).setIgnoredPublicIp( addrInfo.getAddress( ) ); +- if( !addr.isAllocated( ) ) { +- try { +- addr.allocate( Component.eucalyptus.name( ) ); +- } catch ( Throwable e1 ) { +- LOG.debug( e1, e1 ); +- } +- } +- if( !addr.isAssigned() && !addr.isPending() ) { +- try { +- addr.assign( vm.getInstanceId( ), addrInfo.getInstanceIp( ) ).clearPending( ); +- } catch ( Throwable e1 ) { +- LOG.debug( e1, e1 ); +- } +- } +- } +- } catch ( NoSuchElementException e ) { +- if( !addr.isPending( ) ) { +- final boolean isSystemOwned = addr.isSystemOwned( ); +- final Address a = addr; +- try { +- new UnassignAddressCallback( addrInfo ).then( new SuccessCallback() { +- @Override public void apply( Object t ) { +- if( isSystemOwned ) { +- Addresses.getAddressManager( ).releaseSystemAddress( a ); +- } +- } +- } ).dispatch( cluster ); +- } catch ( Throwable e1 ) { +- LOG.debug( e1, e1 ); +- } +- } ++ Helper.checkUniqueness( addrInfo ); ++ if ( addrInfo.hasMapping( ) ) { ++ vm = Helper.maybeFindVm( addrInfo.getAddress( ), addrInfo.getInstanceIp( ) ); ++ if ( addr != null && vm != null ) { ++ Helper.ensureAllocated( addr ); ++ Helper.ensureAssigned( addr, vm ); ++ cluster.getState( ).clearOrphan( addrInfo ); ++ } else if ( addr != null && vm != null && vm.getState( ).ordinal( ) > VmState.RUNNING.ordinal( ) ) { ++ cluster.getState( ).handleOrphan( addrInfo ); ++ } else if ( addr != null && vm == null ) { ++ cluster.getState( ).handleOrphan( addrInfo ); ++ } else if ( addr == null && vm != null ) { ++ addr = new Address( addrInfo.getAddress( ), cluster.getName( ), Component.eucalyptus.name( ), vm.getInstanceId( ), vm.getNetworkConfig( ).getIpAddress( ) ); ++ cluster.getState( ).clearOrphan( addrInfo ); ++ } else if( addr == null && vm == null ) { ++ addr = new Address( addrInfo.getAddress( ), cluster.getName( ) ); ++ cluster.getState().handleOrphan( addrInfo ); + } + } else { ++ if( addr != null && addr.isAssigned( ) && !addr.isPending( ) ) { ++ Helper.clearAddressCachedState( addr ); ++ } else if( addr != null && !addr.isAssigned( ) && !addr.isPending( ) && addr.isSystemOwned( ) ) { ++ Addresses.getAddressManager( ).releaseSystemAddress( addr ); ++ } else if( addr == null ) { ++ addr = new Address( addrInfo.getAddress( ), cluster.getName( ) ); ++ Helper.clearVmState( addrInfo ); ++ } ++ } ++ return addr; ++ } ++ ++ private static void markAsAllocated( Cluster cluster, ClusterAddressInfo addrInfo, Address address ) { ++ address.allocate( Component.eucalyptus.name( ) ); ++ try { ++ address.clearPending( ); ++ } catch ( IllegalStateException e ) {/* might not be pending still valid. */} ++ cluster.getState( ).clearOrphan( addrInfo ); ++ } ++ ++ private static void clearAddressCachedState( Address addr ) { ++ try { + if( !addr.isPending( ) ) { +- try { +- VmInstance vm = VmInstances.getInstance( ).lookupByPublicIp( addrInfo.getAddress( ) ); +- vm.getNetworkConfig( ).setIgnoredPublicIp( VmInstance.DEFAULT_IP ); +- } catch ( NoSuchElementException e ) { +- if( addr.isAssigned( ) ) { +- try { +- addr.unassign( ).clearPending( ); +- } catch ( Throwable e1 ) { +- LOG.debug( e1, e1 ); +- } +- } +- } ++ addr.unassign( ).clearPending( ); ++ if( addr.isSystemOwned( ) ) { ++ Addresses.getAddressManager( ).releaseSystemAddress( addr ); ++ } + } ++ } catch ( Throwable t ) { + } +- return addr; + } + ++ private static void clearVmState( ClusterAddressInfo addrInfo ) { ++ try { ++ VmInstance vm = VmInstances.getInstance( ).lookupByPublicIp( addrInfo.getAddress( ) ); ++ vm.getNetworkConfig( ).setIgnoredPublicIp( vm.getNetworkConfig( ).getIpAddress( ) ); ++ } catch ( NoSuchElementException e ) { ++ } ++ } ++ ++ private static VmInstance maybeFindVm( String publicIp, String privateIp ) { ++ VmInstance vm = null; ++ try { ++ vm = VmInstances.getInstance( ).lookupByInstanceIp( privateIp ); ++ LOG.trace( "Found vm which claims this address: " + vm.getInstanceId( ) + " " + publicIp ); ++ if ( publicIp.equals( vm.getNetworkConfig( ).getIgnoredPublicIp( ) ) ) { ++ vm.getNetworkConfig( ).setIgnoredPublicIp( publicIp ); ++ LOG.trace( "Updated vm with address information: " + vm.getInstanceId( ) + " " + publicIp ); ++ } ++ } catch ( NoSuchElementException e ) {} ++ return vm; ++ } ++ ++ private static void ensureAssigned( Address addr, VmInstance vm ) { ++ if ( !addr.isAssigned( ) && !addr.isPending( ) ) { ++ try { ++ addr.assign( vm.getInstanceId( ), vm.getNetworkConfig( ).getIpAddress( ) ).clearPending( ); ++ } catch ( Throwable e1 ) { ++ LOG.debug( e1, e1 ); ++ } ++ } ++ } ++ ++ private static void ensureAllocated( Address addr ) { ++ if ( !addr.isAllocated( ) ) { ++ try { ++ addr.allocate( Component.eucalyptus.name( ) ); ++ } catch ( Throwable e1 ) { ++ LOG.debug( e1, e1 ); ++ } ++ } ++ } ++ ++ private static void checkUniqueness( ClusterAddressInfo addrInfo ) { ++ int vmCount = VmInstances.getInstance( ).countByPublicIp( addrInfo.getAddress( ) ); ++ if ( vmCount > 1 ) { ++ String vmList = ""; ++ for ( VmInstance v : VmInstances.getInstance( ).listValues( ) ) { ++ if ( addrInfo.getAddress( ).equals( v.getNetworkConfig( ).getIgnoredPublicIp( ) ) ) { ++ vmList += " " + v.getInstanceId( ); ++ } ++ } ++ LOG.error( "Found " + vmCount + " vms with the same address: " + addrInfo + " -> " + vmList ); ++ //TODO: handle reconciling state. ++ } ++ } ++ + protected static void loadStoredAddresses( Cluster cluster ) { + try { + EntityWrapper
db = new EntityWrapper
( ); +@@ -158,13 +201,14 @@ + clusterAddr.setCluster( cluster.getName( ) ); + List
addrList = Lists.newArrayList( ); + try { +- addrList = db.query( clusterAddr ); ++ addrList = db.query( clusterAddr ); + db.commit( ); + } catch ( Exception e1 ) { + db.rollback( ); + } +- for( Address addr : addrList ) { ++ for ( Address addr : addrList ) { + try { ++ LOG.info( "Restoring persistent address info for: " + addr ); + Addresses.getInstance( ).lookup( addr.getName( ) ); + addr.init( ); + } catch ( Throwable e ) { +@@ -175,14 +219,6 @@ + LOG.debug( e, e ); + } + } +- protected static boolean checkActiveVm( ) {//TODO: review this degenerate case. +- for ( VmInstance vm : VmInstances.getInstance( ).listValues( ) ) { +- if ( VmState.PENDING.equals( vm.getState( ) ) || VmState.RUNNING.equals( vm.getState( ) ) ) { +- return true; +- } +- } +- return false; +- } + } + + } +--- a/clc/modules/cluster-manager/src/main/java/com/eucalyptus/address/Address.java ++++ b/clc/modules/cluster-manager/src/main/java/com/eucalyptus/address/Address.java +@@ -245,11 +245,17 @@ + Address.this.instanceId = UNASSIGNED_INSTANCEID; + Address.this.instanceAddress = UNASSIGNED_INSTANCEADDR; + Address.this.userId = userId; +- Address.addAddress( Address.this ); + try { +- Addresses.getInstance( ).register( Address.this ); ++ Addresses.getInstance( ).enable( Address.this.name ); + } catch ( NoSuchElementException e ) { +- LOG.debug( e ); ++ try { ++ Addresses.getInstance( ).register( Address.this ); ++ } catch ( NoSuchElementException e1 ) { ++ LOG.debug( e ); ++ } ++ } ++ if( !Address.this.isSystemOwned( ) ) { ++ Address.addAddress( Address.this ); + } + Address.this.state.attemptMark( State.allocated, false ); + } +@@ -367,10 +373,9 @@ + } + + private static void addAddress( Address address ) { +- Address addr = new Address( address.getName( ), address.getCluster( ) ); + EntityWrapper
db = new EntityWrapper
( ); + try { +- addr = db.getUnique( new Address( address.getName( ) ) ); ++ Address addr = db.getUnique( new Address( address.getName( ) ) ); + addr.setUserId( address.getUserId( ) ); + db.commit( ); + } catch ( Throwable e ) { +--- a/clc/modules/cluster-manager/src/main/java/com/eucalyptus/address/Addresses.java ++++ b/clc/modules/cluster-manager/src/main/java/com/eucalyptus/address/Addresses.java +@@ -149,9 +149,7 @@ + Addresses.systemAddressManager = ( AbstractSystemAddressManager ) managerMap.get( provider ).newInstance( ); + Addresses.systemAddressManager.inheritReservedAddresses( oldMgr.getReservedAddresses( ) ); + LOG.info( "Setting the address manager to be: " + systemAddressManager.getClass( ).getSimpleName( ) ); +- } else { +- Addresses.systemAddressManager.inheritReservedAddresses( Addresses.systemAddressManager.getReservedAddresses( ) ); +- } ++ } + } catch ( Throwable e ) { + LOG.debug( e, e ); + } +--- a/clc/modules/cluster-manager/src/main/java/com/eucalyptus/address/DynamicSystemAddressManager.java ++++ b/clc/modules/cluster-manager/src/main/java/com/eucalyptus/address/DynamicSystemAddressManager.java +@@ -23,11 +23,15 @@ + List
addressList = Lists.newArrayList( ); + if ( Addresses.getInstance( ).listDisabledValues( ).size( ) < count ) throw new NotEnoughResourcesAvailable( "Not enough resources available: addresses (try --addressing private)" ); + for ( Address addr : Addresses.getInstance( ).listDisabledValues( ) ) { +- if ( cluster.equals( addr.getCluster( ) ) ) { +- addressList.add( addr.allocate( Component.eucalyptus.name( ) ) ); +- addr.pendingAssignment( ); +- if ( --count == 0 ) { +- break; ++ if ( cluster.equals( addr.getCluster( ) ) && !addr.isAllocated( ) ) { ++ try { ++ addressList.add( addr.allocate( Component.eucalyptus.name( ) ) ); ++ addr.pendingAssignment( ); ++ if ( --count == 0 ) { ++ break; ++ } ++ } catch ( Exception e ) { ++ LOG.debug( e, e ); + } + } + } +@@ -59,7 +63,7 @@ + @Override + public void inheritReservedAddresses( List
previouslyReservedAddresses ) { + for ( final Address addr : previouslyReservedAddresses ) { +- if( !addr.isAssigned( ) ) { ++ if( !addr.isAssigned( ) && !addr.isPending() && addr.isSystemOwned() && Address.UNASSIGNED_INSTANCEID.equals( addr.getInstanceId() ) ) { + Addresses.release( addr ); + } + } +--- a/clc/modules/cluster-manager/src/main/java/com/eucalyptus/cluster/ClusterState.java ++++ b/clc/modules/cluster-manager/src/main/java/com/eucalyptus/cluster/ClusterState.java +@@ -95,7 +95,7 @@ + private ConcurrentNavigableMap orphans = new ConcurrentSkipListMap( ); + + public void clearOrphan( ClusterAddressInfo address ) { +- Integer delay = orphans.remove( address.getAddress( ) ); ++ Integer delay = orphans.remove( address ); + delay = ( delay == null ? 0 : delay ); + if ( delay > 2 ) { + LOG.warn( "Forgetting stale orphan address mapping from cluster " + clusterName + " for " + address.toString( ) ); +--- a/clc/modules/cluster-manager/src/main/java/com/eucalyptus/net/util/ClusterAddressInfo.groovy ++++ b/clc/modules/cluster-manager/src/main/java/com/eucalyptus/net/util/ClusterAddressInfo.groovy +@@ -2,7 +2,7 @@ + + import com.google.common.collect.Lists; + +-public class ClusterAddressInfo { ++public class ClusterAddressInfo implements Comparable { + int orphanCount; + String address; + String instanceIp; +@@ -14,7 +14,11 @@ + public static List fromLists( List addresses, List instanceIps ) { + return addresses.collect{ new ClusterAddressInfo( it ) }.eachWithIndex{ it, i -> it.instanceIp = instanceIps[ i ] } + } +- ++ ++ public boolean hasMapping() { ++ return this.instanceIp != null && !"".equals( this.instanceIp ); ++ } ++ + @Override + public int hashCode( ) { + final int prime = 31; +@@ -23,6 +27,10 @@ + return result; + } + ++ public int compareTo( ClusterAddressInfo that ) { ++ return ( this.address + this.instanceIp ).compareTo( that.address + that.instanceIp ); ++ } ++ + @Override + public boolean equals( Object obj ) { + if ( this.is( obj ) ) return true; +--- a/clc/modules/cluster-manager/src/main/java/edu/ucsb/eucalyptus/cloud/cluster/QueuedEventCallback.java ++++ b/clc/modules/cluster-manager/src/main/java/edu/ucsb/eucalyptus/cloud/cluster/QueuedEventCallback.java +@@ -76,6 +76,7 @@ + import org.jboss.netty.handler.codec.http.HttpMethod; + import org.jboss.netty.handler.codec.http.HttpRequest; + import org.jboss.netty.handler.codec.http.HttpVersion; ++import com.eucalyptus.bootstrap.Component; + import com.eucalyptus.cluster.Cluster; + import com.eucalyptus.cluster.Clusters; + import com.eucalyptus.cluster.FailureCallback; +@@ -90,6 +91,7 @@ + import com.eucalyptus.ws.client.pipeline.NioClientPipeline; + import com.eucalyptus.ws.handlers.NioResponseHandler; + import com.eucalyptus.ws.util.ChannelUtil; ++import edu.ucsb.eucalyptus.msgs.DescribePublicAddressesType; + import edu.ucsb.eucalyptus.msgs.EucalyptusMessage; + import edu.ucsb.eucalyptus.msgs.EventRecord; + +@@ -97,6 +99,12 @@ + public abstract class QueuedEventCallback extends NioResponseHandler {//FIXME: the generic here conflicts with a general use for queued event. + static Logger LOG = Logger.getLogger( QueuedEventCallback.class ); + public static class NOOP extends QueuedEventCallback { ++ public NOOP( ) { ++ this.setRequest( new DescribePublicAddressesType( ) {{ ++ setUserId( Component.eucalyptus.name( ) ); ++ setEffectiveUserId( Component.eucalyptus.name( ) ); ++ }}); ++ } + public void fail( Throwable throwable ) {} + public void prepare( Object msg ) throws Exception {} + public void verify( EucalyptusMessage msg ) throws Exception {} +@@ -124,7 +132,6 @@ + } + + public void dispatch( String clusterName ) { +- LOG.debug( EventRecord.caller(QueuedEventCallback.class,this.getRequest().getClass(),LogUtil.dumpObject( this.getRequest() ))); + dispatch( Clusters.getInstance( ).lookup( clusterName ) ); + } + public void dispatch( Cluster cluster ) { +--- a/clc/modules/cluster-manager/src/main/java/edu/ucsb/eucalyptus/cloud/cluster/UnassignAddressCallback.groovy ++++ b/clc/modules/cluster-manager/src/main/java/edu/ucsb/eucalyptus/cloud/cluster/UnassignAddressCallback.groovy +@@ -123,8 +123,11 @@ + } else { + LOG.info( EventRecord.here( UnassignAddressCallback.class, Transition.broken, address.toString( ) ) ); + } ++ if(!Transition.system.equals( this.address.getTransition( ) )) + try{ + this.address.clearPending( ); ++ } catch(IllegalStateException t) { ++ LOG.trace(t); + } catch(Throwable t) { + LOG.error(t,t) + } finally { +@@ -141,6 +144,8 @@ + try { + VmInstance vm = VmInstances.getInstance( ).lookupByInstanceIp( super.getRequest().getDestination() ); + vm.getNetworkConfig().setIgnoredPublicIp( VmInstance.DEFAULT_IP ); ++ } catch(IllegalStateException t) { ++ LOG.trace(t); + } catch( Throwable t ) { + LOG.debug(t,t); + } finally { +--- a/clc/modules/cluster-manager/src/main/java/edu/ucsb/eucalyptus/cloud/cluster/VmInstances.java ++++ b/clc/modules/cluster-manager/src/main/java/edu/ucsb/eucalyptus/cloud/cluster/VmInstances.java +@@ -97,7 +97,7 @@ + do { + MessageDigest digest = Hashes.Digest.MD5.get(); + digest.reset(); +- digest.update( Long.toString( rsvId + launchIndex + System.currentTimeMillis() ).getBytes() ); ++ digest.update( Long.toString( rsvId + launchIndex + System.nanoTime( ) ).getBytes() ); + + Adler32 hash = new Adler32(); + hash.reset(); +@@ -125,6 +125,16 @@ + throw new NoSuchElementException( "Can't find registered object with ip:" + ip + " in " + this.getClass( ).getSimpleName( ) ); + } + ++ public int countByPublicIp( String ip ) throws NoSuchElementException { ++ int count = 0; ++ for ( VmInstance vm : this.listValues( ) ) { ++ if ( ip.equals( vm.getNetworkConfig().getIgnoredPublicIp( ) ) && ( VmState.PENDING.equals( vm.getState( ) ) || VmState.RUNNING.equals( vm.getState( ) ) ) ) { ++ count++; ++ } ++ } ++ return count; ++ } ++ + public VmInstance lookupByPublicIp ( String ip ) throws NoSuchElementException { + for( VmInstance vm : this.listValues( ) ) { + if( ip.equals( vm.getNetworkConfig( ).getIgnoredPublicIp( ) ) ) { +--- a/clc/modules/cluster-manager/src/main/java/edu/ucsb/eucalyptus/cloud/ws/SystemState.java ++++ b/clc/modules/cluster-manager/src/main/java/edu/ucsb/eucalyptus/cloud/ws/SystemState.java +@@ -73,6 +73,7 @@ + import com.eucalyptus.address.Address; + import com.eucalyptus.address.AddressCategory; + import com.eucalyptus.address.Addresses; ++import com.eucalyptus.address.Address.Transition; + import com.eucalyptus.bootstrap.Component; + import com.eucalyptus.cluster.Cluster; + import com.eucalyptus.cluster.Clusters; +@@ -205,9 +206,9 @@ + private static UnconditionalCallback getCleanUpCallback( final Address address, final VmInstance vm, final int networkIndex, final String networkFqName, final Cluster cluster ) { + UnconditionalCallback cleanup = new UnconditionalCallback( ) { + public void apply( ) { +- if( address != null ) { ++ if( address != null && address.getInstanceId( ).equals( vm.getInstanceId( ) ) && !address.isPending() ) { + try { +- if ( address.isSystemOwned( ) ) { ++ if ( address.isSystemOwned() && !Address.UNASSIGNED_INSTANCEID.equals( address.getInstanceId() ) ) { + LOG.debug( EventRecord.caller( SystemState.class, EventType.VM_TERMINATING, "SYSTEM_ADDRESS", address.toString( ) ) ); + Addresses.release( address ); + } else { +@@ -308,6 +309,11 @@ + } + + private static void restoreInstance( final String cluster, final VmInfo runVm ) { ++ if( VmState.TERMINATED.equals( VmState.Mapper.get( runVm.getStateName( ) ) ) ++ || VmState.BURIED.equals( VmState.Mapper.get( runVm.getStateName( ) ) ) ++ || VmState.SHUTTING_DOWN.equals( VmState.Mapper.get( runVm.getStateName( ) ) ) ) { ++ return; ++ } + try { + String instanceId = runVm.getInstanceId( ), reservationId = runVm.getReservationId( ), ownerId = runVm.getOwnerId( ), placement = cluster, userData = runVm + .getUserData( ); +--- a/clc/modules/wsstack/src/main/java/com/eucalyptus/ws/handlers/ChannelStateMonitor.java ++++ b/clc/modules/wsstack/src/main/java/com/eucalyptus/ws/handlers/ChannelStateMonitor.java +@@ -31,10 +31,9 @@ + Long rb = readBytes.getAndSet( 0l ); + Long wb = writeBytes.getAndSet( 0l ); + Long roundTime = ( System.currentTimeMillis( ) - this.openTime.getAndSet( 0 ) ); +- LOG.trace( EventRecord.here( ctx.getPipeline( ).getLast( ).getClass( ), +- EventType.SOCKET_CLOSE, roundTime.toString( ), ctx.getChannel( ).getLocalAddress( ).toString( ), ctx.getChannel( ).getRemoteAddress( ).toString( ), +- EventType.SOCKET_BYTES_READ.toString( ), rb.toString( ), Float.toString( ( wb * 1024.0f ) / ( roundTime * 1024.0f ) ), +- EventType.SOCKET_BYTES_WRITE.toString( ), wb.toString( ), Float.toString( ( wb * 1024.0f ) / ( roundTime * 1024.0f ) ) ) ); ++ LOG.trace( EventRecord.here( ctx.getPipeline( ).getLast( ).getClass( ), EventType.SOCKET_CLOSE, ""+roundTime.toString( ), ""+ctx.getChannel( ).getLocalAddress( ), ""+ctx.getChannel( ).getRemoteAddress( ) ) ); ++ LOG.trace( EventRecord.here( ctx.getPipeline( ).getLast( ).getClass( ), EventType.SOCKET_BYTES_READ.toString( ), ""+rb, Float.toString( ( wb * 1024.0f ) / ( roundTime * 1024.0f ) ) ) ); ++ LOG.trace( EventRecord.here( ctx.getPipeline( ).getLast( ).getClass( ), EventType.SOCKET_BYTES_WRITE.toString( ), ""+wb, Float.toString( ( wb * 1024.0f ) / ( roundTime * 1024.0f ) ) ) ); + } + + @Override +@@ -46,7 +45,7 @@ + @Override + public void channelConnected( ChannelHandlerContext ctx, ChannelStateEvent e ) throws Exception { + openTime.getAndSet( System.currentTimeMillis( ) ); +- LOG.trace( EventRecord.here( ctx.getPipeline( ).getLast( ).getClass( ), EventType.SOCKET_OPEN, ctx.getChannel( ).getLocalAddress( ).toString( ), ctx.getChannel( ).getRemoteAddress( ).toString( ) ) ); ++ LOG.trace( EventRecord.here( ctx.getPipeline( ).getLast( ).getClass( ), EventType.SOCKET_OPEN, ""+ctx.getChannel( ).getLocalAddress( ), ""+ctx.getChannel( ).getRemoteAddress( ) ) ); + super.channelConnected( ctx, e ); + } + +--- a/cluster/handlers.c ++++ b/cluster/handlers.c +@@ -1609,7 +1609,8 @@ + } else { + close(filedes[1]); + close(filedes[0]); +- rc = 0; ++ timewait(pid, &status, 10); ++ rc = WEXITSTATUS(status); + logprintfl(EUCADEBUG,"RunInstances(): call complete (pid/rc): %d/%d\n", pid, rc); + } + if (rc != 0) { +--- a/node/handlers_default.c ++++ b/node/handlers_default.c +@@ -169,10 +169,12 @@ + + /* change the state and let the monitoring_thread clean up state */ + sem_p (inst_sem); +- if (instance->state==BOOTING || instance->state==STAGING) { ++ if (instance->state!=TEARDOWN) { // do not leave TEARDOWN ++ if (instance->state==STAGING) { + change_state (instance, CANCELED); +- } else { ++ } else { + change_state (instance, SHUTOFF); ++ } + } + sem_v (inst_sem); + *previousState = instance->stateCode; === modified file 'debian/patches/series' --- debian/patches/series 2010-01-04 11:24:00 +0000 +++ debian/patches/series 2010-06-29 23:10:06 +0000 @@ -1,1 +1,2 @@ 01-wsdl-stubs.patch +lp566792-metadata-service.patch