openstack-nova-ec2 errors on authorizing security group to itself, and also needs to auto-allocate elastic ips
diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2PropertiesBuilder.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2PropertiesBuilder.java
index fbf3a8a..41c4b59 100644
--- a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2PropertiesBuilder.java
+++ b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2PropertiesBuilder.java
@@ -50,6 +50,10 @@
       properties.setProperty(PROPERTY_RELAX_HOSTNAME, "true");
       properties.setProperty(PROPERTY_TRUST_ALL_CERTS, "true");
       properties.setProperty(PROPERTY_EC2_AUTO_ALLOCATE_ELASTIC_IPS, "true");
+      // auth fail sometimes happens in EC2, as the rc.local script that injects the
+      // authorized key executes after ssh has started.  
+      properties.setProperty("jclouds.ssh.max-retries", "7");
+      properties.setProperty("jclouds.ssh.retry-auth", "true");
       return properties;
    }
 
diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/config/NovaEC2ComputeServiceContextModule.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/config/NovaEC2ComputeServiceContextModule.java
index 5d2242a..5e8b50c 100644
--- a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/config/NovaEC2ComputeServiceContextModule.java
+++ b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/config/NovaEC2ComputeServiceContextModule.java
@@ -20,7 +20,9 @@
 
 import org.jclouds.compute.domain.OperatingSystem;
 import org.jclouds.ec2.compute.config.EC2ComputeServiceContextModule;
+import org.jclouds.ec2.compute.loaders.CreateSecurityGroupIfNeeded;
 import org.jclouds.ec2.compute.strategy.ReviseParsedImage;
+import org.jclouds.openstack.nova.ec2.loaders.NovaCreateSecurityGroupIfNeeded;
 import org.jclouds.openstack.nova.ec2.strategy.NovaReviseParsedImage;
 import org.jclouds.openstack.nova.v1_1.compute.functions.ImageToOperatingSystem;
 
@@ -39,6 +41,7 @@
       bind(new TypeLiteral<Function<org.jclouds.openstack.nova.v1_1.domain.Image, OperatingSystem>>() {
       }).to(ImageToOperatingSystem.class);
       bind(ReviseParsedImage.class).to(NovaReviseParsedImage.class);
+      bind(CreateSecurityGroupIfNeeded.class).to(NovaCreateSecurityGroupIfNeeded.class);
    }
 
 }
diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/loaders/NovaCreateSecurityGroupIfNeeded.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/loaders/NovaCreateSecurityGroupIfNeeded.java
new file mode 100644
index 0000000..c702534
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/loaders/NovaCreateSecurityGroupIfNeeded.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.nova.ec2.loaders;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.aws.AWSResponseException;
+import org.jclouds.ec2.EC2Client;
+import org.jclouds.ec2.compute.domain.RegionAndName;
+import org.jclouds.ec2.compute.loaders.CreateSecurityGroupIfNeeded;
+
+import com.google.common.base.Predicate;
+
+/**
+ * 
+ * @author Adrian Cole
+ */
+@Singleton
+public class NovaCreateSecurityGroupIfNeeded extends CreateSecurityGroupIfNeeded {
+
+   @Inject
+   public NovaCreateSecurityGroupIfNeeded(EC2Client ec2Client,
+            @Named("SECURITY") Predicate<RegionAndName> securityGroupEventualConsistencyDelay) {
+      super(checkNotNull(ec2Client, "ec2Client").getSecurityGroupServices(), securityGroupEventualConsistencyDelay);
+   }
+
+   protected void authorizeGroupToItself(String region, String name) {
+      try {
+         super.authorizeGroupToItself(region, name);
+      } catch (AWSResponseException e) {
+         logger.warn(e, "<< error authorizing securityGroup(%s)", name);
+      }
+   }
+
+}