Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
fix IP address reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
decker committed Feb 17, 2009
1 parent 5fb065b commit 77351d3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ public VmInstance( final String reservationId, final int launchIndex, final Stri
this.instanceId.substring( 8, 10 ) );
this.networkConfig.setMacAddress( "d0:0d:" + mac );
this.networkConfig.setIgnoredMacAddress( "d0:0f:" + mac );
this.networkConfig.setIpAddress( "0.0.0.0" );
this.networkConfig.setIgnoredPublicIp( "0.0.0.0" );
this.networkConfig.setIpAddress( DEFAULT_IP );
this.networkConfig.setIgnoredPublicIp( DEFAULT_IP );
}

public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ public void process( final Client clusterClient, final VmRunType msg ) throws Ex
Clusters.getInstance().lookup( token.getCluster() ).getState().redeemToken( token );
LOG.info( String.format( EucalyptusProperties.DEBUG_FSTRING, EucalyptusProperties.TokenState.redeemed, token ) );
if ( reply.get_return() ) {
for ( VmInfo vmInfo : reply.getVms() )
for ( VmInfo vmInfo : reply.getVms() ) {
VmInstances.getInstance().lookup( vmInfo.getInstanceId() ).getNetworkConfig().setIpAddress( vmInfo.getNetParams().getIpAddress() );
VmInstances.getInstance().lookup( vmInfo.getInstanceId() ).getNetworkConfig().setIgnoredPublicIp( vmInfo.getNetParams().getIgnoredPublicIp() );
}
} else {
this.parent.getRollback().lazySet( true );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ private static void updateVmInstance( final String originCluster, final VmInfo r
return;
} else {
vm.resetStopWatch();
//:: this is ridiculous, throwing away all but 2 pieces of state :://
vm.getNetworkConfig().setIpAddress( runVm.getNetParams().getIpAddress() );
if( !VmInstance.DEFAULT_IP.equals( runVm.getNetParams().getIpAddress() ) && !"".equals( runVm.getNetParams().getIpAddress() ) && runVm.getNetParams().getIpAddress() != null )
vm.getNetworkConfig().setIpAddress( runVm.getNetParams().getIpAddress() );
if( !VmInstance.DEFAULT_IP.equals( runVm.getNetParams().getIgnoredPublicIp() ) && !"".equals( runVm.getNetParams().getIgnoredPublicIp() ) && runVm.getNetParams().getIgnoredPublicIp() != null )
vm.getNetworkConfig().setIgnoredPublicIp( runVm.getNetParams().getIpAddress() );
vm.setState( VmState.Mapper.get( runVm.getStateName() ) );
for( AttachedVolume vol : runVm.getVolumes() ) {
for ( AttachedVolume vol : runVm.getVolumes() ) {
vol.setInstanceId( vm.getInstanceId() );
}
vm.setVolumes( runVm.getVolumes() );
Expand Down Expand Up @@ -186,7 +188,8 @@ public static TerminateInstancesResponseType handle( TerminateInstancesType requ
v.resetStopWatch();
SystemState.cleanUp( v );
} catch ( NoSuchElementException e ) {
throw new EucalyptusCloudException( e );
LOG.debug( e, e );
throw new EucalyptusCloudException( e.getMessage() );
}
}
return reply;
Expand All @@ -209,6 +212,9 @@ public static TerminateInstancesResponseType handle( TerminateInstancesType requ
SystemState.cleanUp( v );
}
}
} catch ( Exception e ) {
LOG.debug( e, e );
throw new EucalyptusCloudException( e );
} finally {
state.destroy();
}
Expand Down Expand Up @@ -276,7 +282,7 @@ public static void handle( GetConsoleOutputType request ) throws Exception {
if ( request.isAdministrator() || v.getOwnerId().equals( request.getUserId() ) ) {
cluster = Clusters.getInstance().lookup( v.getPlacement() );
}
if( VmState.RUNNING.equals( v.getState() ) )
if ( VmState.RUNNING.equals( v.getState() ) )
throw new NoSuchElementException( "Instance " + request.getInstanceId() + " is not in a running state." );
QueuedEvent<GetConsoleOutputType> event = new QueuedEvent<GetConsoleOutputType>( new ConsoleOutputCallback( cluster ), request );
cluster.getMessageQueue().enqueue( event );
Expand Down

0 comments on commit 77351d3

Please sign in to comment.