Class NovaTemplateOptions
- java.lang.Object
-
- org.jclouds.compute.options.RunScriptOptions
-
- org.jclouds.compute.options.TemplateOptions
-
- org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions
-
- All Implemented Interfaces:
Cloneable
public class NovaTemplateOptions extends TemplateOptions implements Cloneable
Contains options supported in theComputeService#runNode
operation on the "openstack-nova" provider.Usage
The recommended way to instantiate a NovaTemplateOptions object is to statically import NovaTemplateOptions.* and invoke a static creation method followed by an instance mutator (if needed):import static org.jclouds.aws.ec2.compute.options.NovaTemplateOptions.Builder.*; ComputeService api = // get connection templateBuilder.options(inboundPorts(22, 80, 8080, 443)); Set extends NodeMetadata> set = api.createNodesInGroup(tag, 2, templateBuilder.build());
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NovaTemplateOptions.Builder
-
Nested classes/interfaces inherited from class org.jclouds.compute.options.TemplateOptions
TemplateOptions.ImmutableTemplateOptions
-
Nested classes/interfaces inherited from class org.jclouds.compute.options.RunScriptOptions
RunScriptOptions.ImmutableRunScriptOptions
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
autoAssignFloatingIp
protected String
availabilityZone
protected Set<BlockDeviceMapping>
blockDeviceMappings
protected boolean
configDrive
protected String
diskConfig
protected com.google.common.base.Optional<Set<String>>
floatingIpPoolNames
protected boolean
generateKeyPair
protected String
keyPairName
protected Set<Network>
novaNetworks
protected byte[]
userData
-
Fields inherited from class org.jclouds.compute.options.TemplateOptions
blockUntilRunning, inboundPorts, networks, nodeNames, NONE, privateKey, publicKey, script, securityGroups, tags, userMetadata
-
Fields inherited from class org.jclouds.compute.options.RunScriptOptions
authenticateSudo, blockOnComplete, loginPassword, loginPrivateKey, loginUser, port, runAsRoot, seconds, taskName, wrapInInitScript
-
-
Constructor Summary
Constructors Constructor Description NovaTemplateOptions()
-
Method Summary
-
Methods inherited from class org.jclouds.compute.options.TemplateOptions
as, blockOnComplete, getGroups, getInboundPorts, getNetworks, getNodeNames, getPrivateKey, getPublicKey, getRunScript, getTags, getUserMetadata, runScript, securityGroups, securityGroups, shouldBlockUntilRunning, tags, wrapInInitScript
-
Methods inherited from class org.jclouds.compute.options.RunScriptOptions
copyTo, getLoginPassword, getLoginPrivateKey, getLoginUser, getPort, getSeconds, getTaskName, hasLoginPassword, hasLoginPasswordOption, hasLoginPrivateKey, hasLoginPrivateKeyOption, overrideLoginPassword, overrideLoginPrivateKey, shouldAuthenticateSudo, shouldBlockOnComplete, shouldRunAsRoot, shouldWrapInInitScript, toString
-
-
-
-
Field Detail
-
autoAssignFloatingIp
protected boolean autoAssignFloatingIp
-
generateKeyPair
protected boolean generateKeyPair
-
keyPairName
protected String keyPairName
-
userData
protected byte[] userData
-
diskConfig
protected String diskConfig
-
configDrive
protected boolean configDrive
-
availabilityZone
protected String availabilityZone
-
blockDeviceMappings
protected Set<BlockDeviceMapping> blockDeviceMappings
-
-
Method Detail
-
clone
public NovaTemplateOptions clone()
- Overrides:
clone
in classTemplateOptions
-
copyTo
public void copyTo(TemplateOptions to)
- Overrides:
copyTo
in classTemplateOptions
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classTemplateOptions
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classTemplateOptions
-
string
public com.google.common.base.MoreObjects.ToStringHelper string()
- Overrides:
string
in classTemplateOptions
-
autoAssignFloatingIp
public NovaTemplateOptions autoAssignFloatingIp(boolean enable)
- See Also:
getFloatingIpPoolNames()
-
floatingIpPoolNames
public NovaTemplateOptions floatingIpPoolNames(String... floatingIpPoolNames)
- See Also:
getFloatingIpPoolNames()
-
floatingIpPoolNames
public NovaTemplateOptions floatingIpPoolNames(Iterable<String> floatingIpPoolNames)
- See Also:
getFloatingIpPoolNames()
-
generateKeyPair
public NovaTemplateOptions generateKeyPair(boolean enable)
- See Also:
shouldGenerateKeyPair()
-
keyPairName
public NovaTemplateOptions keyPairName(String keyPairName)
- See Also:
shouldGenerateKeyPair()
-
shouldAutoAssignFloatingIp
public boolean shouldAutoAssignFloatingIp()
- Returns:
- true if auto assignment of a floating ip to each vm is enabled
-
availabilityZone
public NovaTemplateOptions availabilityZone(String availabilityZone)
-
blockDeviceMappings
public NovaTemplateOptions blockDeviceMappings(BlockDeviceMapping... blockDeviceMappings)
- See Also:
getBlockDeviceMappings()
-
blockDeviceMappings
public NovaTemplateOptions blockDeviceMappings(Iterable<BlockDeviceMapping> blockDeviceMappings)
- See Also:
getBlockDeviceMappings()
-
getFloatingIpPoolNames
public com.google.common.base.Optional<Set<String>> getFloatingIpPoolNames()
The floating IP pool name(s) to use when allocating a FloatingIP. Applicable only if #shouldAutoAssignFloatingIp() returns true. If not set will attempt to use whatever FloatingIP(s) can be found regardless of which pool they originated from- Returns:
- floating-ip-pool names to use
-
getKeyPairName
public String getKeyPairName()
Specifies the keypair used to run instances with- Returns:
- the keypair to be used
-
shouldGenerateKeyPair
public boolean shouldGenerateKeyPair()
- Returns:
- true if auto generation of keypairs is enabled
-
getUserData
public byte[] getUserData()
-
getDiskConfig
public String getDiskConfig()
- See Also:
CreateServerOptions.getDiskConfig()
-
getConfigDrive
public boolean getConfigDrive()
- See Also:
CreateServerOptions.getConfigDrive()
-
getNovaNetworks
public Set<Network> getNovaNetworks()
- See Also:
CreateServerOptions.getNetworks()
-
getAvailabilityZone
public String getAvailabilityZone()
-
getBlockDeviceMappings
public Set<BlockDeviceMapping> getBlockDeviceMappings()
-
blockOnPort
public NovaTemplateOptions blockOnPort(int port, int seconds)
When the node is started, wait until the following port is active- Overrides:
blockOnPort
in classTemplateOptions
-
inboundPorts
public NovaTemplateOptions inboundPorts(int... ports)
Opens the set of ports to public access.- Overrides:
inboundPorts
in classTemplateOptions
-
authorizePublicKey
public NovaTemplateOptions authorizePublicKey(String publicKey)
authorize an rsa ssh key.- Overrides:
authorizePublicKey
in classTemplateOptions
-
installPrivateKey
public NovaTemplateOptions installPrivateKey(String privateKey)
replaces the rsa ssh key used at login.- Overrides:
installPrivateKey
in classTemplateOptions
-
blockUntilRunning
public NovaTemplateOptions blockUntilRunning(boolean blockUntilRunning)
Note
As of version 1.1.0, this option is incompatible withTemplateOptions.runScript(Statement)
andRunScriptOptions.blockOnComplete(boolean)
, as all current implementations utilize ssh in order to execute scripts.- Overrides:
blockUntilRunning
in classTemplateOptions
- Parameters:
blockUntilRunning
- (default true) whether to block until the nodes in this template are inStatus#RUNNING
state
-
dontAuthorizePublicKey
public NovaTemplateOptions dontAuthorizePublicKey()
- Overrides:
dontAuthorizePublicKey
in classTemplateOptions
-
nameTask
public NovaTemplateOptions nameTask(String name)
- Overrides:
nameTask
in classTemplateOptions
- Returns:
- What to call the task relating to this script; default
jclouds-script-timestamp
where timestamp is millis since epoch
-
runAsRoot
public NovaTemplateOptions runAsRoot(boolean runAsRoot)
- Overrides:
runAsRoot
in classTemplateOptions
-
runScript
public NovaTemplateOptions runScript(Statement script)
This script will be executed as the root user upon system startup. This script gets a prologue, so no #!/bin/bash required, path set up, etc- Overrides:
runScript
in classTemplateOptions
-
overrideLoginCredentials
public NovaTemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials)
- Overrides:
overrideLoginCredentials
in classTemplateOptions
-
overrideLoginPassword
public NovaTemplateOptions overrideLoginPassword(String password)
- Overrides:
overrideLoginPassword
in classTemplateOptions
-
overrideLoginPrivateKey
public NovaTemplateOptions overrideLoginPrivateKey(String privateKey)
- Overrides:
overrideLoginPrivateKey
in classTemplateOptions
-
overrideLoginUser
public NovaTemplateOptions overrideLoginUser(String loginUser)
- Overrides:
overrideLoginUser
in classTemplateOptions
-
overrideAuthenticateSudo
public NovaTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo)
- Overrides:
overrideAuthenticateSudo
in classTemplateOptions
-
userMetadata
public NovaTemplateOptions userMetadata(Map<String,String> userMetadata)
- Overrides:
userMetadata
in classTemplateOptions
- Parameters:
userMetadata
- user-defined metadata to assign to this server
-
userMetadata
public NovaTemplateOptions userMetadata(String key, String value)
- Overrides:
userMetadata
in classTemplateOptions
- Parameters:
key
- key to place into the metadata mapvalue
- value to associate with that key
-
nodeNames
public NovaTemplateOptions nodeNames(Iterable<String> nodeNames)
specifies names to be used for the created nodes. Note that this does not guarantee uniqueness - if there are already existing nodes with a name specified here, there will still be a new node created with the same name. Also, if more nodes are to be created than there are names, subsequent names will use the default naming strategy for that cloud.- Overrides:
nodeNames
in classTemplateOptions
-
networks
public NovaTemplateOptions networks(Iterable<String> networks)
Ensures NovaTemplateOptions can work with networks specified as Strings. Also provides for compatibility with the abstraction layer.- Overrides:
networks
in classTemplateOptions
-
networks
public NovaTemplateOptions networks(String... networks)
Ensures NovaTemplateOptions can work with networks specified as Strings. Also provides for compatibility with the abstraction layer.- Overrides:
networks
in classTemplateOptions
- See Also:
TemplateOptions.networks(Iterable)
-
userData
public NovaTemplateOptions userData(byte[] userData)
User data as bytes (not base64-encoded)
-
diskConfig
public NovaTemplateOptions diskConfig(String diskConfig)
- See Also:
CreateServerOptions.getDiskConfig()
-
configDrive
public NovaTemplateOptions configDrive(boolean configDrive)
OpenStack can be configured to write metadata to a special configuration drive that will be attached to the instance when it boots. The instance can retrieve any information that would normally be available through the metadata service by mounting this disk and reading files from it. To enable the config drive, set this parameter to "true". This has to be enabled for user data cases.- See Also:
CreateServerOptions.getConfigDrive()
-
novaNetworks
public NovaTemplateOptions novaNetworks(Set<Network> novaNetworks)
- Parameters:
novaNetworks
- The list of network declarations. Nova-specific network declarations allow for specifying network UUIDs, port UUIDs, and fixed IPs. Unlinenetworks(Iterable)
this supports setting additional network parameters and not just network UUIDs.- See Also:
CreateServerOptions.getNetworks()
-
-