libcloud.compute.drivers.openstack module

OpenStack driver

class libcloud.compute.drivers.openstack.OpenStackNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version='1.1', **kwargs)[source]

Bases: NodeDriver, OpenStackDriverMixin

Base OpenStack node driver. Should not be used directly.

Parameters:
  • key (str) – API key or username to be used (required)

  • secret (str) – Secret password to be used (required)

  • secure (bool) – Whether to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default.

  • host (str) – Override hostname used for connections.

  • port (int) – Override port used for connections.

  • api_version (str) – Optional API version. Only used by drivers which support multiple API versions.

  • region (str) – Optional driver region. Only used by drivers which support multiple regions.

Return type:

None

NODE_STATE_MAP: Dict[str, NodeState] = {'ACTIVE': NodeState.RUNNING, 'BUILD': NodeState.PENDING, 'DELETED': NodeState.TERMINATED, 'DELETE_IP': NodeState.PENDING, 'ERROR': NodeState.ERROR, 'HARD_REBOOT': NodeState.REBOOTING, 'PASSWORD': NodeState.PENDING, 'PREP_RESIZE': NodeState.PENDING, 'QUEUE_RESIZE': NodeState.PENDING, 'REBOOT': NodeState.REBOOTING, 'REBUILD': NodeState.PENDING, 'RESCUE': NodeState.PENDING, 'RESIZE': NodeState.RECONFIGURING, 'SHARE_IP': NodeState.PENDING, 'SHARE_IP_NO_CONFIG': NodeState.PENDING, 'SHUTOFF': NodeState.STOPPED, 'SUSPENDED': NodeState.SUSPENDED, 'UNKNOWN': NodeState.UNKNOWN, 'VERIFY_RESIZE': NodeState.RUNNING}
SNAPSHOT_STATE_MAP = {'available': VolumeSnapshotState.AVAILABLE, 'creating': VolumeSnapshotState.CREATING, 'deleting': VolumeSnapshotState.DELETING, 'error': VolumeSnapshotState.ERROR, 'error_restoring': VolumeSnapshotState.ERROR, 'restoring': VolumeSnapshotState.RESTORING}
VOLUME_STATE_MAP = {'attaching': StorageVolumeState.ATTACHING, 'available': StorageVolumeState.AVAILABLE, 'backing-up': StorageVolumeState.BACKUP, 'creating': StorageVolumeState.CREATING, 'deleting': StorageVolumeState.DELETING, 'error': StorageVolumeState.ERROR, 'error_deleting': StorageVolumeState.ERROR, 'error_extending': StorageVolumeState.ERROR, 'error_restoring': StorageVolumeState.ERROR, 'in-use': StorageVolumeState.INUSE, 'restoring-backup': StorageVolumeState.BACKUP}
api_name: str = 'openstack'
attach_volume(node, volume, device='auto')[source]

Attaches volume to node.

Parameters:
  • node (Node) – Node to attach volume to.

  • volume (StorageVolume) – Volume to attach.

  • device (str) – Where the device is exposed, e.g. ‘/dev/sdb’

Rytpe:

bool

create_volume(size, name, location=None, snapshot=None, ex_volume_type=None)[source]

Create a new volume.

Parameters:
  • size (int) – Size of volume in gigabytes (required)

  • name (str) – Name of the volume to be created

  • location (NodeLocation) – Which data center to create a volume in. If empty, undefined behavior will be selected. (optional)

  • snapshot (VolumeSnapshot) – Snapshot from which to create the new volume. (optional)

  • ex_volume_type (str) – What kind of volume to create. (optional)

Returns:

The newly created volume.

Return type:

StorageVolume

destroy_node(node)[source]

Destroy a node.

Depending upon the provider, this may destroy all data associated with the node, including backups.

Parameters:

node (Node) – The node to be destroyed

Returns:

True if the destroy was successful, False otherwise.

Return type:

bool

destroy_volume(volume)[source]

Destroys a storage volume.

Parameters:

volume (StorageVolume) – Volume to be destroyed

Return type:

bool

detach_volume(volume, ex_node=None)[source]

Detaches a volume from a node.

Parameters:

volume (StorageVolume) – Volume to be detached

Return type:

bool

ex_get_node_details(node_id)[source]

Lists details of the specified server.

Parameters:

node_id (str) – ID of the node which should be used

Return type:

Node

ex_get_volume(volumeId)[source]
ex_hard_reboot_node(node)[source]

Hard reboots the specified server

Parameters:

node (Node) – node

Return type:

bool

ex_soft_reboot_node(node)[source]

Soft reboots the specified server

Parameters:

node (Node) – node

Return type:

bool

get_image(image_id)[source]

Get an image based on an image_id

@inherits: NodeDriver.get_image

Parameters:

image_id (str) – Image identifier

Returns:

A NodeImage object

Return type:

NodeImage

list_images(location=None, ex_only_active=True)[source]

Lists all active images

@inherits: NodeDriver.list_images

Parameters:

ex_only_active (bool) – True if list only active (optional)

list_locations()[source]

List data centers for a provider

Returns:

list of node location objects

Return type:

list of NodeLocation

list_nodes(ex_all_tenants=False)[source]

List the nodes in a tenant

Parameters:

ex_all_tenants (bool) – List nodes for all the tenants. Note: Your user must have admin privileges for this functionality to work.

list_sizes(location=None)[source]

List sizes on a provider

Parameters:

location (NodeLocation) – The location at which to list sizes

Returns:

list of node size objects

Return type:

list of NodeSize

list_volumes()[source]

List storage volumes.

Return type:

list of StorageVolume

name: str = 'OpenStack'
reboot_node(node)[source]

Reboot a node.

Parameters:

node (Node) – The node to be rebooted

Returns:

True if the reboot was successful, otherwise False

Return type:

bool

start_node(node)[source]

Start a node.

Parameters:

node (Node) – The node to be started

Returns:

True if the start was successful, otherwise False

Return type:

bool

stop_node(node)[source]

Stop a node

Parameters:

node (Node) – The node to be stopped.

Returns:

True if the stop was successful, otherwise False

Return type:

bool

website: str = 'http://openstack.org/'
class libcloud.compute.drivers.openstack.OpenStack_1_0_Connection(user_id, key, secure=True, host=None, port=None, timeout=None, proxy_url=None, ex_force_base_url=None, ex_force_auth_url=None, ex_force_auth_version=None, ex_force_auth_token=None, ex_token_scope='project', ex_domain_name='Default', ex_tenant_name=None, ex_tenant_domain_id='default', ex_force_service_type=None, ex_force_service_name=None, ex_force_service_region=None, ex_force_microversion=None, ex_auth_cache=None, retry_delay=None, backoff=None)[source]

Bases: OpenStackComputeConnection

Initialize user_id and key; set secure to an int based on passed value.

XML_NAMESPACE = 'http://docs.rackspacecloud.com/servers/api/v1.0'
accept_format = 'application/xml'
default_content_type = 'application/xml; charset=UTF-8'
responseCls

alias of OpenStack_1_0_Response

class libcloud.compute.drivers.openstack.OpenStack_1_0_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version='1.1', **kwargs)[source]

Bases: OpenStackNodeDriver

OpenStack node driver.

Extra node attributes:
  • password: root password, available after create.

  • hostId: represents the host your cloud server runs on

  • imageId: id of image

  • flavorId: id of flavor

Parameters:
  • key (str) – API key or username to be used (required)

  • secret (str) – Secret password to be used (required)

  • secure (bool) – Whether to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default.

  • host (str) – Override hostname used for connections.

  • port (int) – Override port used for connections.

  • api_version (str) – Optional API version. Only used by drivers which support multiple API versions.

  • region (str) – Optional driver region. Only used by drivers which support multiple regions.

Return type:

None

connectionCls

alias of OpenStack_1_0_Connection

create_image(node, name, description=None, reboot=True)[source]

Create an image for node.

@inherits: NodeDriver.create_image

Parameters:
  • node (Node) – node to use as a base for image

  • name (str) – name for new image

Return type:

NodeImage

create_node(name, size, image, ex_metadata=None, ex_files=None, ex_shared_ip_group=None, ex_shared_ip_group_id=None)[source]

Create a new node

@inherits: NodeDriver.create_node

Parameters:
  • ex_metadata (dict) – Key/Value metadata to associate with a node

  • ex_files (dict) – File Path => File contents to create on the node

  • ex_shared_ip_group_id (str) – The server is launched into that shared IP group

delete_image(image)[source]

Delete an image for node.

@inherits: NodeDriver.delete_image

Parameters:

image (NodeImage) – the image to be deleted

Return type:

bool

ex_confirm_resize(node)[source]

Confirm a resize request which is currently in progress. If a resize request is not explicitly confirmed or reverted it’s automatically confirmed after 24 hours.

For more info refer to the API documentation: http://goo.gl/zjFI1

Parameters:

node (Node) – node for which the resize request will be confirmed.

Return type:

bool

ex_create_ip_group(group_name, node_id=None)[source]

Creates a shared IP group.

Parameters:
  • group_name (str) – group name which should be used

  • node_id (str) – ID of the node which should be used

Return type:

bool

ex_delete_ip_group(group_id)[source]

Deletes the specified shared IP group.

Parameters:

group_id (str) – group id which should be used

Return type:

bool

ex_limits()[source]

Extra call to get account’s limits, such as rates (for example amount of POST requests per day) and absolute limits like total amount of available RAM to be used by servers.

Returns:

dict with keys ‘rate’ and ‘absolute’

Return type:

dict

ex_list_ip_addresses(node_id)[source]

List all server addresses.

Parameters:

node_id (str) – ID of the node which should be used

Return type:

OpenStack_1_0_NodeIpAddresses

ex_list_ip_groups(details=False)[source]

Lists IDs and names for shared IP groups. If details lists all details for shared IP groups.

Parameters:

details (bool) – True if details is required

Return type:

list of OpenStack_1_0_SharedIpGroup

ex_rebuild(node_id, image_id)[source]

Rebuilds the specified server.

Parameters:
  • node_id (str) – ID of the node which should be used

  • image_id (str) – ID of the image which should be used

Return type:

bool

ex_resize(node, size)[source]

NOTE: This method is here for backward compatibility reasons.

You should use ex_resize_node instead.

ex_resize_node(node, size)[source]

Change an existing server flavor / scale the server up or down.

Parameters:
  • node (Node) – node to resize.

  • size (NodeSize) – new size.

Return type:

bool

ex_revert_resize(node)[source]

Revert a resize request which is currently in progress. All resizes are automatically confirmed after 24 hours if they have not already been confirmed explicitly or reverted.

For more info refer to the API documentation: http://goo.gl/AizBu

Parameters:

node (Node) – node for which the resize request will be reverted.

Return type:

bool

ex_set_password(node, password)[source]

Sets the Node’s root password.

This will reboot the instance to complete the operation.

Node.extra['password'] will be set to the new value if the operation was successful.

Parameters:
  • node (Node) – node to set password

  • password (str) – new password.

Return type:

bool

ex_set_server_name(node, name)[source]

Sets the Node’s name.

This will reboot the instance to complete the operation.

Parameters:
  • node (Node) – node to set name

  • name (str) – new name

Return type:

bool

ex_share_ip(group_id, node_id, ip, configure_node=True)[source]

Shares an IP address to the specified server.

Parameters:
  • group_id (str) – group id which should be used

  • node_id (str) – ID of the node which should be used

  • ip (str) – ip which should be used

  • configure_node (bool) – configure node

Return type:

bool

ex_unshare_ip(node_id, ip)[source]

Removes a shared IP address from the specified server.

Parameters:
  • node_id (str) – ID of the node which should be used

  • ip (str) – ip which should be used

Return type:

bool

features: Dict[str, List[str]] = {'create_node': ['generates_password']}
List of available features for a driver.
type: Provider | str = 'openstack'
class libcloud.compute.drivers.openstack.OpenStack_1_0_NodeIpAddresses(public_addresses, private_addresses)[source]

Bases: object

List of public and private IP addresses of a Node.

class libcloud.compute.drivers.openstack.OpenStack_1_0_Response(*args, **kwargs)[source]

Bases: OpenStackResponse

Parameters:
  • response (httplib.HTTPResponse) – HTTP response object. (optional)

  • connection (Connection) – Parent connection object.

class libcloud.compute.drivers.openstack.OpenStack_1_0_SharedIpGroup(id, name, servers=None)[source]

Bases: object

Shared IP group info.

class libcloud.compute.drivers.openstack.OpenStack_1_1_Connection(user_id, key, secure=True, host=None, port=None, timeout=None, proxy_url=None, ex_force_base_url=None, ex_force_auth_url=None, ex_force_auth_version=None, ex_force_auth_token=None, ex_token_scope='project', ex_domain_name='Default', ex_tenant_name=None, ex_tenant_domain_id='default', ex_force_service_type=None, ex_force_service_name=None, ex_force_service_region=None, ex_force_microversion=None, ex_auth_cache=None, retry_delay=None, backoff=None)[source]

Bases: OpenStackComputeConnection

Initialize user_id and key; set secure to an int based on passed value.

accept_format = 'application/json'
default_content_type = 'application/json; charset=UTF-8'
encode_data(data)[source]

Encode body data.

Override in a provider’s subclass.

responseCls

alias of OpenStack_1_1_Response

class libcloud.compute.drivers.openstack.OpenStack_1_1_FloatingIpAddress(id, ip_address, pool, node_id=None, driver=None)[source]

Bases: object

Floating IP info.

delete()[source]

Delete this floating IP

Return type:

bool

class libcloud.compute.drivers.openstack.OpenStack_1_1_FloatingIpPool(name, connection)[source]

Bases: object

Floating IP Pool info.

create_floating_ip()[source]

Create new floating IP in the pool

Return type:

OpenStack_1_1_FloatingIpAddress

delete_floating_ip(ip)[source]

Delete specified floating IP from the pool

Parameters:

ip (OpenStack_1_1_FloatingIpAddress) – floating IP to remove

Return type:

bool

get_floating_ip(ip)[source]

Get specified floating IP from the pool

Parameters:

ip (str) – floating IP to get

Return type:

OpenStack_1_1_FloatingIpAddress

list_floating_ips()[source]

List floating IPs in the pool

Return type:

list of OpenStack_1_1_FloatingIpAddress

class libcloud.compute.drivers.openstack.OpenStack_1_1_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version='1.1', **kwargs)[source]

Bases: OpenStackNodeDriver

OpenStack node driver.

Parameters:
  • key (str) – API key or username to be used (required)

  • secret (str) – Secret password to be used (required)

  • secure (bool) – Whether to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default.

  • host (str) – Override hostname used for connections.

  • port (int) – Override port used for connections.

  • api_version (str) – Optional API version. Only used by drivers which support multiple API versions.

  • region (str) – Optional driver region. Only used by drivers which support multiple regions.

Return type:

None

connectionCls

alias of OpenStack_1_1_Connection

create_image(node, name, metadata=None)[source]

Creates a new image.

Parameters:
  • node (Node) – Node

  • name (str) – The name for the new image.

  • metadata (dict) – Key and value pairs for metadata.

Return type:

NodeImage

create_key_pair(name)[source]

Create a new key pair object.

Parameters:

name (str) – Key pair name.

Return type:

KeyPair object

create_node(name, size, image=None, ex_keyname=None, ex_userdata=None, ex_config_drive=None, ex_security_groups=None, ex_metadata=None, ex_files=None, networks=None, ex_disk_config=None, ex_admin_pass=None, ex_availability_zone=None, ex_blockdevicemappings=None, ex_os_scheduler_hints=None)[source]

Create a new node

@inherits: NodeDriver.create_node

Parameters:
  • ex_keyname (str) – The name of the key pair

  • ex_userdata (str) – String containing user data see https://help.ubuntu.com/community/CloudInit

  • ex_config_drive (bool) – Enable config drive see http://docs.openstack.org/grizzly/openstack-compute/admin/content/config-drive.html

  • ex_security_groups (list of OpenStackSecurityGroup) – List of security groups to assign to the node

  • ex_metadata (dict) – Key/Value metadata to associate with a node

  • ex_files (dict) – File Path => File contents to create on the node

  • networks (list of OpenStackNetwork) – The server is launched into a set of Networks.

  • ex_disk_config (str) – Name of the disk configuration. Can be either AUTO or MANUAL.

  • ex_config_drive – If True enables metadata injection in a server through a configuration drive.

  • ex_admin_pass (str) – The root password for the node

  • ex_availability_zone (str) – Nova availability zone for the node

  • ex_blockdevicemappings (dict) – Enables fine grained control of the block device mapping for an instance.

  • ex_os_scheduler_hints (dict) – The dictionary of data to send to the scheduler.

create_volume_snapshot(volume, name=None, ex_description=None, ex_force=True)[source]

Create snapshot from volume

Parameters:
  • volume (StorageVolume) – Instance of StorageVolume

  • name (str | NoneType) – Name of snapshot (optional)

  • ex_description (str | NoneType) – Description of the snapshot (optional)

  • ex_force (bool) – Specifies if we create a snapshot that is not in state available. For example in-use. Defaults to True. (optional)

Return type:

VolumeSnapshot

delete_image(image)[source]

Delete a NodeImage

@inherits: NodeDriver.delete_image

Parameters:

image (NodeImage) – image witch should be used

Return type:

bool

delete_key_pair(key_pair)[source]

Delete a KeyPair.

Parameters:

keypair (OpenStackKeyPair) – KeyPair to delete

Return type:

bool

destroy_volume_snapshot(snapshot)[source]

Destroys a snapshot.

Parameters:

snapshot (VolumeSnapshot) – The snapshot to delete

Return type:

bool

ex_attach_floating_ip_to_node(node, ip)[source]

Attach the floating IP to the node

Parameters:
Return type:

bool

ex_confirm_resize(node)[source]

Confirms a pending resize action.

Parameters:

node (Node) – Node to resize.

Return type:

bool

ex_create_floating_ip(ip_pool=None)[source]

Create new floating IP. The ip_pool attribute is optional only if your infrastructure has only one IP pool available.

Parameters:

ip_pool (str) – name of the floating IP pool

Return type:

OpenStack_1_1_FloatingIpAddress

ex_create_keypair(name)[source]

Create a new KeyPair

Parameters:

name (str) – Name of the new KeyPair

Return type:

OpenStackKeyPair

ex_create_network(name, cidr)[source]

Create a new Network

Parameters:
  • name (str) – Name of network which should be used

  • cidr (str) – cidr of network which should be used

Return type:

OpenStackNetwork

ex_create_security_group(name, description)[source]

Create a new Security Group

Parameters:
  • name (str) – Name of the new Security Group

  • description (str) – Description of the new Security Group

Return type:

OpenStackSecurityGroup

ex_create_security_group_rule(security_group, ip_protocol, from_port, to_port, cidr=None, source_security_group=None)[source]

Create a new Rule in a Security Group

Parameters:
  • security_group (OpenStackSecurityGroup) – Security Group in which to add the rule

  • ip_protocol (str) – Protocol to which this rule applies Examples: tcp, udp, …

  • from_port (int) – First port of the port range

  • to_port (int) – Last port of the port range

  • cidr (str) – CIDR notation of the source IP range for this rule

  • source_security_group (L{OpenStackSecurityGroup) – Existing Security Group to use as the source (instead of CIDR)

Return type:

OpenStackSecurityGroupRule

ex_create_snapshot(volume, name, description=None, force=False)[source]

Create a snapshot based off of a volume.

Parameters:
  • volume (StorageVolume) – volume

  • name (str) – New name for the volume snapshot

  • description (str) – Description of the snapshot (optional)

  • force (bool) – Whether to force creation (optional)

Return type:

VolumeSnapshot

ex_delete_floating_ip(ip)[source]

Delete specified floating IP

Parameters:

ip (OpenStack_1_1_FloatingIpAddress) – floating IP to remove

Return type:

bool

ex_delete_keypair(keypair)[source]

Delete a KeyPair.

Parameters:

keypair (OpenStackKeyPair) – KeyPair to delete

Return type:

bool

ex_delete_network(network)[source]

Delete a Network

Parameters:

network (OpenStackNetwork) – Network which should be used

Return type:

bool

ex_delete_security_group(security_group)[source]

Delete a Security Group.

Parameters:

security_group (OpenStackSecurityGroup) – Security Group should be deleted

Return type:

bool

ex_delete_security_group_rule(rule)[source]

Delete a Rule from a Security Group.

Parameters:

rule (OpenStackSecurityGroupRule) – Rule should be deleted

Return type:

bool

ex_delete_snapshot(snapshot)[source]

Delete a VolumeSnapshot

Parameters:

snapshot (VolumeSnapshot) – snapshot

Return type:

bool

ex_detach_floating_ip_from_node(node, ip)[source]

Detach the floating IP from the node

Parameters:
Return type:

bool

ex_get_console_output(node, length=None)[source]

Get console output

Parameters:
  • node (Node) – node

  • length (int) – Optional number of lines to fetch from the console log

Returns:

Dictionary with the output

Return type:

dict

ex_get_floating_ip(ip)[source]

Get specified floating IP

Parameters:

ip (str) – floating IP to get

Return type:

OpenStack_1_1_FloatingIpAddress

ex_get_metadata(node)[source]

Get a Node’s metadata.

Parameters:

node (Node) – Node

Returns:

Key/Value metadata associated with node.

Return type:

dict

ex_get_metadata_for_node(node)[source]

Return the metadata associated with the node.

Parameters:

node (Node) – Node instance

Returns:

A dictionary or other mapping of strings to strings, associating tag names with tag values.

ex_get_network(network_id)[source]

Retrieve the Network with the given ID

Parameters:

networkId (str) – ID of the network

:rtype OpenStackNetwork

ex_get_node_security_groups(node)[source]

Get Security Groups of the specified server.

Return type:

list of OpenStackSecurityGroup

ex_get_size(size_id)[source]

Get a NodeSize

Parameters:

size_id (str) – ID of the size which should be used

Return type:

NodeSize

ex_get_size_extra_specs(size_id)[source]

Get the extra_specs field of a NodeSize

Parameters:

size_id (str) – ID of the size which should be used

Return type:

dict

ex_get_snapshot(snapshotId)[source]
ex_import_keypair(name, keyfile)[source]

Import a KeyPair from a file

Parameters:
  • name (str) – Name of the new KeyPair

  • keyfile (str) – Path to the public key file (in OpenSSH format)

Return type:

OpenStackKeyPair

ex_import_keypair_from_string(name, key_material)[source]

Import a KeyPair from a string

Parameters:
  • name (str) – Name of the new KeyPair

  • key_material (str) – Public key (in OpenSSH format)

Return type:

OpenStackKeyPair

ex_list_floating_ip_pools()[source]

List available floating IP pools

Return type:

list of OpenStack_1_1_FloatingIpPool

ex_list_floating_ips()[source]

List floating IPs

Return type:

list of OpenStack_1_1_FloatingIpAddress

ex_list_keypairs()[source]

Get a list of KeyPairs that are available.

Return type:

list of OpenStackKeyPair

ex_list_networks()[source]

Get a list of Networks that are available.

Return type:

list of OpenStackNetwork

ex_list_security_groups()[source]

Get a list of Security Groups that are available.

Return type:

list of OpenStackSecurityGroup

ex_list_snapshots()[source]
ex_pause_node(node)[source]
ex_rebuild(node, image, **kwargs)[source]

Rebuild a Node.

Parameters:
  • node (Node) – Node to rebuild.

  • image (NodeImage) – New image to use.

  • ex_metadata (dict) – Key/Value metadata to associate with a node

  • ex_files (dict) – File Path => File contents to create on the node

  • ex_keyname (str) – Name of existing public key to inject into instance

  • ex_userdata (str) – String containing user data see https://help.ubuntu.com/community/CloudInit

  • ex_security_groups (list of OpenStackSecurityGroup) – List of security groups to assign to the node

  • ex_disk_config (str) – Name of the disk configuration. Can be either AUTO or MANUAL.

  • ex_config_drive (bool) – If True enables metadata injection in a server through a configuration drive.

Return type:

bool

ex_rescue(node, password=None)[source]

Rescue a node

Parameters:
  • node (Node) – node

  • password (str) – password

Return type:

Node

ex_resize(node, size)[source]

Change a node size.

Parameters:
  • node (Node) – Node to resize.

  • size (NodeSize) – New size to use.

Return type:

bool

ex_resume_node(node)[source]
ex_revert_resize(node)[source]

Cancels and reverts a pending resize action.

Parameters:

node (Node) – Node to resize.

Return type:

bool

ex_set_metadata(node, metadata)[source]

Sets the Node’s metadata.

Parameters:
  • node (Node) – Node

  • metadata (dict) – Key/Value metadata to associate with a node

Return type:

dict

ex_set_password(node, password)[source]

Changes the administrator password for a specified server.

Parameters:
  • node (Node) – Node to rebuild.

  • password (str) – The administrator password.

Return type:

bool

ex_set_server_name(node, name)[source]

Sets the Node’s name.

Parameters:
  • node (Node) – Node

  • name (str) – The name of the server.

Return type:

Node

ex_start_node(node)[source]
ex_stop_node(node)[source]
ex_suspend_node(node)[source]
ex_unpause_node(node)[source]
ex_unrescue(node)[source]

Unrescue a node

Parameters:

node (Node) – node

Return type:

bool

ex_update_node(node, **node_updates)[source]

Update the Node’s editable attributes. The OpenStack API currently supports editing name and IPv4/IPv6 access addresses.

The driver currently only supports updating the node name.

Parameters:
  • node (Node) – Node

  • name (str) – New name for the server

Return type:

Node

features: Dict[str, List[str]] = {'create_node': ['generates_password']}
List of available features for a driver.
get_image(image_id)[source]

Get a NodeImage

@inherits: NodeDriver.get_image

Parameters:

image_id (str) – ID of the image which should be used

Return type:

NodeImage

get_key_pair(name)[source]

Retrieve a single key pair.

Parameters:

name (str) – Name of the key pair to retrieve.

Return type:

KeyPair

import_key_pair_from_string(name, key_material)[source]

Import a new public key from string.

Parameters:
  • name (str) – Key pair name.

  • key_material (str) – Public key material.

Return type:

KeyPair object

list_key_pairs()[source]

List all the available key pair objects.

Return type:

list of KeyPair objects

list_volume_snapshots(volume)[source]

List snapshots for a storage volume.

Return type:

list of VolumeSnapshot

type: Provider | str = 'openstack'
class libcloud.compute.drivers.openstack.OpenStack_1_1_Response(*args, **kwargs)[source]

Bases: OpenStackResponse

Parameters:
  • response (httplib.HTTPResponse) – HTTP response object. (optional)

  • connection (Connection) – Parent connection object.

class libcloud.compute.drivers.openstack.OpenStack_2_FloatingIpAddress(id, ip_address, pool, node_id=None, driver=None, extra=None)[source]

Bases: OpenStack_1_1_FloatingIpAddress

Floating IP info 2.0.

get_node_id()[source]
get_pool()[source]
class libcloud.compute.drivers.openstack.OpenStack_2_FloatingIpPool(id, name, connection)[source]

Bases: object

Floating IP Pool info.

create_floating_ip()[source]

Create new floating IP in the pool

Return type:

OpenStack_2_FloatingIpAddress

delete_floating_ip(ip)[source]

Delete specified floating IP from the pool

Parameters:

ip (OpenStack_1_1_FloatingIpAddress) – floating IP to remove

Return type:

bool

get_floating_ip(ip)[source]

Get specified floating IP from the pool

Parameters:

ip (str) – floating IP to get

Return type:

OpenStack_2_FloatingIpAddress

list_floating_ips()[source]

List floating IPs in the pool

Return type:

list of OpenStack_2_FloatingIpAddress

class libcloud.compute.drivers.openstack.OpenStack_2_PortInterface(id, state, driver, created=None, extra=None)[source]

Bases: UuidMixin

Port Interface info. Similar in functionality to a floating IP (can be attached / detached from a compute instance) but implementation-wise a bit different.

> A port is a connection point for attaching a single device, such as the > NIC of a server, to a network. The port also describes the associated > network configuration, such as the MAC and IP addresses to be used on > that port. https://docs.openstack.org/python-openstackclient/pike/cli/command-objects/port.html

Also see: https://developer.openstack.org/api-ref/compute/#port-interfaces-servers-os-interface

Parameters:
  • id (str) – Port Interface ID.

  • state (OpenStack_2_PortInterfaceState) – State of the OpenStack_2_PortInterface.

  • created (datetime.datetime) – A datetime object that represents when the port interface was created

  • extra (dict) – Optional provided specific attributes associated with this image.

delete()[source]

Delete this Port Interface

Return type:

bool

class libcloud.compute.drivers.openstack.OpenStack_2_PortInterfaceState(value)[source]

Bases: Type

Standard states of OpenStack_2_PortInterfaceState

ACTIVE = 'active'
BUILD = 'build'
DOWN = 'down'
UNKNOWN = 'unknown'