Permalink
Browse files

fix to restoring address mappings

  • Loading branch information...
1 parent e0273b1 commit 3127064ce9c7d766c1bf3effbac5cb77fbf6bed6 @grze grze committed Feb 2, 2012
@@ -270,20 +270,22 @@ private static VmInstance maybeFindVm( final String instanceId, final String pub
} catch ( NoSuchElementException ex ) {
Logs.extreme( ).error( ex );
}
- } else if ( privateIp != null ) {
+ }
+ if ( vm == null && privateIp != null ) {
try {
vm = VmInstances.lookupByPrivateIp( privateIp );
} catch ( NoSuchElementException ex ) {
Logs.extreme( ).error( ex );
}
- } else if ( publicIp != null ) {
+ }
+ if ( vm == null && publicIp != null ) {
try {
vm = VmInstances.lookupByPublicIp( publicIp );
} catch ( NoSuchElementException ex ) {
Logs.extreme( ).error( ex );
}
}
- if ( vm != null ) {
+ if ( vm != null && VmState.RUNNING.equals( vm ) ) {
Logs.extreme( ).debug( "Candidate vm which claims this address: " + vm.getInstanceId( ) + " " + vm.getState( ) + " " + publicIp );
if ( publicIp.equals( vm.getPublicAddress( ) ) ) {
Logs.extreme( ).debug( "Found vm which claims this address: " + vm.getInstanceId( ) + " " + vm.getState( ) + " " + publicIp );

0 comments on commit 3127064

Please sign in to comment.