@Singleton public class ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet extends CreateNodesWithGroupEncodedIntoNameThenAddToSet
CreateNodesWithGroupEncodedIntoNameThenAddToSet.AddNode
Modifier and Type | Field and Description |
---|---|
static String |
JCLOUDS_KP |
static String |
JCLOUDS_SG |
protected com.google.common.cache.LoadingCache<RegionAndName,KeyPair> |
keyPairCache |
protected NovaApi |
novaApi |
protected com.google.common.cache.LoadingCache<RegionAndName,SecurityGroupInRegion> |
securityGroupCache |
addNodeWithGroupStrategy, customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory, listNodesStrategy, logger, namingConvention, userExecutor
Modifier | Constructor and Description |
---|---|
protected |
ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet(CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy,
ListNodesStrategy listNodesStrategy,
GroupNamingConvention.Factory namingConvention,
CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory,
com.google.common.util.concurrent.ListeningExecutorService userExecutor,
AllocateAndAddFloatingIpToNode createAndAddFloatingIpToNode,
com.google.common.cache.LoadingCache<RegionAndName,SecurityGroupInRegion> securityGroupCache,
com.google.common.cache.LoadingCache<RegionAndName,KeyPair> keyPairCache,
NovaApi novaApi) |
Modifier and Type | Method and Description |
---|---|
protected com.google.common.util.concurrent.ListenableFuture<AtomicReference<NodeMetadata>> |
createNodeInGroupWithNameAndTemplate(String group,
String name,
Template template)
This calls logic necessary to create a node and convert it from its provider-specific object
to the jclouds
NodeMetadata object. |
Map<?,com.google.common.util.concurrent.ListenableFuture<Void>> |
execute(String group,
int count,
Template template,
Set<NodeMetadata> goodNodes,
Map<NodeMetadata,Exception> badNodes,
com.google.common.collect.Multimap<NodeMetadata,CustomizationResponse> customizationResponses)
This implementation gets a list of acceptable node names to encode the group into, then it
simultaneously runs the nodes and applies options to them.
|
getNextNames
public static final String JCLOUDS_SG
public static final String JCLOUDS_KP
protected final com.google.common.cache.LoadingCache<RegionAndName,SecurityGroupInRegion> securityGroupCache
protected final com.google.common.cache.LoadingCache<RegionAndName,KeyPair> keyPairCache
protected final NovaApi novaApi
@Inject protected ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet(CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy, ListNodesStrategy listNodesStrategy, GroupNamingConvention.Factory namingConvention, CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory, @Named(value="jclouds.user-threads") com.google.common.util.concurrent.ListeningExecutorService userExecutor, AllocateAndAddFloatingIpToNode createAndAddFloatingIpToNode, com.google.common.cache.LoadingCache<RegionAndName,SecurityGroupInRegion> securityGroupCache, com.google.common.cache.LoadingCache<RegionAndName,KeyPair> keyPairCache, NovaApi novaApi)
public Map<?,com.google.common.util.concurrent.ListenableFuture<Void>> execute(String group, int count, Template template, Set<NodeMetadata> goodNodes, Map<NodeMetadata,Exception> badNodes, com.google.common.collect.Multimap<NodeMetadata,CustomizationResponse> customizationResponses)
CreateNodesWithGroupEncodedIntoNameThenAddToSet
execute
in interface CreateNodesInGroupThenAddToSet
execute
in class CreateNodesWithGroupEncodedIntoNameThenAddToSet
protected com.google.common.util.concurrent.ListenableFuture<AtomicReference<NodeMetadata>> createNodeInGroupWithNameAndTemplate(String group, String name, Template template)
CreateNodesWithGroupEncodedIntoNameThenAddToSet
NodeMetadata
object. This call directly precedes customization, such as
executing scripts.
The outcome of this operation does not imply the node is running
. If you want to insert logic after the node is created, yet before an attempt to
customize the node, then append your behaviour to this method.
ex. to attach an ip address post-creation
@Override protected ListenableFuture<AtomicReference<NodeMetadata>> createNodeInGroupWithNameAndTemplate(String group, String name, Template template) { ListenableFuture<AtomicReference<NodeMetadata>> future = super.addNodeIntoGroupWithNameAndTemplate(group, name, template); return Futures.compose(future, new Function<AtomicReference<NodeMetadata>, AtomicReference<NodeMetadata>>() { @Override public AtomicReference<NodeMetadata> apply(AtomicReference<NodeMetadata> input) { NodeMetadata node = input.get(); // allocate and attach an ip input.set(NodeMetadataBuilder.fromNodeMetadata(node).publicAddresses(ImmutableSet.of(ip.getIp())).build()); return input; } }, executor); }
createNodeInGroupWithNameAndTemplate
in class CreateNodesWithGroupEncodedIntoNameThenAddToSet
group
- group the node belongs toname
- generated name of the nodetemplate
- user-specified templateStatus#RUNNING
Copyright © 2009-2016 The Apache Software Foundation. All Rights Reserved.