mirror of https://github.com/apache/jclouds.git
openstack-nova-ec2 errors on authorizing security group to itself, and also needs to auto-allocate elastic ips
This commit is contained in:
parent
dca3631aad
commit
c1dd80f9b3
|
@ -50,6 +50,10 @@ public class NovaEC2PropertiesBuilder extends EC2PropertiesBuilder {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,9 @@ package org.jclouds.openstack.nova.ec2.config;
|
|||
|
||||
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 @@ public class NovaEC2ComputeServiceContextModule extends EC2ComputeServiceContext
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue