OpenStack Nova
| Deprecated: This openstack-nova is deprecated and may be removed in a future release. |
Since Camel 2.19
Only producer is supported
The Openstack Nova component allows messages to be sent to an OpenStack compute services.
Dependencies
Maven users will need to add the following dependency to their pom.xml.
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-openstack</artifactId>
<version>${camel-version}</version>
</dependency> where ${camel-version} must be replaced by the actual version of Camel.
Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties,*.yamlfiles, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The OpenStack Nova component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean |
Endpoint Options
The OpenStack Nova endpoint is configured using URI syntax:
openstack-nova:host
With the following path and query parameters:
Path Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Required The URL of the OpenStack Identity service (Keystone) to authenticate with, for example http://controller:5000/v3. | String |
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
The version of the OpenStack Identity API to authenticate with: V3 or V2. Enum values:
| V3 | String | |
The openstack4j client configuration (org.openstack4j.core.transport.Config), for example to set connection and read timeouts, an SSLContext or a proxy. When not set, the openstack4j defaults are used. | Config | ||
The name of the domain the user belongs to, used to authenticate with Identity API V3 (not used with V2). | default | String | |
The operation to perform: create, get, getAll or delete; servers also support createSnapshot and action. | String | ||
Required The password of the OpenStack user. | String | ||
Required The ID of the project to scope the authentication to (the tenant ID with Identity API V2). | String | ||
Required The kind of Nova resource to manage: flavors, servers or keypairs. Enum values:
| String | ||
Required The name of the OpenStack user to authenticate as. | String | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean |
Message Headers
The OpenStack Nova component supports the following message header(s), which is/are listed below:
| Name | Description | Default | Type |
|---|---|---|---|
CamelOpenstackNovaFlavorId (flavor server) Constant: | ID of the flavor. | String | |
CamelOpenstackNovaRam (flavor) Constant: | The amount of RAM of the flavor in MB. | Integer | |
CamelOpenstackNovaVcpu (flavor) Constant: | The number of virtual CPUs of the flavor. | Integer | |
CamelOpenstackNovaDisk (flavor) Constant: | The size of the root disk of the flavor in GB. | Integer | |
CamelOpenstackNovaSwap (flavor) Constant: | The size of the swap space of the flavor in MB. | Integer | |
CamelOpenstackNovaRxtxFactor (flavor) Constant: | The receive/transmit (RX/TX) factor of the flavor. | Integer | |
CamelOpenstackNovaAdminPassword (server) Constant: | Admin password of the new server. | String | |
CamelOpenstackNovaImageId (server) Constant: | The ID of the image to boot the server from. | String | |
CamelOpenstackNovaKeypairName (server) Constant: | The name of the key pair whose public key is placed on the server when it is created. | String | |
CamelOpenstackNovaNetworkId (server) Constant: | The IDs of the networks to attach the server to. | List | |
CamelOpenstackNovaAction (server) Constant: | The action to perform on the server, such as START, STOP, PAUSE or SUSPEND. Enum values:
| Action | |
CamelOpenstackOperation (producer) Constant: | The operation to perform. | String | |
| Constant: | The ID of the resource to act on. | String | |
| Constant: | The name of the resource, such as the volume, image or server to create, or the key pair or container to act on. | String |
Message Body
The message body at each side of the OpenStack Nova component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.
| Side | Body | Description |
|---|---|---|
Producer input |
| Read by create only: a Flavor or ServerCreate of openstack4j, or else the fields from headers such as CamelOpenstackName; for keypairs the public key as text, or no body to have the key pair generated. The other operations take the id or name from headers. |
Producer output |
| The Flavor, Server or Keypair of openstack4j created or read (null when get finds none), a List of them for getAll, the id of the image as text for createSnapshot; delete and a server action keep the body.
|
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.
Usage
You can use the following settings for each subsystem:
Flavors
Operations you can perform with the Flavor producer
| Operation | Description |
|---|---|
| Create new flavor. |
| Get the flavor. |
| Get all flavors. |
| Delete the flavor. |
If you need more precise flavor settings, you can create a new object of the type org.openstack4j.model.compute.Flavor and send in the message body.
Servers
Operations you can perform with the Server producer
| Operation | Description |
|---|---|
| Create a new server. |
| Create snapshot of the server. |
| Get the server. |
| Get all servers. |
| Delete the server. |
| Perform an action on the server. |
If you need more precise server settings, you can create a new object of the type org.openstack4j.model.compute.ServerCreate and send in the message body.
Example
The following route lists the servers. The endpoint is the address of the identity service (Keystone), and the credentials are property placeholders:
- route:
from:
uri: direct:listServers
steps:
- to:
uri: openstack-nova:http://controller:5000/v3
parameters:
username: "{{openstack.username}}"
password: "{{openstack.password}}"
project: "{{openstack.project}}"
subsystem: servers
operation: getAll
- log:
message: "Found ${body.size()} servers"