Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes EUCA-2327 Duplicate address assignments to the same instance

  • Loading branch information...
commit 9f21aa5aa4c5e2ac4eeb80aec305226ef85d11cd 1 parent c406ffc
Michael Munn authored
View
8 clc/modules/cluster-manager/src/main/java/com/eucalyptus/address/AddressManager.java
@@ -166,9 +166,9 @@ public AssociateAddressResponseType associate( final AssociateAddressType reques
reply.set_return( false );
final Address address = RestrictedTypes.doPrivileged( request.getPublicIp( ), Address.class );
if ( !address.isAllocated( ) ) {
- throw new EucalyptusCloudException( "Cannot associated an address which is not allocated: " + request.getPublicIp( ) );
+ throw new EucalyptusCloudException( "Cannot associate an address which is not allocated: " + request.getPublicIp( ) );
} else if ( !Contexts.lookup( ).hasAdministrativePrivileges( ) && !Contexts.lookup( ).getUserFullName( ).asAccountFullName( ).getAccountNumber( ).equals( address.getOwner( ).getAccountNumber( ) ) ) {
- throw new EucalyptusCloudException( "Cannot associated an address which is not allocated to your account: " + request.getPublicIp( ) );
+ throw new EucalyptusCloudException( "Cannot associate an address which is not allocated to your account: " + request.getPublicIp( ) );
}
final VmInstance vm = RestrictedTypes.doPrivileged( request.getInstanceId( ), VmInstance.class );
final VmInstance oldVm = findCurrentAssignedVm( address );
@@ -178,6 +178,10 @@ public AssociateAddressResponseType associate( final AssociateAddressType reques
: false;
reply.set_return( true );
+ if ( oldAddr != null && address.equals( oldAddr ) ) {
+ return reply;
+ }
+
final UnconditionalCallback assignTarget = new UnconditionalCallback( ) {
public void fire( ) {
AsyncRequests.newRequest( address.assign( vm ).getCallback( ) ).then( new Callback.Success<BaseMessage>( ) {
Please sign in to comment.
Something went wrong with that request. Please try again.