libcloud.compute.drivers package

Submodules

libcloud.compute.drivers.abiquo module

Abiquo Compute Driver

The driver implements the compute Abiquo functionality for the Abiquo API. This version is compatible with the following versions of Abiquo:

class libcloud.compute.drivers.abiquo.AbiquoNodeDriver(user_id, secret, endpoint, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Implements the NodeDriver‘s for the Abiquo Compute Provider

Initializes Abiquo Driver

Initializes the NodeDriver object and populate the cache.

Parameters:
  • user_id (str) – identifier of Abiquo user (required)
  • secret (str) – password of the Abiquo user (required)
  • endpoint (str that can be parsed as URL) – Abiquo API endpoint (required)
GIGABYTE = 1073741824
NODES_MIME_TYPE = 'application/vnd.abiquo.virtualmachineswithnode+xml'
NODE_MIME_TYPE = 'application/vnd.abiquo.virtualmachinewithnode+xml'
VAPP_MIME_TYPE = 'application/vnd.abiquo.virtualappliance+xml'
VM_TASK_MIME_TYPE = 'application/vnd.abiquo.virtualmachinetask+xml'
connectionCls

alias of AbiquoConnection

create_node(**kwargs)[source]

Create a new node instance in Abiquo

All the Node`s need to be defined inside a VirtualAppliance (called :class:`NodeGroup here). If there is no group name defined, ‘libcloud’ name will be used instead.

This method wraps these Abiquo actions:

  1. Create a group if it does not exist.
  2. Register a new node in the group.
  3. Deploy the node and boot it.
  4. Retrieves it again to get schedule-time attributes (such as ips and vnc ports).

The rest of the driver methods has been created in a way that, if any of these actions fail, the user can not reach an inconsistent state

Parameters:
  • name (str) – The name for this new node (required)
  • size (NodeSize) – The size of resources allocated to this node.
  • image (NodeImage) – OS Image to boot on node. (required)
  • location (NodeLocation) – Which data center to create a node in. If empty, undefined behavior will be selected. (optional)
  • group_name (c{str}) – Which group this node belongs to. If empty, it will be created into ‘libcloud’ group. If it does not found any group in the target location (random location if you have not set the parameter), then it will create a new group with this name.
Returns:

The newly created node.

Return type:

Node

destroy_node(node)[source]

Destroy a node

Depending on 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, otherwise False
Return type:bool
ex_create_group(name, location=None)[source]

Create an empty group.

You can specify the location as well.

Parameters:
  • group (str) – name of the group (required)
  • location (NodeLocation) – location were to create the group
Returns:

the created group

Return type:

NodeGroup

ex_destroy_group(group)[source]

Destroy a group.

Be careful! Destroying a group means destroying all the :class:`Node`s there and the group itself!

If there is currently any action over any Node of the NodeGroup, then the method will raise an exception.

Parameters:name (NodeGroup) – The group (required)
Returns:If the group was destroyed successfully
Return type:bool
ex_list_groups(location=None)[source]

List all groups.

Parameters:location (a NodeLocation instance.) – filter the groups by location (optional)
Returns:the list of NodeGroup
ex_populate_cache()[source]

Populate the cache.

For each connection, it is good to store some objects that will be useful for further requests, such as the ‘user’ and the ‘enterprise’ objects.

Executes the ‘login’ resource after setting the connection parameters and, if the execution is successful, it sets the ‘user’ object into cache. After that, it also requests for the ‘enterprise’ and ‘locations’ data.

List of locations should remain the same for a single libcloud connection. However, this method is public and you are able to refresh the list of locations any time.

ex_run_node(node)[source]

Runs a node

Here there is a bit difference between Abiquo states and libcloud states, so this method is created to have better compatibility. In libcloud, if the node is not running, then it does not exist (avoiding UNKNOWN and temporal states). In Abiquo, you can define a node, and then deploy it.

If the node is in NodeState.TERMINATED libcloud’s state and in ‘NOT_DEPLOYED’ Abiquo state, there is a way to run and recover it for libcloud using this method. There is no way to reach this state if you are using only libcloud, but you may have used another Abiquo client and now you want to recover your node to be used by libcloud.

Parameters:node (Node) – The node to run
Returns:The node itself, but with the new state
Return type:Node
list_images(location=None)[source]

List images on Abiquo Repositories

Parameters:location (NodeLocation) – The location to list images for.
Returns:list of node image objects
Return type:list of NodeImage
list_locations()[source]

Return list of locations where the user has access to.

Returns:the list of NodeLocation available for the current user
Return type:list of NodeLocation
list_nodes(location=None)[source]

List all nodes.

Parameters:location (a NodeLocation instance.) – Filter the groups by location (optional)
Returns:List of node objects
Return type:list of Node
list_sizes(location=None)[source]

List sizes on a provider.

Abiquo does not work with sizes. However, this method returns a list of predefined ones (copied from DummyNodeDriver but without price neither bandwidth) to help the users to create their own.

If you call the method AbiquoNodeDriver.create_node with the size informed, it will just override the ‘ram’ value of the ‘image’ template. So it is no too much usefull work with sizes...

Returns:The list of sizes
Return type:list of NodeSizes
name = 'Abiquo'
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
timeout = 2000
type = 'abiquo'
website = 'http://www.abiquo.com/'
class libcloud.compute.drivers.abiquo.NodeGroup(driver, name='libcloud', nodes=, []uri='')[source]

Bases: object

Group of virtual machines that can be managed together

All Node`s in Abiquo must be defined inside a Virtual Appliance. We offer a way to handle virtual appliances (called NodeGroup to maintain some kind of name conventions here) inside the :class:`AbiquoNodeDriver without breaking compatibility of the rest of libcloud API.

If the user does not want to handle groups, all the virtual machines will be created inside a group named ‘libcloud’

Initialize a new group object.

DEFAULT_GROUP_NAME = 'libcloud'
destroy()[source]

Destroys the group delegating the execution to AbiquoNodeDriver.

libcloud.compute.drivers.bluebox module

libcloud driver for the Blue Box Blocks API

This driver implements all libcloud functionality for the Blue Box Blocks API.

Blue Box home page http://bluebox.net Blue Box API documentation https://boxpanel.bluebox .net/public/the_vault/index.php/Blocks_API

class libcloud.compute.drivers.bluebox.BlueboxConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Connection class for the Bluebox driver

add_default_headers(headers)[source]
allow_insecure = False
host = 'boxpanel.bluebox.net'
responseCls

alias of BlueboxResponse

secure = True
class libcloud.compute.drivers.bluebox.BlueboxNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Bluebox Blocks node driver

api_name = 'bluebox'
connectionCls

alias of BlueboxConnection

create_node(**kwargs)[source]
destroy_node(node)[source]
features = {'create_node': ['ssh_key', 'password']}
list_images(location=None)[source]
list_locations()[source]
list_nodes()[source]
list_sizes(location=None)[source]
name = 'Bluebox Blocks'
reboot_node(node)[source]
type = 'bluebox'
website = 'http://bluebox.net'
class libcloud.compute.drivers.bluebox.BlueboxNodeSize(id, name, cpu, ram, disk, price, driver)[source]

Bases: libcloud.compute.base.NodeSize

class libcloud.compute.drivers.bluebox.BlueboxResponse(response, connection)[source]

Bases: libcloud.common.base.JsonResponse

Parameters:
parse_error()[source]

libcloud.compute.drivers.brightbox module

Brightbox Driver

class libcloud.compute.drivers.brightbox.BrightboxNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version='1.0', **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Brightbox node driver

NODE_STATE_MAP = {'creating': 3, 'deleted': 2, 'failed': 4, 'inactive': 4, 'active': 0, 'deleting': 4, 'unavailable': 4}
connectionCls

alias of BrightboxConnection

create_node(**kwargs)[source]

Create a new Brightbox node

Reference: https://api.gb1.brightbox.com/1.0/#server_create_server

@inherits: NodeDriver.create_node

Parameters:
  • ex_userdata (str) – User data
  • ex_servergroup (str or list of str) – Name or list of server group ids to add server to
destroy_node(node)[source]
ex_create_cloud_ip(reverse_dns=None)[source]

Requests a new cloud IP address for the account

@note: This is an API extension for use on Brightbox

Parameters:reverse_dns (str) – Reverse DNS hostname
Return type:dict
ex_destroy_cloud_ip(cloud_ip_id)[source]

Release the cloud IP address from the account’s ownership

@note: This is an API extension for use on Brightbox

Parameters:cloud_ip_id (str) – The id of the cloud ip.
Returns:True if the unmap was successful.
Return type:bool
ex_list_cloud_ips()[source]

List Cloud IPs

@note: This is an API extension for use on Brightbox

Return type:list of dict
ex_map_cloud_ip(cloud_ip_id, interface_id)[source]

Maps (or points) a cloud IP address at a server’s interface or a load balancer to allow them to respond to public requests

@note: This is an API extension for use on Brightbox

Parameters:
  • cloud_ip_id (str) – The id of the cloud ip.
  • interface_id (str) – The Interface ID or LoadBalancer ID to which this Cloud IP should be mapped to
Returns:

True if the mapping was successful.

Return type:

bool

ex_unmap_cloud_ip(cloud_ip_id)[source]

Unmaps a cloud IP address from its current destination making it available to remap. This remains in the account’s pool of addresses

@note: This is an API extension for use on Brightbox

Parameters:cloud_ip_id (str) – The id of the cloud ip.
Returns:True if the unmap was successful.
Return type:bool
ex_update_cloud_ip(cloud_ip_id, reverse_dns)[source]

Update some details of the cloud IP address

@note: This is an API extension for use on Brightbox

Parameters:
  • cloud_ip_id (str) – The id of the cloud ip.
  • reverse_dns (str) – Reverse DNS hostname
Return type:

dict

list_images(location=None)[source]
list_locations()[source]
list_nodes()[source]
list_sizes()[source]
name = 'Brightbox'
type = 'brightbox'
website = 'http://www.brightbox.co.uk/'

libcloud.compute.drivers.cloudframes module

CloudFrames Driver

class libcloud.compute.drivers.cloudframes.CloudFramesComponent(cloudFramesConnection, name)[source]

Bases: object

Represents a node in the cloudapi path.

method(methodname)[source]
class libcloud.compute.drivers.cloudframes.CloudFramesConnection(key=None, secret=None, secure=True, host=None, port=None, url=None, timeout=None)[source]

Bases: libcloud.common.xmlrpc.XMLRPCConnection, libcloud.common.base.ConnectionKey

Cloudapi connection class

Parameters:
  • key (str) – The username to connect with to the cloudapi
  • secret (str) – The password to connect with to the cloudapi
  • secure (bool) – Should always be false at the moment
  • host (str) – The hostname of the cloudapi
  • port (int) – The port on which to connect to the cloudapi
  • url (str) – Url to the cloudapi (can replace all above)
add_default_headers(headers)[source]
base_url = None
repsonseCls

alias of XMLRPCResponse

exception libcloud.compute.drivers.cloudframes.CloudFramesException(value, http_code, driver=None)[source]

Bases: libcloud.common.types.ProviderError

class libcloud.compute.drivers.cloudframes.CloudFramesNode(id, name, state, public_ips, private_ips, driver, size=None, image=None, extra=None)[source]

Bases: libcloud.compute.base.Node

Parameters:
  • id (str) – Node ID.
  • name (str) – Node name.
  • state (libcloud.compute.types.NodeState) – Node state.
  • public_ips (list) – Public IP addresses associated with this node.
  • private_ips (list) – Private IP addresses associated with this node.
  • driver (NodeDriver) – Driver this node belongs to.
  • size (NodeImage) – Size of this node. (optional)
  • image – Image of this node. (optional)
  • extra (dict) – Optional provider specific attributes associated with this node.
list_snapshots()[source]
rollback(snapshot)[source]
snapshot(label='', description='')[source]
class libcloud.compute.drivers.cloudframes.CloudFramesNodeDriver(key=None, secret=None, secure=True, host=None, port=None, url=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

CloudFrames node driver

NODE_STATE_MAP = {'ISCSIEXPOSED': 3, 'CREATED': 3, 'CONFIGURED': 3, 'HALTED': 2, 'MOVING': 3, 'PAUSED': 2, 'SYNCING': 3, 'DELETING': 3, 'OVERLOADED': 4, 'IMAGEONLY': 4, 'TODELETE': 3, 'RUNNING': 0, 'STOPPING': 3, 'STARTING': 3}
api_name = 'cloudframes'
connectionCls

alias of CloudFramesConnection

create_node(**kwargs)[source]

Creates a new node, by cloning the template provided.

If no location object is passed, a random location will be used.

Parameters:
  • image (list of NodeImage) – The template to be cloned (required)
  • name (str) – The name for the new node (required)
  • size (list of NodeSize) – The size of the new node (required)
  • location (list of NodeLocation) – The location to create the new node
  • default_gateway (str) – The default gateway to be used
  • extra (dict) – Additional requirements (extra disks fi.)
Returns:

list of Node – The newly created Node object

Raises:

CloudFramesException

destroy_node(node)[source]
ex_destroy_snapshot(node, snapshot)[source]
ex_list_snapshots(node)[source]
ex_rollback_node(node, snapshot)[source]
ex_snapshot_node(node, label='', description='')[source]
list_images(location=None)[source]
list_locations(ex_use_cached=True)[source]
list_nodes()[source]
list_sizes(location=None)[source]
name = 'CloudFrames'
reboot_node(node, ex_clean=True)[source]
type = 'cloudframes'
website = 'http://www.cloudframes.net/'
class libcloud.compute.drivers.cloudframes.CloudFramesNodeSize(id, name, ram, disk, bandwidth, price, driver, vcpus=None)[source]

Bases: libcloud.compute.base.NodeSize

class libcloud.compute.drivers.cloudframes.CloudFramesSnapshot(id, timestamp, label, description, driver)[source]

Bases: object

destroy()[source]

libcloud.compute.drivers.cloudsigma module

Drivers for CloudSigma API v1.0 and v2.0.

class libcloud.compute.drivers.cloudsigma.CloudSigmaNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

name = 'CloudSigma'
website = 'http://www.cloudsigma.com/'
class libcloud.compute.drivers.cloudsigma.CloudSigma_1_0_NodeDriver(key, secret=None, secure=True, host=None, port=None, region='zrh', **kwargs)[source]

Bases: libcloud.compute.drivers.cloudsigma.CloudSigmaNodeDriver

IMAGING_TIMEOUT = 1200
NODE_STATE_MAP = {'active': 0, 'dumped': 2, 'stopped': 2, 'dead': 2}
connectionCls

alias of CloudSigma_1_0_Connection

create_node(**kwargs)[source]

Creates a CloudSigma instance

@inherits: NodeDriver.create_node

Parameters:
  • name (str) – String with a name for this new node (required)
  • smp – Number of virtual processors or None to calculate

based on the cpu speed :type smp: int

Parameters:nic_model – e1000, rtl8139 or virtio (is not specified,

e1000 is used) :type nic_model: str

Parameters:
  • vnc_password (bool) – If not set, VNC access is disabled.
  • drive_type (str) – Drive type (ssd|hdd). Defaults to hdd.
destroy_node(node)[source]

Destroy a node (all the drives associated with it are NOT destroyed).

If a node is still running, it’s stopped before it’s destroyed.

@inherits: NodeDriver.destroy_node

ex_destroy_drive(drive_uuid)[source]

Destroy a drive.

Parameters:drive_uuid (str) – Drive uuid which should be used
Return type:bool
ex_destroy_node_and_drives(node)[source]

Destroy a node and all the drives associated with it.

Parameters:node (libcloud.compute.base.Node) – Node which should be used
Return type:bool
ex_drive_destroy(drive_uuid)[source]

Destroy a drive with a specified uuid. If the drive is currently mounted an exception is thrown.

Parameters:drive_uuid (str) – Drive uuid which should be used
Return type:bool
ex_drives_list()[source]

Return a list of all the available drives.

Return type:list of dict
ex_set_node_configuration(node, **kwargs)[source]

Update a node configuration. Changing most of the parameters requires node to be stopped.

Parameters:
Return type:

bool

ex_shutdown_node(node)[source]

Stop (shutdown) a node.

@inherits: CloudSigmaBaseNodeDriver.ex_stop_node

ex_start_node(node)[source]

Start a node.

Parameters:node (libcloud.compute.base.Node) – Node which should be used
Return type:bool
ex_static_ip_create()[source]

Create a new static IP address.p

Return type:list of dict
ex_static_ip_destroy(ip_address)[source]

Destroy a static IP address.

Parameters:ip_address (str) – IP address which should be used
Return type:bool
ex_static_ip_list()[source]

Return a list of available static IP addresses.

Return type:list of str
ex_stop_node(node)[source]

Stop (shutdown) a node.

Parameters:node (libcloud.compute.base.Node) – Node which should be used
Return type:bool
list_images(location=None)[source]

Return a list of available standard images (this call might take up to 15 seconds to return).

@inherits: NodeDriver.list_images

list_nodes()[source]
list_sizes(location=None)[source]
name = 'CloudSigma (API v1.0)'
reboot_node(node)[source]

Reboot a node.

Because Cloudsigma API does not provide native reboot call, it’s emulated using stop and start.

@inherits: NodeDriver.reboot_node

type = 'cloudsigma'
website = 'http://www.cloudsigma.com/'
class libcloud.compute.drivers.cloudsigma.CloudSigma_2_0_NodeDriver(key, secret, secure=True, host=None, port=None, region='zrh', **kwargs)[source]

Bases: libcloud.compute.drivers.cloudsigma.CloudSigmaNodeDriver

Driver for CloudSigma API v2.0.

DRIVE_TRANSITION_SLEEP_INTERVAL = 5
DRIVE_TRANSITION_TIMEOUT = 500
NODE_STATE_MAP = {'unavailable': 3, 'paused': 5, 'running': 0, 'stopped': 5, 'stopping': 3, 'starting': 3}
api_name = 'cloudsigma_zrh'
connectionCls

alias of CloudSigma_2_0_Connection

create_node(name, size, image, ex_metadata=None, ex_vnc_password=None, ex_avoid=None, ex_vlan=None)[source]

Create a new server.

Server creation consists multiple steps depending on the type of the image used.

  1. Installation CD:

    1. Create a server and attach installation cd
    2. Start a server
  2. Pre-installed image:

    1. Clone provided library drive so we can use it
    2. Resize cloned drive to the desired size
    3. Create a server and attach cloned drive
    4. Start a server
Parameters:
  • ex_metadata (dict) – Key / value pairs to associate with the created node. (optional)
  • ex_vnc_password (str) – Password to use for VNC access. If not provided, random password is generated.
  • ex_avoid (list) – A list of server UUIDs to avoid when starting this node. (optional)
  • ex_vlan (str) – Optional UUID of a VLAN network to use. If specified, server will have two nics assigned - 1 with a public ip and 1 with the provided VLAN.
destroy_node(node)[source]

Destroy the node and all the associated drives.

Returns:True on success, False otherwise.
Return type:bool
ex_attach_drive(node)[source]

Attach a drive to the provided node.

ex_attach_firewall_policy(policy, node, nic_mac=None)[source]

Attach firewall policy to a public NIC interface on the server.

Parameters:
  • policy (CloudSigmaFirewallPolicy) – Firewall policy to attach.
  • node (libcloud.compute.base.Node) – Node to attach policy to.
  • nic_mac (str) – Optional MAC address of the NIC to add the policy to. If not specified, first public interface is used instead.
Returns:

Node object to which the policy was attached to.

Return type:

libcloud.compute.base.Node

ex_clone_drive(drive, name=None, ex_avoid=None)[source]

Clone a library or a standard drive.

Parameters:
  • drive (libcloud.compute.base.NodeImage or CloudSigmaDrive) – Drive to clone.
  • name (str) – Optional name for the cloned drive.
  • ex_avoid (list) – A list of other drive uuids to avoid when creating this drive. If provided, drive will attempt to be created on a different physical infrastructure from other drives specified using this argument. (optional)
Returns:

New cloned drive.

Return type:

CloudSigmaDrive

ex_clone_node(node, name=None, random_vnc_password=None)[source]

Clone the provided node.

Parameters:
  • name (str) – Optional name for the cloned node.
  • random_vnc_password (bool) – If True, a new random VNC password will be generated for the cloned node. Otherwise password from the cloned node will be reused.
Returns:

Cloned node.

Return type:

libcloud.compute.base.Node

ex_close_vnc_tunnel(node)[source]

Close a VNC server to the provided node.

Parameters:node (libcloud.compute.base.Node) – Node to close the VNC tunnel to.
Returns:True on success, False otherwise.
Return type:bool
ex_create_drive(name, size, media='disk', ex_avoid=None)[source]

Create a new drive.

Parameters:
  • name (str) – Drive name.
  • size (int) – Drive size in bytes.
  • media (str) – Drive media type (cdrom, disk).
  • ex_avoid (list) – A list of other drive uuids to avoid when creating this drive. If provided, drive will attempt to be created on a different physical infrastructure from other drives specified using this argument. (optional)
Returns:

Created drive object.

Return type:

CloudSigmaDrive

ex_create_firewall_policy(name, rules=None)[source]

Create a firewall policy.

Parameters:
  • name (str) – Policy name.
  • rules (list of dict) – List of firewall policy rules to associate with this policy. (optional)
Returns:

Created firewall policy object.

Return type:

CloudSigmaFirewallPolicy

ex_create_subscription(amount, period, resource, auto_renew=False)[source]

Create a new subscription.

Parameters:
  • amount (int) – Subscription amount. For example, in dssd case this would be disk size in gigabytes.
  • period (str) – Subscription period. For example: 30 days, 1 week, 1 month, ...
  • resource (str) – Resource the purchase the subscription for.
  • auto_renew (bool) – True to automatically renew the subscription.
ex_create_tag(name, resource_uuids=None)[source]

Create a tag.

Parameters:
  • name (str) – Tag name.
  • resource_uuids (list of str) – Optional list of resource UUIDs to assign this tag go.
Returns:

Created tag object.

Return type:

CloudSigmaTag

ex_delete_firewall_policy(policy)[source]

Delete a firewall policy.

Parameters:policy (CloudSigmaFirewallPolicy) – Policy to delete to.
Returns:True on success, False otherwise.
Return type:bool
ex_delete_tag(tag)[source]

Delete a tag.

Parameters:tag (CloudSigmaTag) – Tag to delete.
Returns:True on success, False otherwise.
Return type:bool
ex_edit_node(node, params)[source]

Edit a node.

Parameters:

:return Edited node. :rtype: libcloud.compute.base.Node

ex_get_balance()[source]

Retrueve account balance information.

Returns:Dictionary with two items (“balance” and “currency”).
Return type:dict
ex_get_drive(drive_id)[source]

Retrieve information about a single drive.

Parameters:drive_id (str) – ID of the drive to retrieve.
Returns:Drive object.
Return type:CloudSigmaDrive
ex_get_pricing()[source]

Retrive pricing information that are applicable to the cloud.

Returns:Dictionary with pricing information.
Return type:dict
ex_get_tag(tag_id)[source]

Retrieve a single tag.

Parameters:tag_id (str) – ID of the tag to retrieve.
Return type:list of CloudSigmaTag objects
ex_get_usage()[source]

Retrieve account current usage information.

Returns:Dictionary with two items (“balance” and “usage”).
Return type:dict
ex_list_capabilities()[source]

Retrieve all the basic and sensible limits of the API.

Return type:dict
ex_list_drives_availability_groups()[source]

Return which drives share the same physical storage host.

Returns:A list of drive UUIDs which share the same physical storage host. Drives which share the same host will be stored under the same list index.
Return type:list of list
ex_list_firewall_policies()[source]

List firewall policies.

Return type:list of CloudSigmaFirewallPolicy
ex_list_library_drives()[source]

Return a list of all the available library drives (pre-installed and installation CDs).

Return type:list of CloudSigmaDrive objects
ex_list_servers_availability_groups()[source]

Return which running servers share the same physical compute host.

Returns:A list of server UUIDs which share the same physical compute host. Servers which share the same host will be stored under the same list index.
Return type:list of list
ex_list_subscriptions(status='all', resources=None)[source]

List subscriptions for this account.

Parameters:
  • status (str) – Only return subscriptions with the provided status (optional).
  • resources (list) – Only return subscriptions for the provided resources (optional).
Return type:

list

ex_list_tags()[source]

List all the available tags.

Return type:list of CloudSigmaTag objects
ex_list_user_drives()[source]

Return a list of all the available user’s drives.

Return type:list of CloudSigmaDrive objects
ex_open_vnc_tunnel(node)[source]

Open a VNC tunnel to the provided node and return the VNC url.

Parameters:node (libcloud.compute.base.Node) – Node to open the VNC tunnel to.
Returns:URL of the opened VNC tunnel.
Return type:str
ex_resize_drive(drive, size)[source]

Resize a drive.

Parameters:
  • drive – Drive to resize.
  • size (int) – New drive size in bytes.
Returns:

Drive object which is being resized.

Return type:

CloudSigmaDrive

ex_start_node(node, ex_avoid=None)[source]

Start a node.

Parameters:
  • node (libcloud.compute.base.Node) – Node to start.
  • ex_avoid (list) – A list of other server uuids to avoid when starting this node. If provided, node will attempt to be started on a different physical infrastructure from other servers specified using this argument. (optional)
ex_stop_node(node)[source]

Stop a node.

ex_tag_resource(resource, tag)[source]

Associate tag with the provided resource.

Parameters:
Returns:

Updated tag object.

Return type:

CloudSigmaTag

ex_tag_resources(resources, tag)[source]

Associate tag with the provided resources.

Parameters:
Returns:

Updated tag object.

Return type:

CloudSigmaTag

ex_toggle_subscription_auto_renew(subscription)[source]

Toggle subscription auto renew status.

Parameters:subscription (CloudSigmaSubscription) – Subscription to toggle the auto renew flag for.
Returns:True on success, False otherwise.
Return type:bool
list_images()[source]

Return a list of available pre-installed library drives.

Note: If you want to list all the available library drives (both pre-installed and installation CDs), use ex_list_library_drives() method.

list_nodes(ex_tag=None)[source]

List available nodes.

Parameters:ex_tag (CloudSigmaTag) – If specified, only return servers tagged with the provided tag.
list_sizes()[source]

List available sizes.

name = 'CloudSigma (API v2.0)'
website = 'http://www.cloudsigma.com/'
exception libcloud.compute.drivers.cloudsigma.CloudSigmaError(http_code, error_type, error_msg, error_point, driver)[source]

Bases: libcloud.common.types.ProviderError

Represents CloudSigma API error.

Parameters:
  • http_code (int) – HTTP status code.
  • error_type (str) – Type of error (validation / notexist / backend / permissions database / concurrency / billing / payment)
  • error_msg (str) – A description of the error that occurred.
  • error_point (str or None) – Point at which the error occurred. Can be None.
class libcloud.compute.drivers.cloudsigma.CloudSigmaNodeSize(id, name, cpu, ram, disk, bandwidth, price, driver)[source]

Bases: libcloud.compute.base.NodeSize

class libcloud.compute.drivers.cloudsigma.CloudSigmaDrive(id, name, size, media, status, driver, extra=None)[source]

Bases: libcloud.compute.base.NodeImage

Represents a CloudSigma drive.

Parameters:
  • id (str) – Drive ID.
  • name (str) – Drive name.
  • size (int) – Drive size (in bytes).
  • media (str) – Drive media (cdrom / disk).
  • status (str) – Drive status (unmounted / mounted).
class libcloud.compute.drivers.cloudsigma.CloudSigmaTag(id, name, resources=None)[source]

Bases: object

Represents a CloudSigma tag object.

Parameters:
  • id (str) – Tag ID.
  • name (str) – Tag name.
  • resource – IDs of resources which are associated with this tag.
class libcloud.compute.drivers.cloudsigma.CloudSigmaSubscription(id, resource, amount, period, status, price, start_time, end_time, auto_renew, subscribed_object=None)[source]

Bases: object

Represents CloudSigma subscription.

Parameters:
  • id (str) – Subscription ID.
  • resource (str) – Resource (e.g vlan, ip, etc.).
  • period (str) – Subscription period.
  • status (str) – Subscription status (active / inactive).
  • price (str) – Subscription price.
  • start_time (datetime.datetime) – Start time for this subscription.
  • end_time (datetime.datetime) – End time for this subscription.
  • auto_renew (bool) – True if the subscription is auto renewed.
  • subscribed_object (str) – Optional UUID of the subscribed object.
class libcloud.compute.drivers.cloudsigma.CloudSigmaFirewallPolicy(id, name, rules)[source]

Bases: object

Represents a CloudSigma firewall policy.

Parameters:
  • id (str) – Policy ID.
  • name (str) – Policy name.
  • rules (list of CloudSigmaFirewallPolicyRule objects) – Rules associated with this policy.
class libcloud.compute.drivers.cloudsigma.CloudSigmaFirewallPolicyRule(action, direction, ip_proto=None, src_ip=None, src_port=None, dst_ip=None, dst_port=None, comment=None)[source]

Bases: object

Represents a CloudSigma firewall policy rule.

Parameters:
  • action (str) – Action (drop / accept).
  • direction (str) – Rule direction (in / out / both)>
  • ip_proto (str.) – IP protocol (tcp / udp).
  • src_ip (str) – Source IP in CIDR notation.
  • src_port (str) – Source port or a port range.
  • dst_ip (str) – Destination IP in CIDR notation.
  • src_port – Destination port or a port range.
  • comment (str) – Comment associated with the policy.

libcloud.compute.drivers.cloudstack module

class libcloud.compute.drivers.cloudstack.CloudStackAddress(id, address, driver, associated_network_id=None, vpc_id=None)[source]

Bases: object

A public IP address.

Parameters:
  • id (str) – UUID of the Public IP
  • address (str) – The public IP address
  • associated_network_id (str) – The ID of the network where this address has been associated with
  • vpc_id (str) – VPC the ip belongs to
release()[source]
class libcloud.compute.drivers.cloudstack.CloudStackDiskOffering(id, name, size, customizable)[source]

Bases: object

A disk offering within CloudStack.

class libcloud.compute.drivers.cloudstack.CloudStackEgressFirewallRule(id, network_id, cidr_list, protocol, icmp_code=None, icmp_type=None, start_port=None, end_port=None)[source]

Bases: object

A egress firewall rule.

A egress firewall rule.

@note: This is a non-standard extension API, and only works for
CloudStack.
Parameters:
  • id (int) – Firewall Rule ID
  • network_id (str) – the id network network for the egress firwall services
  • protocol (str) – TCP/IP Protocol (TCP, UDP)
  • cidr_list (str) – cidr list
  • icmp_code (int) – Error code for this icmp message
  • icmp_type (int) – Type of the icmp message being sent
  • start_port (int) – start of port range
  • end_port (int) – end of port range
Return type:

CloudStackEgressFirewallRule

class libcloud.compute.drivers.cloudstack.CloudStackFirewallRule(id, address, cidr_list, protocol, icmp_code=None, icmp_type=None, start_port=None, end_port=None)[source]

Bases: object

A firewall rule.

A Firewall rule.

@note: This is a non-standard extension API, and only works for
CloudStack.
Parameters:
  • id (int) – Firewall Rule ID
  • address (CloudStackAddress) – External IP address
  • cidr_list (str) – cidr list
  • protocol (str) – TCP/IP Protocol (TCP, UDP)
  • icmp_code (int) – Error code for this icmp message
  • icmp_type (int) – Type of the icmp message being sent
  • start_port (int) – start of port range
  • end_port (int) – end of port range
Return type:

CloudStackFirewallRule

class libcloud.compute.drivers.cloudstack.CloudStackIPForwardingRule(node, id, address, protocol, start_port, end_port=None)[source]

Bases: object

A NAT/firewall forwarding rule.

delete()[source]
class libcloud.compute.drivers.cloudstack.CloudStackNetwork(displaytext, name, networkofferingid, id, zoneid, driver, extra=None)[source]

Bases: object

Class representing a CloudStack Network.

class libcloud.compute.drivers.cloudstack.CloudStackNetworkACL(id, protocol, acl_id, action, cidr_list, start_port, end_port, traffic_type=None)[source]

Bases: object

a ACL rule in the given network (the network has to belong to VPC)

a ACL rule in the given network (the network has to belong to VPC)

@note: This is a non-standard extension API, and only works for
Cloudstack.
Parameters:id – the ID of the ACL Item

:type id int

Parameters:
  • protocol (string) – the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number
  • acl_id (str) – Name of the network ACL List
  • action (string) – scl entry action, allow or deny
  • cidr_list (str) – the cidr list to allow traffic from/to
  • start_port (str) – the starting port of ACL
  • end_port (str) – the ending port of ACL
  • traffic_type (str) – the traffic type for the ACL,can be Ingress or Egress, defaulted to Ingress if not specified
Return type:

CloudStackNetworkACL

class libcloud.compute.drivers.cloudstack.CloudStackNetworkACLList(acl_id, name, vpc_id, driver, description=None)[source]

Bases: object

a Network ACL for the given VPC

a Network ACL for the given VPC

@note: This is a non-standard extension API, and only works for
Cloudstack.
Parameters:
  • acl_id (int) – ACL ID
  • name (str) – Name of the network ACL List
  • vpc_id (string) – Id of the VPC associated with this network ACL List
  • description (str) – Description of the network ACL List
Return type:

CloudStackNetworkACLList

class libcloud.compute.drivers.cloudstack.CloudStackNetworkOffering(name, display_text, guest_ip_type, id, service_offering_id, for_vpc, driver, extra=None)[source]

Bases: object

Class representing a CloudStack Network Offering.

class libcloud.compute.drivers.cloudstack.CloudStackNic(id, network_id, net_mask, gateway, ip_address, is_default, mac_address, driver, extra=None)[source]

Bases: object

Class representing a CloudStack Network Interface.

class libcloud.compute.drivers.cloudstack.CloudStackNode(id, name, state, public_ips, private_ips, driver, size=None, image=None, extra=None)[source]

Bases: libcloud.compute.base.Node

Subclass of Node so we can expose our extension methods.

Parameters:
  • id (str) – Node ID.
  • name (str) – Node name.
  • state (libcloud.compute.types.NodeState) – Node state.
  • public_ips (list) – Public IP addresses associated with this node.
  • private_ips (list) – Private IP addresses associated with this node.
  • driver (NodeDriver) – Driver this node belongs to.
  • size (NodeImage) – Size of this node. (optional)
  • image – Image of this node. (optional)
  • extra (dict) – Optional provider specific attributes associated with this node.
ex_allocate_public_ip()[source]

Allocate a public IP and bind it to this node.

ex_create_ip_forwarding_rule(address, protocol, start_port, end_port=None)[source]

Add a NAT/firewall forwarding rule for a port or ports.

ex_create_port_forwarding_rule(address, private_port, public_port, protocol, public_end_port=None, private_end_port=None, openfirewall=True)[source]

Add a port forwarding rule for port or ports.

ex_delete_ip_forwarding_rule(rule)[source]

Delete a port forwarding rule.

ex_delete_port_forwarding_rule(rule)[source]

Delete a NAT/firewall rule.

ex_release_public_ip(address)[source]

Release a public IP that this node holds.

ex_start()[source]

Starts a stopped virtual machine.

ex_stop()[source]

Stops a running virtual machine.

class libcloud.compute.drivers.cloudstack.CloudStackNodeDriver(key, secret=None, secure=True, host=None, path=None, port=None, url=None, *args, **kwargs)[source]

Bases: libcloud.common.cloudstack.CloudStackDriverMixIn, libcloud.compute.base.NodeDriver

Driver for the CloudStack API.

Variables:
  • host – The host where the API can be reached.
  • path – The path where the API can be reached.
  • async_poll_frequency – How often (in seconds) to poll for async job completion.
Inherits:

NodeDriver.__init__

Parameters:
  • host (str) – The host where the API can be reached. (required)
  • path (str) – The path where the API can be reached. (required)
  • url (str) – Full URL to the API endpoint. Mutually exclusive with host and path argument.
NODE_STATE_MAP = {'Expunging': 3, 'Destroyed': 2, 'Running': 0, 'Stopped': 5, 'Error': 2, 'Stopping': 3, 'Starting': 1}
api_name = 'cloudstack'
attach_volume(node, volume, device=None)[source]

@inherits: NodeDriver.attach_volume :type node: CloudStackNode

Return type:bool
create_key_pair(name, **kwargs)[source]

Create a new key pair object.

Parameters:
  • name (str) – Key pair name.
  • name – Name of the keypair (required)
  • projectid (str) – An optional project for the ssh key
  • domainid (str) – An optional domainId for the ssh key. If the account parameter is used, domainId must also be used.
  • account (str) – An optional account for the ssh key. Must be used with domainId.
Returns:

Created key pair object.

Return type:

libcloud.compute.base.KeyPair

create_node(**kwargs)[source]

Create a new node

@inherits: NodeDriver.create_node

Parameters:
  • networks (list of CloudStackNetwork) – Optional list of networks to launch the server into.
  • project (CloudStackProject) – Optional project to create the new node under.
  • diskoffering (CloudStackDiskOffering) – Optional disk offering to add to the new node.
  • ex_keyname (str) – Name of existing keypair
  • ex_userdata (str) – String containing user data
  • ex_security_groups (list of str) – List of security groups to assign to the node
  • ex_displayname (str) – String containing instance display name
  • ex_ip_address (str) – String with ipaddress for the default nic
  • ex_start_vm (bool) – Boolean to specify to start VM after creation Default Cloudstack behaviour is to start a VM, if not specified.
Return type:

CloudStackNode

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

Creates a data volume Defaults to the first location

create_volume_snapshot(volume)[source]

Create snapshot from volume

Parameters:volume (StorageVolume) – Instance of StorageVolume
Return type:VolumeSnapshot
delete_key_pair(key_pair, **kwargs)[source]

Delete an existing key pair.

Parameters:
  • key_pair (:class`libcloud.compute.base.KeyPair`) – Key pair object.
  • projectid (str) – The project associated with keypair
  • domainid (str) – The domain ID associated with the keypair
  • account (str) – The account associated with the keypair. Must be used with the domainId parameter.
Returns:

True of False based on success of Keypair deletion

Return type:

bool

destroy_node(node)[source]

@inherits: NodeDriver.reboot_node :type node: CloudStackNode

Return type:bool
destroy_volume(volume)[source]
Return type:bool
destroy_volume_snapshot(snapshot)[source]

Destroy snapshot

Parameters:snapshot – Instance of VolumeSnapshot
Return type:bool
detach_volume(volume)[source]
Return type:bool
ex_allocate_public_ip(vpc_id=None, network_id=None, location=None)[source]

Allocate a public IP.

Parameters:
  • vpc_id (str) – VPC the ip belongs to
  • network_id (‘’str’‘) – Network where this IP is connected to.
  • location (NodeLocation) – Zone
Return type:

CloudStackAddress

ex_attach_nic_to_node(node, network, ip_address=None)[source]

Add an extra Nic to a VM

Parameters:
  • network (:class:’CloudStackNetwork`) – NetworkOffering object
  • node (:class:’CloudStackNode`) – Node Object
  • ip_address (str) – Optional, specific IP for this Nic
Return type:

bool

ex_authorize_security_group_ingress(securitygroupname, protocol, cidrlist, startport, endport=None)[source]

Creates a new Security Group Ingress rule

Parameters:
  • domainid (str) – An optional domainId for the security group. If the account parameter is used, domainId must also be used.
  • startport (int) – Start port for this ingress rule
  • securitygroupid (str) – The ID of the security group. Mutually exclusive with securityGroupName parameter
  • cidrlist (list) – The cidr list associated
  • usersecuritygrouplist (dict) – user to security group mapping
  • securitygroupname (str) – The name of the security group. Mutually exclusive with securityGroupName parameter
  • account (str) – An optional account for the security group. Must be used with domainId.
  • icmpcode (int) – Error code for this icmp message
  • protocol (str) – TCP is default. UDP is the other supported protocol
  • icmptype (int) – type of the icmp message being sent
  • projectid (str) – An optional project of the security group
  • endport (int) – end port for this ingress rule
Return type:

list

ex_create_egress_firewall_rule(network_id, cidr_list, protocol, icmp_code=None, icmp_type=None, start_port=None, end_port=None)[source]

Creates a Firewalle Rule

Parameters:
  • network_id (str) – the id network network for the egress firwall services
  • cidr_list (str) – cidr list
  • protocol (str) – TCP/IP Protocol (TCP, UDP)
  • icmp_code (int) – Error code for this icmp message
  • icmp_type (int) – Type of the icmp message being sent
  • start_port (int) – start of port range
  • end_port (int) – end of port range
Return type:

CloudStackEgressFirewallRule

ex_create_firewall_rule(address, cidr_list, protocol, icmp_code=None, icmp_type=None, start_port=None, end_port=None)[source]

Creates a Firewalle Rule

Parameters:
  • address (CloudStackAddress) – External IP address
  • cidr_list (str) – cidr list
  • protocol (str) – TCP/IP Protocol (TCP, UDP)
  • icmp_code (int) – Error code for this icmp message
  • icmp_type (int) – Type of the icmp message being sent
  • start_port (int) – start of port range
  • end_port (int) – end of port range
Return type:

CloudStackFirewallRule

ex_create_ip_forwarding_rule(node, address, protocol, start_port, end_port=None)[source]

“Add a NAT/firewall forwarding rule.

Parameters:
  • node (CloudStackNode) – Node which should be used
  • address (CloudStackAddress) – CloudStackAddress which should be used
  • protocol (str) – Protocol which should be used (TCP or UDP)
  • start_port (int) – Start port which should be used
  • end_port (int) – End port which should be used
Return type:

CloudStackForwardingRule

ex_create_keypair(name, **kwargs)[source]

Creates a SSH KeyPair, returns fingerprint and private key

Parameters:
  • name (str) – Name of the keypair (required)
  • projectid (str) – An optional project for the ssh key
  • domainid (str) – An optional domainId for the ssh key. If the account parameter is used, domainId must also be used.
  • account (str) – An optional account for the ssh key. Must be used with domainId.
Returns:

A keypair dictionary

Return type:

dict

ex_create_network(display_text, name, network_offering, location, gateway=None, netmask=None, network_domain=None, vpc_id=None, project_id=None)[source]

Creates a Network, only available in advanced zones.

Parameters:
  • display_text (str) – the display text of the network
  • name (str) – the name of the network
  • network_offering (:class:’CloudStackNetworkOffering`) – NetworkOffering object
  • location (NodeLocation) – Zone object
  • gateway (str) – Optional, the Gateway of this network
  • netmask (str) – Optional, the netmask of this network
  • network_domain (str) – Optional, the DNS domain of the network
  • vpc_id (str) – Optional, the VPC id the network belongs to
  • project_id (str) – Optional, the project id the networks belongs to
Return type:

CloudStackNetwork

ex_create_network_acl(protocol, acl_id, cidr_list, start_port, end_port, action=None, traffic_type=None)[source]

Creates an ACL rule in the given network (the network has to belong to VPC)

Parameters:
  • protocol (string) – the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number
  • acl_id (str) – Name of the network ACL List
  • cidr_list (str) – the cidr list to allow traffic from/to
  • start_port (str) – the starting port of ACL
  • end_port (str) – the ending port of ACL
  • action (str) – scl entry action, allow or deny
  • traffic_type (str) – the traffic type for the ACL,can be Ingress or Egress, defaulted to Ingress if not specified
Return type:

CloudStackNetworkACL

ex_create_network_acllist(name, vpc_id, description=None)[source]

Create an ACL List for a network within a VPC.

Parameters:
  • name (string) – Name of the network ACL List
  • vpc_id (string) – Id of the VPC associated with this network ACL List
  • description (string) – Description of the network ACL List
Return type:

CloudStackNetworkACLList

ex_create_port_forwarding_rule(node, address, private_port, public_port, protocol, public_end_port=None, private_end_port=None, openfirewall=True, network_id=None)[source]

Creates a Port Forwarding Rule, used for Source NAT

Parameters:
  • address (CloudStackAddress) – IP address of the Source NAT
  • private_port (int) – Port of the virtual machine
  • protocol (str) – Protocol of the rule
  • public_port (int) – Public port on the Source NAT address
  • node (CloudStackNode) – The virtual machine
  • network_id (string) – The network of the vm the Port Forwarding rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)
Return type:

CloudStackPortForwardingRule

ex_create_security_group(name, **kwargs)[source]

Creates a new Security Group

Parameters:
  • name (str) – name of the security group (required)
  • account (str) – An optional account for the security group. Must be used with domainId.
  • domainid (str) – An optional domainId for the security group. If the account parameter is used, domainId must also be used.
  • description (str) – The description of the security group
  • projectid (str) – Deploy vm for the project
Return type:

dict

ex_create_snapshot_template(snapshot, name, ostypeid, displaytext=None)[source]

Create a template from a snapshot

Parameters:
  • snapshot – Instance of VolumeSnapshot
  • name (str) – the name of the template
  • name – the os type id
  • name – the display name of the template
Return type:

NodeImage

ex_create_tags(resource_ids, resource_type, tags)[source]

Create tags for a resource (Node/StorageVolume/etc). A list of resource types can be found at http://goo.gl/6OKphH

Parameters:
  • resource_ids (list of resource IDs) – Resource IDs to be tagged. The resource IDs must all be associated with the resource_type. For example, for virtual machines (UserVm) you can only specify a list of virtual machine IDs.
  • resource_type (str) – Resource type (eg: UserVm)
  • tags (dict) – A dictionary or other mapping of strings to strings, associating tag names with tag values.
Return type:

bool

ex_create_vpc(cidr, display_text, name, vpc_offering, zone_id, network_domain=None)[source]

Creates a VPC, only available in advanced zones.

Parameters:
  • cidr – the cidr of the VPC. All VPC guest networks’ cidrs should be within this CIDR
  • display_text (str) – the display text of the VPC
  • name (str) – the name of the VPC
  • vpc_offering (:class:’CloudStackVPCOffering`) – the ID of the VPC offering
  • zone_id (str) – the ID of the availability zone
  • network_domain (str) – Optional, the DNS domain of the network
Return type:

CloudStackVPC

ex_delete_egress_firewall_rule(firewall_rule)[source]

Remove a Firewall rule.

Parameters:egress_firewall_rule (CloudStackEgressFirewallRule) – Firewall rule which should be used
Return type:bool
ex_delete_firewall_rule(firewall_rule)[source]

Remove a Firewall rule.

Parameters:firewall_rule (CloudStackFirewallRule) – Firewall rule which should be used
Return type:bool
ex_delete_ip_forwarding_rule(node, rule)[source]

Remove a NAT/firewall forwarding rule.

Parameters:
  • node (CloudStackNode) – Node which should be used
  • rule (CloudStackForwardingRule) – Forwarding rule which should be used
Return type:

bool

ex_delete_keypair(keypair, **kwargs)[source]

Deletes an existing SSH KeyPair

Parameters:
  • keypair (str) – Name of the keypair (required)
  • projectid (str) – The project associated with keypair
  • domainid (str) – The domain ID associated with the keypair
  • account (str) – The account associated with the keypair. Must be used with the domainId parameter.
Returns:

True of False based on success of Keypair deletion

Return type:

bool

ex_delete_network(network, force=None)[source]

Deletes a Network, only available in advanced zones.

Parameters:
  • network – The network
  • force (bool) – Force deletion of the network?
Return type:

bool

ex_delete_port_forwarding_rule(node, rule)[source]

Remove a Port forwarding rule.

Parameters:
Return type:

bool

ex_delete_security_group(name)[source]

Deletes a given Security Group

Parameters:
  • domainid (str) – The domain ID of account owning the security group
  • id (str) – The ID of the security group. Mutually exclusive with name parameter
  • name (str) – The ID of the security group. Mutually exclusive with id parameter
  • account (str) – The account of the security group. Must be specified with domain ID
  • projectid (str) – The project of the security group
Return type:

bool

ex_delete_tags(resource_ids, resource_type, tag_keys)[source]

Delete tags from a resource.

Parameters:
  • resource_ids (list of resource IDs) – Resource IDs to be tagged. The resource IDs must all be associated with the resource_type. For example, for virtual machines (UserVm) you can only specify a list of virtual machine IDs.
  • resource_type (str) – Resource type (eg: UserVm)
  • tag_keys (list) – A list of keys to delete. CloudStack only requires the keys from the key/value pair.
Return type:

bool

ex_delete_vpc(vpc)[source]

Deletes a VPC, only available in advanced zones.

Parameters:vpc – The VPC
Return type:bool
ex_detach_nic_from_node(nic, node)[source]

Remove Nic from a VM

Parameters:
  • nic (:class:’CloudStackNetwork`) – Nic object
  • node (:class:’CloudStackNode`) – Node Object
Return type:

bool

ex_import_keypair(name, keyfile)[source]

Imports a new public key where the public key is passed via a filename

Parameters:
  • name (str) – The name of the public key to import.
  • keyfile (str) – The filename with path of the public key to import.
Return type:

dict

ex_import_keypair_from_string(name, key_material)[source]

Imports a new public key where the public key is passed in as a string

Parameters:
  • name (str) – The name of the public key to import.
  • key_material (str) – The contents of a public key file.
Return type:

dict

ex_limits()[source]

Extra call to get account’s resource limits, such as the amount of instances, volumes, snapshots and networks.

CloudStack uses integers as the resource type so we will convert them to a more human readable string using the resource map

A list of the resource type mappings can be found at http://goo.gl/17C6Gk

Returns:dict
Return type:dict
ex_list_disk_offerings()[source]

Fetch a list of all available disk offerings.

Return type:list of CloudStackDiskOffering
ex_list_egress_firewall_rules()[source]

Lists all agress Firewall Rules

Return type:list of CloudStackEgressFirewallRule
ex_list_firewall_rules()[source]

Lists all Firewall Rules

Return type:list of CloudStackFirewallRule
ex_list_keypairs(**kwargs)[source]

List Registered SSH Key Pairs

Parameters:
  • projectid (str) – list objects by project
  • page (int) – The page to list the keypairs from
  • keyword (str) – List by keyword
  • listall (bool) – If set to false, list only resources belonging to the command’s caller; if set to true - list resources that the caller is authorized to see. Default value is false
  • pagesize (int) – The number of results per page
  • account (str) – List resources by account. Must be used with the domainId parameter
  • isrecursive (bool) – Defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.
  • fingerprint (str) – A public key fingerprint to look for
  • name (str) – A key pair name to look for
  • domainid (str) – List only resources belonging to the domain specified
Returns:

A list of keypair dictionaries

Return type:

list of dict

ex_list_network_acl()[source]

Lists all network ACL items

Return type:list of CloudStackNetworkACL
ex_list_network_acllists()[source]

Lists all network ACLs

Return type:list of CloudStackNetworkACLList
ex_list_network_offerings()[source]

List the available network offerings

:rtype list of CloudStackNetworkOffering

ex_list_networks(project=None)[source]

List the available networks

Parameters:project (CloudStackProject) – Optional project the networks belongs to.

:rtype list of CloudStackNetwork

ex_list_nics(node)[source]

List the available networks

Parameters:vm (:class:`CloudStackNode) – Node Object

:rtype list of CloudStackNic

ex_list_os_types()[source]

List all registered os types (needed for snapshot creation)

Return type:list
ex_list_port_forwarding_rules()[source]

Lists all Port Forwarding Rules

Return type:list of CloudStackPortForwardingRule
ex_list_projects()[source]

List the available projects

:rtype list of CloudStackProject

ex_list_public_ips()[source]

Lists all Public IP Addresses.

Return type:list of CloudStackAddress
ex_list_routers(vpc_id=None)[source]

List routers

:rtype list of CloudStackRouter

ex_list_security_groups(**kwargs)[source]

Lists Security Groups

Parameters:
  • domainid (str) – List only resources belonging to the domain specified
  • account (str) – List resources by account. Must be used with the domainId parameter.
  • listall (bool) – If set to false, list only resources belonging to the command’s caller; if set to true list resources that the caller is authorized to see. Default value is false
  • pagesize (int) – Number of entries per page
  • keyword (str) – List by keyword
  • tags (dict) – List resources by tags (key/value pairs)
  • id (str) – list the security group by the id provided
  • securitygroupname (str) – lists security groups by name
  • virtualmachineid (str) – lists security groups by virtual machine id
  • projectid (str) – list objects by project
  • isrecursive (bool) – (boolean) defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.
  • page (int) – (integer)

:rtype list

ex_list_vpc_offerings()[source]

List the available vpc offerings

:rtype list of CloudStackVPCOffering

ex_list_vpcs()[source]

List the available VPCs

:rtype list of CloudStackVPC

ex_register_iso(name, url, location=None, **kwargs)[source]

Registers an existing ISO by URL.

Parameters:
  • name (str) – Name which should be used
  • url (str) – Url should be used
  • location (NodeLocation) – Location which should be used
Return type:

str

ex_release_public_ip(address)[source]

Release a public IP.

Parameters:address (CloudStackAddress) – CloudStackAddress which should be used
Return type:bool
ex_replace_network_acllist(acl_id, network_id)[source]

Create an ACL List for a network within a VPC.Replaces ACL associated with a Network or private gateway

Parameters:
  • acl_id (string) – the ID of the network ACL
  • network_id (string) – the ID of the network
Return type:

CloudStackNetworkACLList

ex_revoke_security_group_ingress(rule_id)[source]

Revoke/delete an ingress security rule

Parameters:id (str) – The ID of the ingress security rule
Return type:bool
ex_start(node)[source]

Starts/Resumes a stopped virtual machine

Parameters:
  • id (str) – The ID of the virtual machine (required)
  • hostid (str) – destination Host ID to deploy the VM to parameter available for root admin only

:rtype str

ex_stop(node)[source]

Stops/Suspends a running virtual machine

Parameters:node (CloudStackNode) – Node to stop.
Return type:str
features = {'create_node': ['generates_password']}
get_key_pair(name)[source]
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.
Returns:

Imported key pair object.

Return type:

libcloud.compute.base.KeyPair

list_images(location=None)[source]
list_key_pairs(**kwargs)[source]

List registered key pairs.

Parameters:
  • projectid (str) – list objects by project
  • page (int) – The page to list the keypairs from
  • keyword (str) – List by keyword
  • listall (bool) – If set to false, list only resources belonging to the command’s caller; if set to true - list resources that the caller is authorized to see. Default value is false
  • pagesize (int) – The number of results per page
  • account (str) – List resources by account. Must be used with the domainId parameter
  • isrecursive (bool) – Defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.
  • fingerprint (str) – A public key fingerprint to look for
  • name (str) – A key pair name to look for
  • domainid (str) – List only resources belonging to the domain specified
Returns:

A list of key par objects.

Return type:

list of libcloud.compute.base.KeyPair

list_locations()[source]

:rtype list of NodeLocation

list_nodes(project=None)[source]

@inherits: NodeDriver.list_nodes

Parameters:project (CloudStackProject) – Limit nodes returned to those configured under the defined project.
Return type:list of CloudStackNode
list_sizes(location=None)[source]

:rtype list of NodeSize

list_snapshots()[source]

Describe all snapshots.

Return type:list of VolumeSnapshot
list_volumes(node=None)[source]

List all volumes

Parameters:node (CloudStackNode) – Only return volumes for the provided node.
Return type:list of StorageVolume
name = 'CloudStack'
reboot_node(node)[source]

@inherits: NodeDriver.reboot_node :type node: CloudStackNode

Return type:bool
type = 'cloudstack'
website = 'http://cloudstack.org/'
class libcloud.compute.drivers.cloudstack.CloudStackPortForwardingRule(node, rule_id, address, protocol, public_port, private_port, public_end_port=None, private_end_port=None, network_id=None)[source]

Bases: object

A Port forwarding rule for Source NAT.

A Port forwarding rule for Source NAT.

@note: This is a non-standard extension API, and only works for EC2.

Parameters:
  • node (Node) – Node for rule
  • rule_id (int) – Rule ID
  • address (CloudStackAddress) – External IP address
  • protocol (str) – TCP/IP Protocol (TCP, UDP)
  • public_port (int) – External port for rule (or start port if public_end_port is also provided)
  • private_port (int) – Internal node port for rule (or start port if public_end_port is also provided)
  • public_end_port (int) – End of external port range
  • private_end_port (int) – End of internal port range
  • network_id (str) – The network of the vm the Port Forwarding rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)
Return type:

CloudStackPortForwardingRule

delete()[source]
class libcloud.compute.drivers.cloudstack.CloudStackProject(id, name, display_text, driver, extra=None)[source]

Bases: object

Class representing a CloudStack Project.

class libcloud.compute.drivers.cloudstack.CloudStackRouter(id, name, state, public_ip, vpc_id, driver)[source]

Bases: object

Class representing a CloudStack Router.

class libcloud.compute.drivers.cloudstack.CloudStackVPC(name, vpc_offering_id, id, cidr, driver, zone_id=None, display_text=None, extra=None)[source]

Bases: object

Class representing a CloudStack VPC.

class libcloud.compute.drivers.cloudstack.CloudStackVPCOffering(name, display_text, id, driver, extra=None)[source]

Bases: object

Class representing a CloudStack VPC Offering.

libcloud.compute.drivers.digitalocean module

Digital Ocean Driver

class libcloud.compute.drivers.digitalocean.DigitalOceanConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Connection class for the DigitalOcean driver.

add_default_params(params)[source]

Add parameters that are necessary for every request

This method adds client_id and api_key to the request.

host = 'api.digitalocean.com'
responseCls

alias of DigitalOceanResponse

class libcloud.compute.drivers.digitalocean.DigitalOceanNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

DigitalOceanNode node driver.

NODE_STATE_MAP = {'active': 0, 'new': 3, 'off': 1}
connectionCls

alias of DigitalOceanConnection

create_node(name, size, image, location, ex_ssh_key_ids=None, **kwargs)[source]

Create a node.

Parameters:ex_ssh_key_ids (list of str) – A list of ssh key ids which will be added to the server. (optional)
Returns:The newly created node.
Return type:Node
destroy_node(node)[source]
ex_create_ssh_key(name, ssh_key_pub)[source]

Create a new SSH key.

Parameters:
  • name (str) – Key name (required)
  • name – Valid public key string (required)
ex_destroy_ssh_key(key_id)[source]

Delete an existing SSH key.

Parameters:key_id (str) – SSH key id (required)
ex_list_ssh_keys()[source]

List all the available SSH keys.

Returns:Available SSH keys.
Return type:list of SSHKey
ex_rename_node(node, name)[source]
list_images()[source]
list_locations()[source]
list_nodes()[source]
list_sizes()[source]
name = 'Digital Ocean'
reboot_node(node)[source]
type = 'digitalocean'
website = 'https://www.digitalocean.com'
class libcloud.compute.drivers.digitalocean.DigitalOceanResponse(response, connection)[source]

Bases: libcloud.common.base.JsonResponse

Parameters:
parse_error()[source]
class libcloud.compute.drivers.digitalocean.SSHKey(id, name, pub_key)[source]

Bases: object

libcloud.compute.drivers.dreamhost module

DreamHost Driver

exception libcloud.compute.drivers.dreamhost.DreamhostAPIException[source]

Bases: exceptions.Exception

class libcloud.compute.drivers.dreamhost.DreamhostConnection(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.base.ConnectionKey

Connection class to connect to DreamHost’s API servers

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

add_default_params(params)[source]

Add key and format parameters to the request. Eventually should add unique_id to prevent re-execution of a single request.

format = 'json'
host = 'api.dreamhost.com'
responseCls

alias of DreamhostResponse

class libcloud.compute.drivers.dreamhost.DreamhostNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Node Driver for DreamHost PS

api_name = 'dreamhost'
connectionCls

alias of DreamhostConnection

create_node(**kwargs)[source]

Create a new Dreamhost node

@inherits: NodeDriver.create_node

Parameters:ex_movedata (str) – Copy all your existing users to this new PS
destroy_node(node)[source]
list_images(**kwargs)[source]
list_locations(**kwargs)[source]
list_nodes(**kwargs)[source]
list_sizes(**kwargs)[source]
name = 'Dreamhost'
reboot_node(node)[source]
type = 'dreamhost'
website = 'http://dreamhost.com/'
class libcloud.compute.drivers.dreamhost.DreamhostResponse(response, connection)[source]

Bases: libcloud.common.base.JsonResponse

Response class for DreamHost PS

Parameters:
parse_body()[source]
parse_error()[source]

libcloud.compute.drivers.dummy module

Dummy Driver

@note: This driver is out of date

class libcloud.compute.drivers.dummy.DummyConnection(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.base.ConnectionKey

Dummy connection class

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

connect(host=None, port=None)[source]
class libcloud.compute.drivers.dummy.DummyNodeDriver(creds)[source]

Bases: libcloud.compute.base.NodeDriver

Dummy node driver

This is a fake driver which appears to always create or destroy nodes successfully.

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> node=driver.create_node()
>>> node.public_ips[0]
'127.0.0.3'
>>> node.name
'dummy-3'

If the credentials you give convert to an integer then the next node to be created will be one higher.

Each time you create a node you will get a different IP address.

>>> driver = DummyNodeDriver(22)
>>> node=driver.create_node()
>>> node.name
'dummy-23'
Parameters:creds (str) – Credentials
Return type:None
create_node(**kwargs)[source]

Creates a dummy node; the node id is equal to the number of nodes in the node list

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> sorted([node.name for node in driver.list_nodes()])
['dummy-1', 'dummy-2']
>>> nodeA = driver.create_node()
>>> sorted([node.name for node in driver.list_nodes()])
['dummy-1', 'dummy-2', 'dummy-3']
>>> driver.create_node().name
'dummy-4'
>>> driver.destroy_node(nodeA)
True
>>> sorted([node.name for node in driver.list_nodes()])
['dummy-1', 'dummy-2', 'dummy-4']

@inherits: NodeDriver.create_node

destroy_node(node)[source]

Sets the node state to terminated and removes it from the node list

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> from libcloud.compute.types import NodeState
>>> node = [node for node in driver.list_nodes() if
...         node.name == 'dummy-1'][0]
>>> node.state == NodeState.RUNNING
True
>>> driver.destroy_node(node)
True
>>> node.state == NodeState.RUNNING
False
>>> [n for n in driver.list_nodes() if n.name == 'dummy-1']
[]

@inherits: NodeDriver.destroy_node

get_uuid(unique_field=None)[source]
Parameters:unique_field (bool) – Unique field
Return type:UUID
import_key_pair_from_string(name, key_material)[source]
list_images(location=None)[source]

Returns a list of images as a cloud provider might have

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> sorted([image.name for image in driver.list_images()])
['Slackware 4', 'Ubuntu 9.04', 'Ubuntu 9.10']

@inherits: NodeDriver.list_images

list_locations()[source]

Returns a list of locations of nodes

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> sorted([loc.name + " in " + loc.country for loc in
...         driver.list_locations()])
['Island Datacenter in FJ', 'London Loft in GB', "Paul's Room in US"]

@inherits: NodeDriver.list_locations

list_nodes()[source]

List the nodes known to a particular driver; There are two default nodes created at the beginning

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> node_list=driver.list_nodes()
>>> sorted([node.name for node in node_list ])
['dummy-1', 'dummy-2']

each item in the list returned is a node object from which you can carry out any node actions you wish

>>> node_list[0].reboot()
True

As more nodes are added, list_nodes will return them

>>> node=driver.create_node()
>>> node.size.id
's1'
>>> node.image.id
'i2'
>>> sorted([n.name for n in driver.list_nodes()])
['dummy-1', 'dummy-2', 'dummy-3']

@inherits: NodeDriver.list_nodes

list_sizes(location=None)[source]

Returns a list of node sizes as a cloud provider might have

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> sorted([size.ram for size in driver.list_sizes()])
[128, 512, 4096, 8192]

@inherits: NodeDriver.list_images

name = 'Dummy Node Provider'
reboot_node(node)[source]

Sets the node state to rebooting; in this dummy driver always returns True as if the reboot had been successful.

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> node=driver.create_node()
>>> from libcloud.compute.types import NodeState
>>> node.state == NodeState.RUNNING
True
>>> node.state == NodeState.REBOOTING
False
>>> driver.reboot_node(node)
True
>>> node.state == NodeState.REBOOTING
True

Please note, dummy nodes never recover from the reboot.

@inherits: NodeDriver.reboot_node

type = 'dummy'
website = 'http://example.com'

libcloud.compute.drivers.ec2 module

Amazon EC2, Eucalyptus, Nimbus and Outscale drivers.

libcloud.compute.drivers.ec2.OUTSCALE_INSTANCE_TYPES = {'os1.4xlarge': {'disk': 120, 'bandwidth': None, 'ram': 131072, 'id': 'os1.4xlarge', 'name': 'Memory Optimized, High Storage, Passthrough NIC Quadruple Extra Large Instance'}, 'nv1.large': {'disk': 840, 'bandwidth': None, 'ram': 7679, 'id': 'nv1.large', 'name': 'GPU Large Instance'}, 'oc2.8xlarge': {'disk': 3360, 'bandwidth': None, 'ram': 65535, 'id': 'oc2.8xlarge', 'name': 'Outscale Eight Extra Large Instance'}, 'os1.2xlarge': {'disk': 60, 'bandwidth': None, 'ram': 65536, 'id': 'os1.2xlarge', 'name': 'Memory Optimized, High Storage, Passthrough NIC Double Extra Large Instance'}, 'os1.8xlarge': {'disk': 500, 'bandwidth': None, 'ram': 249856, 'id': 'os1.8xlarge', 'name': 'Memory Optimized, High Storage, Passthrough NIC Eight Extra Large Instance'}, 'c1.xlarge': {'disk': 1680, 'bandwidth': None, 'ram': 7168, 'id': 'c1.xlarge', 'name': 'Compute Optimized Extra Large Instance'}, 'nv1.medium': {'disk': 420, 'bandwidth': None, 'ram': 3839, 'id': 'nv1.medium', 'name': 'GPU Medium Instance'}, 'nv1.small': {'disk': 150, 'bandwidth': None, 'ram': 1739, 'id': 'nv1.small', 'name': 'GPU Small Instance'}, 'g2.2xlarge': {'disk': 60, 'bandwidth': None, 'ram': 15360, 'id': 'g2.2xlarge', 'name': 'GPU Double Extra Large Instance'}, 'm1.small': {'disk': 150, 'bandwidth': None, 'ram': 1740, 'id': 'm1.small', 'name': 'Standard Small Instance'}, 'c1.medium': {'disk': 340, 'bandwidth': None, 'ram': 1740, 'id': 'c1.medium', 'name': 'Compute Optimized Medium Instance'}, 'm3.2xlarge': {'disk': 0, 'bandwidth': None, 'ram': 30720, 'id': 'm3.2xlarge', 'name': 'High Storage Optimized Double Extra Large Instance'}, 'm3s.2xlarge': {'disk': 0, 'bandwidth': None, 'ram': 30719, 'id': 'm3s.2xlarge', 'name': 'High Storage Optimized Double Extra Large Instance'}, 'm2.xlarge': {'disk': 420, 'bandwidth': None, 'ram': 17510, 'id': 'm2.xlarge', 'name': 'High Memory Extra Large Instance'}, 't1.micro': {'disk': 0, 'bandwidth': None, 'ram': 615, 'id': 't1.micro', 'name': 'Micro Instance'}, 'cr1.8xlarge': {'disk': 240, 'bandwidth': None, 'ram': 249855, 'id': 'cr1.8xlarge', 'name': 'Memory Optimized Eight Extra Large Instance'}, 'c3.large': {'disk': 32, 'bandwidth': None, 'ram': 3840, 'id': 'c3.large', 'name': 'Compute Optimized Large Instance'}, 'cc1.4xlarge': {'disk': 1680, 'bandwidth': None, 'ram': 24576, 'id': 'cc1.4xlarge', 'name': 'Cluster Compute Quadruple Extra Large Instance'}, 'm1.medium': {'disk': 420, 'bandwidth': None, 'ram': 3840, 'id': 'm1.medium', 'name': 'Standard Medium Instance'}, 'oc1.4xlarge': {'disk': 1680, 'bandwidth': None, 'ram': 24575, 'id': 'oc1.4xlarge', 'name': 'Outscale Quadruple Extra Large Instance'}, 'c3.xlarge': {'disk': 80, 'bandwidth': None, 'ram': 7168, 'id': 'c3.xlarge', 'name': 'Compute Optimized Extra Large Instance'}, 'c3.8xlarge': {'disk': 640, 'bandwidth': None, 'ram': 61440, 'id': 'c3.8xlarge', 'name': 'Compute Optimized Eight Extra Large Instance'}, 'm1.large': {'disk': 840, 'bandwidth': None, 'ram': 7680, 'id': 'm1.large', 'name': 'Standard Large Instance'}, 'c3.2xlarge': {'disk': 160, 'bandwidth': None, 'ram': 15359, 'id': 'c3.2xlarge', 'name': 'Compute Optimized Double Extra Large Instance'}, 'm3s.xlarge': {'disk': 0, 'bandwidth': None, 'ram': 15359, 'id': 'm3s.xlarge', 'name': 'High Storage Optimized Extra Large Instance'}, 'cc2.8xlarge': {'disk': 3360, 'bandwidth': None, 'ram': 65536, 'id': 'cc2.8xlarge', 'name': 'Cluster Compute Eight Extra Large Instance'}, 'nv1.xlarge': {'disk': 1680, 'bandwidth': None, 'ram': 15358, 'id': 'nv1.xlarge', 'name': 'GPU Extra Large Instance'}, 'c3.4xlarge': {'disk': 320, 'bandwidth': None, 'ram': 30720, 'id': 'c3.4xlarge', 'name': 'Compute Optimized Quadruple Extra Large Instance'}, 'm1.xlarge': {'disk': 1680, 'bandwidth': None, 'ram': 15360, 'id': 'm1.xlarge', 'name': 'Standard Extra Large Instance'}, 'm2.4xlarge': {'disk': 1680, 'bandwidth': None, 'ram': 70042, 'id': 'm2.4xlarge', 'name': 'High Memory Quadruple Extra Large Instance'}, 'm2.2xlarge': {'disk': 840, 'bandwidth': None, 'ram': 35020, 'id': 'm2.2xlarge', 'name': 'High Memory Double Extra Large Instance'}, 'm3.xlarge': {'disk': 0, 'bandwidth': None, 'ram': 15357, 'id': 'm3.xlarge', 'name': 'High Storage Optimized Extra Large Instance'}, 'hi1.xlarge': {'disk': 1680, 'bandwidth': None, 'ram': 15361, 'id': 'hi1.xlarge', 'name': 'High Storage Extra Large Instance'}}

The function manipulating Outscale cloud regions will be overridden because Outscale instances types are in a separate dict so also declare Outscale cloud regions in some other constants.

libcloud.compute.drivers.ec2.OUTSCALE_INC_REGION_DETAILS = {'us-east-1': {'country': 'USA', 'api_name': 'osc_inc_us_east_1', 'endpoint': 'api.us-east-1.outscale.com', 'instance_types': ['t1.micro', 'm1.small', 'm1.medium', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'm2.xlarge', 'm2.2xlarge', 'm2.4xlarge', 'nv1.small', 'nv1.medium', 'nv1.large', 'nv1.xlarge', 'cc1.4xlarge', 'cc2.8xlarge', 'm3.xlarge', 'm3.2xlarge', 'cr1.8xlarge', 'os1.8xlarge']}, 'eu-west-1': {'country': 'FRANCE', 'api_name': 'osc_inc_eu_west_1', 'endpoint': 'api.eu-west-1.outscale.com', 'instance_types': ['t1.micro', 'm1.small', 'm1.medium', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'm2.xlarge', 'm2.2xlarge', 'm2.4xlarge', 'nv1.small', 'nv1.medium', 'nv1.large', 'nv1.xlarge', 'cc1.4xlarge', 'cc2.8xlarge', 'm3.xlarge', 'm3.2xlarge', 'cr1.8xlarge', 'os1.8xlarge']}, 'eu-west-3': {'country': 'FRANCE', 'api_name': 'osc_inc_eu_west_3', 'endpoint': 'api-ppd.outscale.com', 'instance_types': ['t1.micro', 'm1.small', 'm1.medium', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'm2.xlarge', 'm2.2xlarge', 'm2.4xlarge', 'nv1.small', 'nv1.medium', 'nv1.large', 'nv1.xlarge', 'cc1.4xlarge', 'cc2.8xlarge', 'm3.xlarge', 'm3.2xlarge', 'cr1.8xlarge', 'os1.8xlarge']}}

Define the extra dictionary for specific resources

libcloud.compute.drivers.ec2.EUCA_NAMESPACE = 'http://msgs.eucalyptus.com/3.3.0'

Sizes must be hardcoded, because Amazon doesn’t provide an API to fetch them. From http://aws.amazon.com/ec2/instance-types/

class libcloud.compute.drivers.ec2.EC2NodeDriver(key, secret=None, secure=True, host=None, port=None, region='us-east-1', **kwargs)[source]

Bases: libcloud.compute.drivers.ec2.BaseEC2NodeDriver

Amazon EC2 node driver.

NODE_STATE_MAP = {'terminated': 2, 'running': 0, 'stopped': 5, 'shutting-down': 4, 'pending': 3}
connectionCls

alias of EC2Connection

name = 'Amazon EC2'
path = '/'
type = 'ec2_us_east'
website = 'http://aws.amazon.com/ec2/'
class libcloud.compute.drivers.ec2.BaseEC2NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Base Amazon EC2 node driver.

Used for main EC2 and other derivate driver classes to inherit from it.

NODE_STATE_MAP = {'terminated': 2, 'running': 0, 'shutting-down': 4, 'pending': 3}
attach_volume(node, volume, device)[source]
connectionCls

alias of EC2Connection

copy_image(image, source_region, name=None, description=None)[source]

Copy an Amazon Machine Image from the specified source region to the current region.

@inherits: NodeDriver.copy_image

Parameters:
  • source_region (str) – The region where the image resides
  • image (NodeImage) – Instance of class NodeImage
  • name (str) – The name of the new image
  • description (str) – The description of the new image
Returns:

Instance of class NodeImage

Return type:

NodeImage

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

Create an Amazon Machine Image based off of an EBS-backed instance.

@inherits: NodeDriver.create_image

Parameters:
  • node – Instance of Node
  • name (str) – The name for the new image
  • block_device_mapping (list of dict) – A dictionary of the disk layout An example of this dict is included below.
  • reboot (bool) – Whether or not to shutdown the instance before creation. Amazon calls this NoReboot and sets it to false by default to ensure a clean image.
  • description (str) – An optional description for the new image

An example block device mapping dictionary is included:

mapping = [{‘VirtualName’: None,
‘Ebs’: {‘VolumeSize’: 10,
‘VolumeType’: ‘standard’, ‘DeleteOnTermination’: ‘true’}, ‘DeviceName’: ‘/dev/sda1’}]
Returns:Instance of class NodeImage
Return type:NodeImage
create_key_pair(name)[source]
create_node(**kwargs)[source]

Create a new EC2 node.

Reference: http://bit.ly/8ZyPSy [docs.amazonwebservices.com]

@inherits: NodeDriver.create_node

Parameters:
  • ex_keyname (str) – The name of the key pair
  • ex_userdata (str) – User data
  • ex_security_groups (list) – A list of names of security groups to assign to the node.
  • ex_metadata (dict) – Key/Value metadata to associate with a node
  • ex_mincount (int) – Minimum number of instances to launch
  • ex_maxcount (int) – Maximum number of instances to launch
  • ex_clienttoken (str) – Unique identifier to ensure idempotency
  • ex_blockdevicemappings (list of dict) – list of dict block device mappings.
  • ex_iamprofile (str) – Name or ARN of IAM profile
  • ex_ebs_optimized (bool) – EBS-Optimized if True
  • ex_subnet (EC2Subnet) – The subnet to launch the instance into.
create_volume(size, name, location=None, snapshot=None, ex_volume_type='standard', ex_iops=None)[source]
Parameters:
  • location (ExEC2AvailabilityZone) – Datacenter in which to create a volume in.
  • ex_volume_type (str) – Type of volume to create.
  • iops (int) – The number of I/O operations per second (IOPS) that the volume supports. Only used if ex_volume_type is io1.
create_volume_snapshot(volume, name=None)[source]

Create snapshot from volume

Parameters:
  • volume (StorageVolume) – Instance of StorageVolume
  • name (str) – Name of snapshot
Return type:

VolumeSnapshot

delete_image(image)[source]

Deletes an image at Amazon given a NodeImage object

@inherits: NodeDriver.delete_image

Parameters:image – Instance of NodeImage
Return type:bool
delete_key_pair(key_pair)[source]
destroy_node(node)[source]
destroy_volume(volume)[source]
destroy_volume_snapshot(snapshot)[source]
detach_volume(volume)[source]
ex_allocate_address(domain='standard')[source]

Allocate a new Elastic IP address for EC2 classic or VPC

Parameters:domain (str) – The domain to allocate the new address in (standard/vpc)
Returns:Instance of ElasticIP
Return type:ElasticIP
ex_associate_address_with_node(node, elastic_ip, domain=None)[source]

Associate an Elastic IP address with a particular node.

Parameters:
  • node (Node) – Node instance
  • elastic_ip (ElasticIP) – Elastic IP instance
  • domain (str) – The domain where the IP resides (vpc only)
Returns:

A string representation of the association ID which is required for VPC disassociation. EC2/standard addresses return None

Return type:

None or str

ex_associate_addresses(node, elastic_ip, domain=None)[source]

Note: This method has been deprecated in favor of the ex_associate_address_with_node method.

ex_associate_route_table(route_table, subnet)[source]

Associates a route table with a subnet within a VPC.

Note: A route table can be associated with multiple subnets.

Parameters:
  • route_table (EC2RouteTable) – The route table to associate.
  • subnet (EC2Subnet) – The subnet to associate with.
Returns:

Route table association ID.

Return type:

str

ex_attach_internet_gateway(gateway, network)[source]

Attach an Internet gateway to a VPC

Parameters:
  • gateway (VPCInternetGateway) – The gateway to attach
  • network (EC2Network) – The VPC network to attach to
Return type:

bool

ex_attach_network_interface_to_node(network_interface, node, device_index)[source]

Attach a network interface to an instance.

Parameters:
  • network_interface (EC2NetworkInterface) – EC2NetworkInterface instance
  • node (Node) – Node instance
  • device_index (int) – The interface device index
Returns:

String representation of the attachment id. This is required to detach the interface.

Return type:

str

ex_authorize_security_group(name, from_port, to_port, cidr_ip, protocol='tcp')[source]

Edit a Security Group to allow specific traffic.

@note: This is a non-standard extension API, and only works for EC2.

Parameters:
  • name (str) – The name of the security group to edit
  • from_port (str) – The beginning of the port range to open
  • to_port (str) – The end of the port range to open
  • cidr_ip (str) – The ip to allow traffic for.
  • protocol (str) – tcp/udp/icmp
Return type:

bool

ex_authorize_security_group_egress(id, from_port, to_port, cidr_ips, group_pairs=None, protocol='tcp')[source]

Edit a Security Group to allow specific egress traffic using CIDR blocks or either a group ID, group name or user ID (account). This call is not supported for EC2 classic and only works for VPC groups.

Parameters:
  • id (str) – The id of the security group to edit
  • from_port (int) – The beginning of the port range to open
  • to_port (int) – The end of the port range to open
  • cidr_ips (list) – The list of ip ranges to allow traffic for.
  • group_pairs (list of dict) –

    Source user/group pairs to allow traffic for. More info can be found at http://goo.gl/stBHJF

    EC2 Classic Example: To allow access from any system associated with the default group on account 1234567890

    [{‘group_name’: ‘default’, ‘user_id’: ‘1234567890’}]

    VPC Example: Allow access from any system associated with security group sg-47ad482e on your own account

    [{‘group_id’: ‘ sg-47ad482e’}]

  • protocol (str) – tcp/udp/icmp
Return type:

bool

ex_authorize_security_group_ingress(id, from_port, to_port, cidr_ips=None, group_pairs=None, protocol='tcp')[source]

Edit a Security Group to allow specific ingress traffic using CIDR blocks or either a group ID, group name or user ID (account).

Parameters:
  • id (str) – The id of the security group to edit
  • from_port (int) – The beginning of the port range to open
  • to_port (int) – The end of the port range to open
  • cidr_ips (list) – The list of ip ranges to allow traffic for.
  • group_pairs (list of dict) –

    Source user/group pairs to allow traffic for. More info can be found at http://goo.gl/stBHJF

    EC2 Classic Example: To allow access from any system associated with the default group on account 1234567890

    [{‘group_name’: ‘default’, ‘user_id’: ‘1234567890’}]

    VPC Example: Allow access from any system associated with security group sg-47ad482e on your own account

    [{‘group_id’: ‘ sg-47ad482e’}]

  • protocol (str) – tcp/udp/icmp
Return type:

bool

ex_authorize_security_group_permissive(name)[source]

Edit a Security Group to allow all traffic.

@note: This is a non-standard extension API, and only works for EC2.

Parameters:name (str) – The name of the security group to edit
Return type:list of str
ex_change_node_size(node, new_size)[source]

Change the node size. Note: Node must be turned of before changing the size.

Parameters:
  • node (Node) – Node instance
  • new_size (NodeSize) – NodeSize intance
Returns:

True on success, False otherwise.

Return type:

bool

ex_create_internet_gateway(name=None)[source]

Delete a VPC Internet gateway

Return type:bool
ex_create_keypair(name)[source]

Creates a new keypair

@note: This is a non-standard extension API, and only works for EC2.

Parameters:name (str) – The name of the keypair to Create. This must be unique, otherwise an InvalidKeyPair.Duplicate exception is raised.
Return type:dict
ex_create_network(cidr_block, name=None, instance_tenancy='default')[source]

Create a network/VPC

Parameters:
  • cidr_block (str) – The CIDR block assigned to the network
  • name (str) – An optional name for the network
  • instance_tenancy (str) – The allowed tenancy of instances launched into the VPC. Valid values: default/dedicated
Returns:

Dictionary of network properties

Return type:

dict

ex_create_network_interface(subnet, name=None, description=None, private_ip_address=None)[source]

Create a network interface within a VPC subnet.

Parameters:
  • subnet (EC2NetworkSubnet) – EC2NetworkSubnet instance
  • name (str) – Optional name of the interface
  • description (str) – Optional description of the network interface
  • private_ip_address (str) – Optional address to assign as the primary private IP address of the interface. If one is not provided then Amazon will automatically auto-assign an available IP. EC2 allows assignment of multiple IPs, but this will be the primary.
Returns:

EC2NetworkInterface instance

Return type:

:class EC2NetworkInterface

ex_create_route(route_table, cidr, internet_gateway=None, node=None, network_interface=None, vpc_peering_connection=None)[source]

Creates a route entry in the route table.

Parameters:
  • route_table (EC2RouteTable) – The route table to create the route in.
  • cidr (str) – The CIDR block used for the destination match.
  • internet_gateway (VPCInternetGateway) – The internet gateway to route traffic through.
  • node (Node) – The NAT instance to route traffic through.
  • network_interface (EC2NetworkInterface) – The network interface of the node to route traffic through.
  • vpc_peering_connection (VPCPeeringConnection) – The VPC peering connection.
Return type:

bool

Note: You must specify one of the following: internet_gateway,
node, network_interface, vpc_peering_connection.
ex_create_route_table(network, name=None)[source]

Create a route table within a VPC.

Parameters:vpc_id (EC2Network) – The VPC that the subnet should be created in.
Return type:
class:.EC2RouteTable
ex_create_security_group(name, description, vpc_id=None)[source]

Creates a new Security Group in EC2-Classic or a targeted VPC.

Parameters:
  • name (str) – The name of the security group to Create. This must be unique.
  • description (str) – Human readable description of a Security Group.
  • vpc_id (str) – Optional identifier for VPC networks
Return type:

dict

ex_create_subnet(vpc_id, cidr_block, availability_zone, name=None)[source]

Create a network subnet within a VPC

Parameters:
  • vpc_id (str) – The ID of the VPC that the subnet should be associated with
  • cidr_block (str) – The CIDR block assigned to the subnet
  • availability_zone (str) – The availability zone where the subnet should reside
  • name (str) – An optional name for the network
Return type:

class:EC2NetworkSubnet

ex_create_tags(resource, tags)[source]

Create tags for a resource (Node or StorageVolume).

Parameters:
  • resource (Node or StorageVolume) – Resource to be tagged
  • tags (dict) – A dictionary or other mapping of strings to strings, associating tag names with tag values.
Return type:

bool

ex_delete_internet_gateway(gateway)[source]

Delete a VPC Internet gateway

Parameters:gateway (VPCInternetGateway) – The gateway to delete
Return type:bool
ex_delete_keypair(keypair)[source]

Delete a key pair by name.

@note: This is a non-standard extension API, and only works with EC2.

Parameters:keypair (str) – The name of the keypair to delete.
Return type:bool
ex_delete_network(vpc)[source]

Deletes a network/VPC.

Parameters:vpc (EC2Network) – VPC to delete.
Return type:bool
ex_delete_network_interface(network_interface)[source]

Deletes a network interface.

Parameters:network_interface (EC2NetworkInterface) – EC2NetworkInterface instance
Return type:bool
ex_delete_route(route_table, cidr)[source]

Deletes a route entry from the route table.

Parameters:
  • route_table (EC2RouteTable) – The route table to delete the route from.
  • cidr (str) – The CIDR block used for the destination match.
Return type:

bool

ex_delete_route_table(route_table)[source]

Deletes a VPC route table.

Parameters:route_table (EC2RouteTable) – The route table to delete.
Return type:bool
ex_delete_security_group(name)[source]

Wrapper method which calls ex_delete_security_group_by_name.

Parameters:name (str) – The name of the security group
Return type:bool
ex_delete_security_group_by_id(group_id)[source]

Deletes a new Security Group using the group id.

Parameters:group_id (str) – The ID of the security group
Return type:bool
ex_delete_security_group_by_name(group_name)[source]

Deletes a new Security Group using the group name.

Parameters:group_name (str) – The name of the security group
Return type:bool
ex_delete_subnet(subnet)[source]

Deletes a VPC subnet.

Parameters:subnet (EC2NetworkSubnet) – The subnet to delete
Return type:bool
ex_delete_tags(resource, tags)[source]

Delete tags from a resource.

Parameters:
  • resource (Node or StorageVolume) – Resource to be tagged
  • tags (dict) – A dictionary or other mapping of strings to strings, specifying the tag names and tag values to be deleted.
Return type:

bool

ex_describe_addresses(nodes)[source]

Return Elastic IP addresses for all the nodes in the provided list.

Parameters:nodes (list of Node) – List of Node instances
Returns:Dictionary where a key is a node ID and the value is a list with the Elastic IP addresses associated with this node.
Return type:dict
ex_describe_addresses_for_node(node)[source]

Return a list of Elastic IP addresses associated with this node.

Parameters:node (Node) – Node instance
Returns:list Elastic IP addresses attached to this node.
Return type:list of str
ex_describe_all_addresses(only_associated=False)[source]

Return all the Elastic IP addresses for this account optionally, return only addresses associated with nodes

Parameters:only_associated (bool) – If true, return only those addresses that are associated with an instance.
Returns:List of ElasticIP instances.
Return type:list of ElasticIP
ex_describe_all_keypairs()[source]

Return names for all the available key pairs.

@note: This is a non-standard extension API, and only works for EC2.

Return type:list of str
ex_describe_keypair(name)[source]

Describes a keypair by name.

@note: This is a non-standard extension API, and only works for EC2.

Parameters:name (str) – The name of the keypair to describe.
Return type:dict
ex_describe_keypairs(name)[source]

Here for backward compatibility.

ex_describe_tags(resource)[source]

Return a dictionary of tags for a resource (Node or StorageVolume).

Parameters:resource (Node or StorageVolume) – resource which should be used
Returns:dict Node tags
Return type:dict
ex_detach_internet_gateway(gateway, network)[source]

Detach an Internet gateway from a VPC

Parameters:
  • gateway (VPCInternetGateway) – The gateway to detach
  • network (EC2Network) – The VPC network to detach from
Return type:

bool

ex_detach_network_interface(attachment_id, force=False)[source]

Detach a network interface from an instance.

Parameters:
  • attachment_id (str) – The attachment ID associated with the interface
  • force (bool) – Forces the detachment.
Returns:

True on successful detachment, False otherwise.

Return type:

bool

ex_disassociate_address(elastic_ip, domain=None)[source]

Disassociate an Elastic IP address using the IP (EC2-Classic) or the association ID (VPC)

Parameters:
  • elastic_ip (ElasticIP) – ElasticIP instance
  • domain (str) – The domain where the IP resides (vpc only)
Returns:

True on success, False otherwise.

Return type:

bool

ex_dissociate_route_table(subnet_association)[source]

Dissociates a subnet from a route table.

Parameters:subnet_association (EC2SubnetAssociation or str) – The subnet association object or subnet association ID.
Return type:bool
ex_find_or_import_keypair_by_key_material(pubkey)[source]

Given a public key, look it up in the EC2 KeyPair database. If it exists, return any information we have about it. Otherwise, create it.

Keys that are created are named based on their comment and fingerprint.

Return type:dict
ex_get_console_output(node)[source]

Get console output for the node.

Parameters:node (Node) – Node which should be used
Returns:Dictionary with the following keys: - instance_id (str) - timestamp (datetime.datetime) - ts of the last output - output (str) - console output
Return type:dict
ex_get_limits()[source]

Retrieve account resource limits.

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.
Rtype tags:dict
ex_get_security_groups(group_ids=None, group_names=None, filters=None)[source]

Return a list of EC2SecurityGroup objects for the current region.

Parameters:
  • group_ids (list) – Return only groups matching the provided group IDs.
  • group_names – Return only groups matching the provided group names.
  • filters (dict) – The filters so that the response includes information for only specific security groups.
Return type:

list of EC2SecurityGroup

ex_import_keypair(name, keyfile)[source]

imports a new public key where the public key is passed via a filename

@note: This is a non-standard extension API, and only works for EC2.

Parameters:
  • name (str) – The name of the public key to import. This must be unique, otherwise an InvalidKeyPair.Duplicate exception is raised.
  • keyfile (str) – The filename with path of the public key to import.
Return type:

dict

ex_import_keypair_from_string(name, key_material)[source]

imports a new public key where the public key is passed in as a string

@note: This is a non-standard extension API, and only works for EC2.

Parameters:
  • name (str) – The name of the public key to import. This must be unique, otherwise an InvalidKeyPair.Duplicate exception is raised.
  • key_material (str) – The contents of a public key file.
Return type:

dict

ex_list_availability_zones(only_available=True)[source]

Return a list of ExEC2AvailabilityZone objects for the current region.

Note: This is an extension method and is only available for EC2 driver.

Parameters:only_available (str) – If true, return only availability zones with state ‘available’
Return type:list of ExEC2AvailabilityZone
ex_list_internet_gateways(gateway_ids=None, filters=None)[source]

Describes available Internet gateways and whether or not they are attached to a VPC. These are required for VPC nodes to communicate over the Internet.

Parameters:
  • gateway_ids (list) – Return only intenet gateways matching the provided internet gateway IDs. If not specified, a list of all the internet gateways in the corresponding region is returned.
  • filters (dict) – The filters so that the response includes information for only certain gateways.
Return type:

list of VPCInternetGateway

ex_list_keypairs()[source]

Lists all the keypair names and fingerprints.

Return type:list of dict
ex_list_network_interfaces()[source]

Return all network interfaces

Returns:List of EC2NetworkInterface instances
Return type:list of :class EC2NetworkInterface
ex_list_networks(network_ids=None, filters=None)[source]

Return a list of EC2Network objects for the current region.

Parameters:
  • network_ids (list) – Return only networks matching the provided network IDs. If not specified, a list of all the networks in the corresponding region is returned.
  • filters (dict) – The filters so that the response includes information for only certain networks.
Return type:

list of EC2Network

ex_list_reserved_nodes()[source]

List all reserved instances/nodes which can be purchased from Amazon for one or three year terms. Reservations are made at a region level and reduce the hourly charge for instances.

More information can be found at http://goo.gl/ulXCC7.

Return type:list of EC2ReservedNode
ex_list_route_tables(route_table_ids=None, filters=None)[source]

Describes one or more of a VPC’s route tables. These are used to determine where network traffic is directed.

Parameters:
  • route_table_ids (list) – Return only route tables matching the provided route table IDs. If not specified, a list of all the route tables in the corresponding region is returned.
  • filters (dict) – The filters so that the response includes information for only certain route tables.
Return type:

list of EC2RouteTable

ex_list_security_groups()[source]

List existing Security Groups.

@note: This is a non-standard extension API, and only works for EC2.

Return type:list of str
ex_list_subnets(subnet_ids=None, filters=None)[source]

Return a list of EC2NetworkSubnet objects for the current region.

Parameters:
  • subnet_ids (list) – Return only subnets matching the provided subnet IDs. If not specified, a list of all the subnets in the corresponding region is returned.
  • filters (dict) – The filters so that the response includes information for only certain subnets.
Return type:

list of EC2NetworkSubnet

ex_modify_image_attribute(image, attributes)[source]

Modify image attributes.

Parameters:
  • image (NodeImage) – NodeImage instance
  • attributes (dict) – Dictionary with node attributes
Returns:

True on success, False otherwise.

Return type:

bool

ex_modify_instance_attribute(node, attributes)[source]

Modify node attributes. A list of valid attributes can be found at http://goo.gl/gxcj8

Parameters:
  • node (Node) – Node instance
  • attributes (dict) – Dictionary with node attributes
Returns:

True on success, False otherwise.

Return type:

bool

ex_register_image(name, description=None, architecture=None, image_location=None, root_device_name=None, block_device_mapping=None, kernel_id=None, ramdisk_id=None, virtualization_type=None)[source]

Registers an Amazon Machine Image based off of an EBS-backed instance. Can also be used to create images from snapshots. More information can be found at http://goo.gl/hqZq0a.

Parameters:
  • name (str) – The name for the AMI being registered
  • description (str) – The description of the AMI (optional)
  • architecture (str) – The architecture of the AMI (i386/x86_64) (optional)
  • image_location (str) – The location of the AMI within Amazon S3 Required if registering an instance store-backed AMI
  • root_device_name (str) – The device name for the root device Required if registering an EBS-backed AMI
  • block_device_mapping (dict) – A dictionary of the disk layout (optional)
  • kernel_id (str) – Kernel id for AMI (optional)
  • ramdisk_id (str) – RAM disk for AMI (optional)
  • virtualization_type (str) – The type of virtualization for the AMI you are registering, paravirt or hvm (optional)
Return type:

NodeImage

ex_release_address(elastic_ip, domain=None)[source]

Release an Elastic IP address using the IP (EC2-Classic) or using the allocation ID (VPC)

Parameters:
  • elastic_ip (ElasticIP) – Elastic IP instance
  • domain (str) – The domain where the IP resides (vpc only)
Returns:

True on success, False otherwise.

Return type:

bool

ex_replace_route(route_table, cidr, internet_gateway=None, node=None, network_interface=None, vpc_peering_connection=None)[source]

Replaces an existing route entry within a route table in a VPC.

Parameters:
  • route_table (EC2RouteTable) – The route table to replace the route in.
  • cidr (str) – The CIDR block used for the destination match.
  • internet_gateway (VPCInternetGateway) – The new internet gateway to route traffic through.
  • node (Node) – The new NAT instance to route traffic through.
  • network_interface (EC2NetworkInterface) – The new network interface of the node to route traffic through.
  • vpc_peering_connection (VPCPeeringConnection) – The new VPC peering connection.
Return type:

bool

Note: You must specify one of the following: internet_gateway,
node, network_interface, vpc_peering_connection.
ex_replace_route_table_association(subnet_association, route_table)[source]

Changes the route table associated with a given subnet in a VPC.

Note: This method can be used to change which table is the main route
table in the VPC (Specify the main route table’s association ID and the route table to be the new main route table).
Parameters:
  • subnet_association (EC2SubnetAssociation or str) – The subnet association object or subnet association ID.
  • route_table (EC2RouteTable) – The new route table to associate.
Returns:

New route table association ID.

Return type:

str

ex_revoke_security_group_egress(id, from_port, to_port, cidr_ips=None, group_pairs=None, protocol='tcp')[source]

Edit a Security Group to revoke specific egress traffic using CIDR blocks or either a group ID, group name or user ID (account). This call is not supported for EC2 classic and only works for VPC groups.

Parameters:
  • id (str) – The id of the security group to edit
  • from_port (int) – The beginning of the port range to open
  • to_port (int) – The end of the port range to open
  • cidr_ips (list) – The list of ip ranges to allow traffic for.
  • group_pairs (list of dict) –

    Source user/group pairs to allow traffic for. More info can be found at http://goo.gl/stBHJF

    EC2 Classic Example: To allow access from any system associated with the default group on account 1234567890

    [{‘group_name’: ‘default’, ‘user_id’: ‘1234567890’}]

    VPC Example: Allow access from any system associated with security group sg-47ad482e on your own account

    [{‘group_id’: ‘ sg-47ad482e’}]

  • protocol (str) – tcp/udp/icmp
Return type:

bool

ex_revoke_security_group_ingress(id, from_port, to_port, cidr_ips=None, group_pairs=None, protocol='tcp')[source]

Edit a Security Group to revoke specific ingress traffic using CIDR blocks or either a group ID, group name or user ID (account).

Parameters:
  • id (str) – The id of the security group to edit
  • from_port (int) – The beginning of the port range to open
  • to_port (int) – The end of the port range to open
  • cidr_ips (list) – The list of ip ranges to allow traffic for.
  • group_pairs (list of dict) –

    Source user/group pairs to allow traffic for. More info can be found at http://goo.gl/stBHJF

    EC2 Classic Example: To allow access from any system associated with the default group on account 1234567890

    [{‘group_name’: ‘default’, ‘user_id’: ‘1234567890’}]

    VPC Example: Allow access from any system associated with security group sg-47ad482e on your own account

    [{‘group_id’: ‘ sg-47ad482e’}]

  • protocol (str) – tcp/udp/icmp
Return type:

bool

ex_start_node(node)[source]

Start the node by passing in the node object, does not work with instance store backed instances

Parameters:node (Node) – Node which should be used
Return type:bool
ex_stop_node(node)[source]

Stop the node by passing in the node object, does not work with instance store backed instances

Parameters:node (Node) – Node which should be used
Return type:bool
features = {'create_node': ['ssh_key']}
get_image(image_id)[source]

Get an image based on an image_id

Parameters:image_id (str) – Image identifier
Returns:A NodeImage object
Return type:NodeImage
get_key_pair(name)[source]
import_key_pair_from_string(name, key_material)[source]
list_images(location=None, ex_image_ids=None, ex_owner=None, ex_executableby=None)[source]

List all images @inherits: NodeDriver.list_images

Ex_image_ids parameter is used to filter the list of images that should be returned. Only the images with the corresponding image ids will be returned.

Ex_owner parameter is used to filter the list of images that should be returned. Only the images with the corresponding owner will be returned. Valid values: amazon|aws-marketplace|self|all|aws id

Ex_executableby parameter describes images for which the specified user has explicit launch permissions. The user can be an AWS account ID, self to return images for which the sender of the request has explicit launch permissions, or all to return images with public launch permissions. Valid values: all|self|aws id

Parameters:
  • ex_image_ids (list of str) – List of NodeImage.id
  • ex_owner (str) – Owner name
  • ex_executableby (str) – Executable by
Return type:

list of NodeImage

list_key_pairs()[source]
list_locations()[source]
list_nodes(ex_node_ids=None, ex_filters=None)[source]

List all nodes

Ex_node_ids parameter is used to filter the list of nodes that should be returned. Only the nodes with the corresponding node ids will be returned.

Parameters:
  • ex_node_ids (list of str) – List of node.id
  • ex_filters (dict) – The filters so that the response includes information for only certain nodes.
Return type:

list of Node

list_sizes(location=None)[source]
list_snapshots(snapshot=None, owner=None)[source]

Describe all snapshots.

Parameters:
  • snapshot – If provided, only return snapshot information for the provided snapshot.
  • owner (str) – Owner for snapshot: self|amazon|ID
Return type:

list of VolumeSnapshot

list_volume_snapshots(snapshot)[source]
list_volumes(node=None)[source]
path = '/'
reboot_node(node)[source]
class libcloud.compute.drivers.ec2.NimbusNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.drivers.ec2.BaseEC2NodeDriver

Driver class for Nimbus

api_name = 'nimbus'
connectionCls

alias of NimbusConnection

country = 'Private'
ex_create_tags(resource, tags)[source]

Nimbus doesn’t support creating tags, so this is a pass-through.

@inherits: EC2NodeDriver.ex_create_tags

ex_describe_addresses(nodes)[source]

Nimbus doesn’t support elastic IPs, so this is a pass-through.

@inherits: EC2NodeDriver.ex_describe_addresses

friendly_name = 'Nimbus Private Cloud'
name = 'Nimbus'
region_name = 'nimbus'
type = 'nimbus'
website = 'http://www.nimbusproject.org/'
class libcloud.compute.drivers.ec2.EucNodeDriver(key, secret=None, secure=True, host=None, path=None, port=None, api_version='3.3.0')[source]

Bases: libcloud.compute.drivers.ec2.BaseEC2NodeDriver

Driver class for Eucalyptus

@inherits: EC2NodeDriver.__init__

Parameters:
  • path (str) – The host where the API can be reached.
  • api_version (str) – The API version to extend support for Eucalyptus proprietary API calls
api_name = 'ec2_us_east'
connectionCls

alias of EucConnection

list_locations()[source]
list_sizes()[source]

List available instance flavors/sizes

Return type:list of NodeSize
name = 'Eucalyptus'
region_name = 'us-east-1'
website = 'http://www.eucalyptus.com/'
class libcloud.compute.drivers.ec2.OutscaleSASNodeDriver(key, secret=None, secure=True, host=None, port=None, region='us-east-1', region_details=None, **kwargs)[source]

Bases: libcloud.compute.drivers.ec2.OutscaleNodeDriver

Outscale SAS node driver

name = 'Outscale SAS'
type = 'outscale_sas'
class libcloud.compute.drivers.ec2.OutscaleINCNodeDriver(key, secret=None, secure=True, host=None, port=None, region='us-east-1', region_details=None, **kwargs)[source]

Bases: libcloud.compute.drivers.ec2.OutscaleNodeDriver

Outscale INC node driver

name = 'Outscale INC'
type = 'outscale_inc'
class libcloud.compute.drivers.ec2.EC2NodeLocation(id, name, country, driver, availability_zone)[source]

Bases: libcloud.compute.base.NodeLocation

class libcloud.compute.drivers.ec2.EC2ReservedNode(id, state, driver, size=None, image=None, extra=None)[source]

Bases: libcloud.compute.base.Node

Class which stores information about EC2 reserved instances/nodes Inherits from Node and passes in None for name and private/public IPs

Note: This class is EC2 specific.

class libcloud.compute.drivers.ec2.EC2SecurityGroup(id, name, ingress_rules, egress_rules, extra=None)[source]

Bases: object

Represents information about a Security group

Note: This class is EC2 specific.

class libcloud.compute.drivers.ec2.EC2Network(id, name, cidr_block, extra=None)[source]

Bases: object

Represents information about a VPC (Virtual Private Cloud) network

Note: This class is EC2 specific.

class libcloud.compute.drivers.ec2.EC2NetworkSubnet(id, name, state, extra=None)[source]

Bases: object

Represents information about a VPC (Virtual Private Cloud) subnet

Note: This class is EC2 specific.

class libcloud.compute.drivers.ec2.EC2NetworkInterface(id, name, state, extra=None)[source]

Bases: object

Represents information about a VPC network interface

Note: This class is EC2 specific. The state parameter denotes the current status of the interface. Valid values for state are attaching, attached, detaching and detached.

class libcloud.compute.drivers.ec2.EC2RouteTable(id, name, routes, subnet_associations, propagating_gateway_ids, extra=None)[source]

Bases: object

Class which stores information about VPC Route Tables.

Note: This class is VPC specific.

Parameters:
  • id (str) – The ID of the route table.
  • name (str) – The name of the route table.
  • routes (list of EC2Route) – A list of routes in the route table.
  • subnet_associations (list of EC2SubnetAssociation) – A list of associations between the route table and one or more subnets.
  • propagating_gateway_ids (list) – The list of IDs of any virtual private gateways propagating the routes.
class libcloud.compute.drivers.ec2.EC2Route(cidr, gateway_id, instance_id, owner_id, interface_id, state, origin, vpc_peering_connection_id)[source]

Bases: object

Class which stores information about a Route.

Note: This class is VPC specific.

Parameters:
  • cidr (str) – The CIDR block used for the destination match.
  • gateway_id (str) – The ID of a gateway attached to the VPC.
  • instance_id (str) – The ID of a NAT instance in the VPC.
  • owner_id (str) – The AWS account ID of the owner of the instance.
  • interface_id (str) – The ID of the network interface.
  • state (str) – The state of the route (active | blackhole).
  • origin (str) – Describes how the route was created.
  • vpc_peering_connection_id (str) – The ID of the VPC peering connection.
class libcloud.compute.drivers.ec2.EC2SubnetAssociation(id, route_table_id, subnet_id, main=False)[source]

Bases: object

Class which stores information about Route Table associated with a given Subnet in a VPC

Note: This class is VPC specific.

Parameters:
  • id (str) – The ID of the subent association in the VPC.
  • route_table_id (str) – The ID of a route table in the VPC.
  • subnet_id (str) – The ID of a subnet in the VPC.
  • main (bool) – If true, means this is a main VPC route table.
class libcloud.compute.drivers.ec2.ExEC2AvailabilityZone(name, zone_state, region_name)[source]

Bases: object

Extension class which stores information about an EC2 availability zone.

Note: This class is EC2 specific.

exception libcloud.compute.drivers.ec2.IdempotentParamError(value, driver=None)[source]

Bases: libcloud.common.types.LibcloudError

Request used the same client token as a previous, but non-identical request.

libcloud.compute.drivers.ecp module

Enomaly ECP driver

class libcloud.compute.drivers.ecp.ECPConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Connection class for the Enomaly ECP driver

add_default_headers(headers)[source]
host = ''
port = (80, 443)
responseCls

alias of ECPResponse

class libcloud.compute.drivers.ecp.ECPNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Enomaly ECP node driver

connectionCls

alias of ECPConnection

create_node(**kwargs)[source]

Creates a virtual machine.

Parameters:
  • name (str) – String with a name for this new node (required)
  • size (NodeSize) – The size of resources allocated to this node . (required)
  • image (NodeImage) – OS Image to boot on node. (required)
Return type:

Node

destroy_node(node)[source]

Shuts down and deletes a VM.

@inherits: NodeDriver.destroy_node

list_images(location=None)[source]

Returns a list of all package templates aka appiances aka images.

@inherits: NodeDriver.list_images

list_locations()[source]

This feature does not exist in ECP. Returns hard coded dummy location.

Return type:list of NodeLocation
list_nodes()[source]

Returns a list of all running Nodes

Return type:list of Node
list_sizes(location=None)[source]

Returns a list of all hardware templates

@inherits: NodeDriver.list_sizes

name = 'Enomaly Elastic Computing Platform'
reboot_node(node)[source]

Shuts down a VM and then starts it again.

@inherits: NodeDriver.reboot_node

type = 'ecp'
website = 'http://www.enomaly.com/'
class libcloud.compute.drivers.ecp.ECPResponse(response, connection)[source]

Bases: libcloud.common.base.Response

Parameters:
getheaders()[source]
parse_body()[source]
parse_error()[source]
success()[source]

libcloud.compute.drivers.elastichosts module

ElasticHosts Driver

class libcloud.compute.drivers.elastichosts.ElasticHostsAU1NodeDriver(key, secret=None, secure=True, host=None, port=None, region='sat-p', **kwargs)[source]

Bases: libcloud.compute.drivers.elastichosts.ElasticHostsNodeDriver

ElasticHosts node driver for the Sydney end-point

name = 'ElasticHosts (syd-y)'
class libcloud.compute.drivers.elastichosts.ElasticHostsCA1NodeDriver(key, secret=None, secure=True, host=None, port=None, region='sat-p', **kwargs)[source]

Bases: libcloud.compute.drivers.elastichosts.ElasticHostsNodeDriver

ElasticHosts node driver for the Toronto Peer 1 end-point

name = 'ElasticHosts (tor-p)'
class libcloud.compute.drivers.elastichosts.ElasticHostsCN1NodeDriver(key, secret=None, secure=True, host=None, port=None, region='sat-p', **kwargs)[source]

Bases: libcloud.compute.drivers.elastichosts.ElasticHostsNodeDriver

ElasticHosts node driver for the Hong Kong end-point

name = 'ElasticHosts (cn-1)'
exception libcloud.compute.drivers.elastichosts.ElasticHostsException[source]

Bases: exceptions.Exception

class libcloud.compute.drivers.elastichosts.ElasticHostsNodeDriver(key, secret=None, secure=True, host=None, port=None, region='sat-p', **kwargs)[source]

Bases: libcloud.compute.drivers.elasticstack.ElasticStackBaseNodeDriver

Node Driver class for ElasticHosts

api_name = 'elastichosts'
features = {'create_node': ['generates_password']}
name = 'ElasticHosts'
type = 'elastichosts'
website = 'http://www.elastichosts.com/'
class libcloud.compute.drivers.elastichosts.ElasticHostsUK1NodeDriver(key, secret=None, secure=True, host=None, port=None, region='sat-p', **kwargs)[source]

Bases: libcloud.compute.drivers.elastichosts.ElasticHostsNodeDriver

ElasticHosts node driver for the London Peer 1 end-point

name = 'ElasticHosts (lon-p)'
class libcloud.compute.drivers.elastichosts.ElasticHostsUK2NodeDriver(key, secret=None, secure=True, host=None, port=None, region='sat-p', **kwargs)[source]

Bases: libcloud.compute.drivers.elastichosts.ElasticHostsNodeDriver

ElasticHosts node driver for the London Bluesquare end-point

name = 'ElasticHosts (lon-b)'
class libcloud.compute.drivers.elastichosts.ElasticHostsUS1NodeDriver(key, secret=None, secure=True, host=None, port=None, region='sat-p', **kwargs)[source]

Bases: libcloud.compute.drivers.elastichosts.ElasticHostsNodeDriver

ElasticHosts node driver for the San Antonio Peer 1 end-point

name = 'ElasticHosts (sat-p)'
class libcloud.compute.drivers.elastichosts.ElasticHostsUS2NodeDriver(key, secret=None, secure=True, host=None, port=None, region='sat-p', **kwargs)[source]

Bases: libcloud.compute.drivers.elastichosts.ElasticHostsNodeDriver

ElasticHosts node driver for the Los Angeles Peer 1 end-point

name = 'ElasticHosts (lax-p)'
class libcloud.compute.drivers.elastichosts.ElasticHostsUS3NodeDriver(key, secret=None, secure=True, host=None, port=None, region='sat-p', **kwargs)[source]

Bases: libcloud.compute.drivers.elastichosts.ElasticHostsNodeDriver

ElasticHosts node driver for the San Jose (Silicon Valley) end-point

name = 'ElasticHosts (sjc-c)'

libcloud.compute.drivers.elasticstack module

Base driver for the providers based on the ElasticStack platform - http://www.elasticstack.com.

class libcloud.compute.drivers.elasticstack.ElasticStackBaseConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Base connection class for the ElasticStack driver

add_default_headers(headers)[source]
host = None
responseCls

alias of ElasticStackResponse

class libcloud.compute.drivers.elasticstack.ElasticStackBaseNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

connectionCls

alias of ElasticStackBaseConnection

create_node(**kwargs)[source]

Creates an ElasticStack instance

@inherits: NodeDriver.create_node

Parameters:
  • name (str) – String with a name for this new node (required)
  • smp (int) – Number of virtual processors or None to calculate based on the cpu speed
  • nic_model (str) – e1000, rtl8139 or virtio (if not specified, e1000 is used)
  • vnc_password (str) – If set, the same password is also used for SSH access with user toor, otherwise VNC access is disabled and no SSH login is possible.
deploy_node(**kwargs)[source]

Create a new node, and start deployment.

@inherits: NodeDriver.deploy_node

Parameters:enable_root (bool) – If true, root password will be set to vnc_password (this will enable SSH access) and default ‘toor’ account will be deleted.
destroy_node(node)[source]
ex_destroy_drive(drive_uuid)[source]

Deletes a drive

Parameters:drive_uuid (str) – Drive uuid which should be used
Return type:bool
ex_set_node_configuration(node, **kwargs)[source]

Changes the configuration of the running server

Parameters:
  • node (Node) – Node which should be used
  • kwargs (dict) – keyword arguments
Return type:

bool

ex_shutdown_node(node)[source]

Sends the ACPI power-down event

Parameters:node (Node) – Node which should be used
Return type:bool
features = {'create_node': ['generates_password']}
list_images(location=None)[source]
list_nodes()[source]
list_sizes(location=None)[source]
reboot_node(node)[source]
website = 'http://www.elasticstack.com'
exception libcloud.compute.drivers.elasticstack.ElasticStackException[source]

Bases: exceptions.Exception

class libcloud.compute.drivers.elasticstack.ElasticStackNodeSize(id, name, cpu, ram, disk, bandwidth, price, driver)[source]

Bases: libcloud.compute.base.NodeSize

class libcloud.compute.drivers.elasticstack.ElasticStackResponse(response, connection)[source]

Bases: libcloud.common.base.JsonResponse

Parameters:
parse_error()[source]
success()[source]

libcloud.compute.drivers.exoscale module

class libcloud.compute.drivers.exoscale.ExoscaleNodeDriver(key, secret=None, secure=True, host=None, path=None, port=None, url=None, *args, **kwargs)[source]

Bases: libcloud.compute.drivers.cloudstack.CloudStackNodeDriver

Inherits:

NodeDriver.__init__

Parameters:
  • host (str) – The host where the API can be reached. (required)
  • path (str) – The path where the API can be reached. (required)
  • url (str) – Full URL to the API endpoint. Mutually exclusive with host and path argument.
host = 'api.exoscale.ch'
name = 'Exoscale'
path = '/compute'
type = 'exoscale'
website = 'https://www.exoscale.ch/'

libcloud.compute.drivers.gandi module

Gandi driver for compute

class libcloud.compute.drivers.gandi.GandiNodeDriver(*args, **kwargs)[source]

Bases: libcloud.common.gandi.BaseGandiDriver, libcloud.compute.base.NodeDriver

Gandi node driver

@inherits: NodeDriver.__init__

api_name = 'gandi'
attach_volume(node, volume, device=None)[source]
country = 'FR'
create_node(**kwargs)[source]

Create a new Gandi node

Parameters:
  • name (str) – String with a name for this new node (required)
  • image (NodeImage) – OS Image to boot on node. (required)
  • location (NodeLocation) – Which data center to create a node in. If empty, undefined behavior will be selected. (optional)
  • size (NodeSize) – The size of resources allocated to this node. (required)
  • login (str) – user name to create for login on machine (required)
  • password (str) – password for user that’ll be created (required)
  • inet_family (int) – version of ip to use, default 4 (optional)
Return type:

Node

create_volume(size, name, location=None, snapshot=None)[source]
deploy_node(**kwargs)[source]

deploy_node is not implemented for gandi driver

Return type:bool
destroy_node(node)[source]
destroy_volume(volume)[source]
detach_volume(node, volume)[source]

Detaches a volume from a node.

Parameters:
  • node (Node) – Node which should be used
  • volume (StorageVolume) – Volume to be detached
Return type:

bool

ex_list_disks()[source]

Specific method to list all disk

Return type:list of GandiDisk
ex_list_interfaces()[source]

Specific method to list network interfaces

Return type:list of GandiNetworkInterface
ex_node_attach_disk(node, disk)[source]

Specific method to attach a disk to a node

Parameters:
  • node (Node) – Node which should be used
  • disk (GandiDisk) – Disk which should be used
Return type:

bool

ex_node_attach_interface(node, iface)[source]

Specific method to attach an interface to a node

Parameters:
  • node (Node) – Node which should be used
  • iface (GandiNetworkInterface) – Network interface which should be used
Return type:

bool

ex_node_detach_disk(node, disk)[source]

Specific method to detach a disk from a node

Parameters:
  • node (Node) – Node which should be used
  • disk (GandiDisk) – Disk which should be used
Return type:

bool

ex_node_detach_interface(node, iface)[source]

Specific method to detach an interface from a node

Parameters:
  • node (Node) – Node which should be used
  • iface (GandiNetworkInterface) – Network interface which should be used
Return type:

bool

ex_snapshot_disk(disk, name=None)[source]

Specific method to make a snapshot of a disk

Parameters:
  • disk (GandiDisk) – Disk which should be used
  • name (str) – Name which should be used
Return type:

bool

ex_update_disk(disk, new_size=None, new_name=None)[source]

Specific method to update size or name of a disk WARNING: if a server is attached it’ll be rebooted

Parameters:
  • disk (GandiDisk) – Disk which should be used
  • new_size (int) – New size
  • new_name (str) – New name
Return type:

bool

features = {}
friendly_name = 'Gandi.net'
list_images(location=None)[source]
list_instance_type(location=None)[source]
list_locations()[source]
list_nodes()[source]
list_sizes(location=None)[source]
list_volumes()[source]
Return type:list of StorageVolume
reboot_node(node)[source]
type = 'gandi'
website = 'http://www.gandi.net/'

libcloud.compute.drivers.gce module

Module for Google Compute Engine Driver.

class libcloud.compute.drivers.gce.GCEAddress(id, name, address, region, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE Static address.

destroy()[source]

Destroy this address.

Returns:True if successful
Return type:bool
class libcloud.compute.drivers.gce.GCEConnection(user_id, key, secure, auth_type=None, credential_file=None, project=None, **kwargs)[source]

Bases: libcloud.common.google.GoogleBaseConnection

Connection class for the GCE driver.

host = 'www.googleapis.com'
responseCls

alias of GCEResponse

class libcloud.compute.drivers.gce.GCEFailedDisk(name, error, code)[source]

Bases: object

Dummy Node object for disks that are not created.

class libcloud.compute.drivers.gce.GCEFailedNode(name, error, code)[source]

Bases: object

Dummy Node object for nodes that are not created.

class libcloud.compute.drivers.gce.GCEFirewall(id, name, allowed, network, source_ranges, source_tags, target_tags, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE Firewall rule class.

destroy()[source]

Destroy this firewall.

Returns:True if successful
Return type:bool
update()[source]

Commit updated firewall values.

Returns:Updated Firewall object
Return type:GCEFirewall
class libcloud.compute.drivers.gce.GCEForwardingRule(id, name, region, address, protocol, targetpool, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

destroy()[source]

Destroy this Forwarding Rule

Returns:True if successful
Return type:bool
class libcloud.compute.drivers.gce.GCEHealthCheck(id, name, path, port, interval, timeout, unhealthy_threshold, healthy_threshold, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE Http Health Check class.

destroy()[source]

Destroy this Health Check.

Returns:True if successful
Return type:bool
update()[source]

Commit updated healthcheck values.

Returns:Updated Healthcheck object
Return type:GCEHealthcheck
class libcloud.compute.drivers.gce.GCENetwork(id, name, cidr, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE Network object class.

destroy()[source]

Destroy this network

Returns:True if successful
Return type:bool
class libcloud.compute.drivers.gce.GCENodeDriver(user_id, key=None, datacenter=None, project=None, auth_type=None, scopes=None, credential_file=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

GCE Node Driver class.

This is the primary driver for interacting with Google Compute Engine. It contains all of the standard libcloud methods, plus additional ex_* methods for more features.

Note that many methods allow either objects or strings (or lists of objects/strings). In most cases, passing strings instead of objects will result in additional GCE API calls.

Parameters:
  • user_id (str) – The email address (for service accounts) or Client ID (for installed apps) to be used for authentication.
  • key (str) – The RSA Key (for service accounts) or file path containing key or Client Secret (for installed apps) to be used for authentication.
  • datacenter (str) – The name of the datacenter (zone) used for operations.
  • project (str) – Your GCE project name. (required)
  • auth_type (str) – Accepted values are “SA” or “IA” or “GCE” (“Service Account” or “Installed Application” or “GCE” if libcloud is being used on a GCE instance with service account enabled). If not supplied, auth_type will be guessed based on value of user_id or if the code is being executed in a GCE instance.
  • scopes (list) – List of authorization URLs. Default is empty and grants read/write to Compute, Storage, DNS.
  • credential_file (str) – Path to file for caching authentication information used by GCEConnection.
AUTH_URL = 'https://www.googleapis.com/auth/'
NODE_STATE_MAP = {'TERMINATED': 2, 'STAGING': 3, 'PROVISIONING': 3, 'RUNNING': 0, 'STOPPED': 2, 'STOPPING': 2}
SA_SCOPES_MAP = {'storage-ro': 'devstorage.read_only', 'bigquery': 'bigquery', 'sql-admin': 'sqlservice.admin', 'sql': 'sqlservice', 'datastore': 'datastore', 'storage-rw': 'devstorage.read_write', 'compute-rw': 'compute', 'userinfo-email': 'userinfo.email', 'taskqueue': 'taskqueue', 'compute-ro': 'compute.readonly', 'storage-full': 'devstorage.full_control'}
api_name = 'googleapis'
attach_volume(node, volume, device=None, ex_mode=None, ex_boot=False)[source]

Attach a volume to a node.

If volume is None, a scratch disk will be created and attached.

Parameters:
  • node (Node) – The node to attach the volume to
  • volume (StorageVolume or None) – The volume to attach. If none, a scratch disk will be attached.
  • device (str) – The device name to attach the volume as. Defaults to volume name.
  • ex_mode (str) – Either ‘READ_WRITE’ or ‘READ_ONLY’
  • ex_boot (bool) – If true, disk will be attached as a boot disk
Returns:

True if successful

Return type:

bool

connectionCls

alias of GCEConnection

create_node(name, size, image, location=None, ex_network='default', ex_tags=None, ex_metadata=None, ex_boot_disk=None, use_existing_disk=True, external_ip='ephemeral', ex_disk_type='pd-standard', ex_disk_auto_delete=True, ex_service_accounts=None)[source]

Create a new node and return a node object for the node.

Parameters:
  • name (str) – The name of the node to create.
  • size (str or GCENodeSize) – The machine type to use.
  • image (str or GCENodeImage) – The image to use to create the node (or, if attaching a persistent disk, the image used to create the disk)
  • location (str or NodeLocation or GCEZone or None) – The location (zone) to create the node in.
  • ex_network (str or GCENetwork) – The network to associate with the node.
  • ex_tags (list of str or None) – A list of tags to associate with the node.
  • ex_metadata (dict or None) – Metadata dictionary for instance.
  • ex_boot_disk (StorageVolume or str) – The boot disk to attach to the instance.
  • use_existing_disk (bool) – If True and if an existing disk with the same name/location is found, use that disk instead of creating a new one.
  • external_ip (GCEAddress or str or None) – The external IP address to use. If ‘ephemeral’ (default), a new non-static address will be used. If ‘None’, then no external address will be used. To use an existing static IP address, a GCEAddress object should be passed in.
  • ex_disk_type (str) – Specify a pd-standard (default) disk or pd-ssd for an SSD disk.
  • ex_disk_auto_delete (bool) – Indicate that the boot disk should be deleted when the Node is deleted. Set to True by default.
  • ex_service_accounts (list) –

    Specify a list of serviceAccounts when creating the instance. The format is a list of dictionaries containing email and list of scopes, e.g. [{‘email’:’default’,

    ‘scopes’:[‘compute’, ...]}, ...]

    Scopes can either be full URLs or short names. If not provided, use the ‘default’ service account email and a scope of ‘devstorage.read_only’. Also accepts the aliases defined in ‘gcloud compute’.

Returns:

A Node object for the new node.

Return type:

Node

create_volume(size, name, location=None, snapshot=None, image=None, use_existing=True, ex_disk_type='pd-standard')[source]

Create a volume (disk).

Parameters:
  • size (int or str or None) – Size of volume to create (in GB). Can be None if image or snapshot is supplied.
  • name (str) – Name of volume to create
  • location (str or GCEZone or NodeLocation or None) – Location (zone) to create the volume in
  • snapshot (GCESnapshot or str or None) – Snapshot to create image from
  • image (GCENodeImage or str or None) – Image to create disk from.
  • use_existing (bool) – If True and a disk with the given name already exists, return an object for that disk instead of attempting to create a new disk.
  • ex_disk_type (str) – Specify a pd-standard (default) disk or pd-ssd for an SSD disk.
Returns:

Storage Volume object

Return type:

StorageVolume

create_volume_snapshot(volume, name)[source]

Create a snapshot of the provided Volume.

Parameters:volume (StorageVolume) – A StorageVolume object
Returns:A GCE Snapshot object
Return type:GCESnapshot
deploy_node(name, size, image, script, location=None, ex_network='default', ex_tags=None, ex_service_accounts=None)[source]

Create a new node and run a script on start-up.

Parameters:
  • name (str) – The name of the node to create.
  • size (str or GCENodeSize) – The machine type to use.
  • image (str or GCENodeImage) – The image to use to create the node.
  • script (str) – File path to start-up script
  • location (str or NodeLocation or GCEZone or None) – The location (zone) to create the node in.
  • ex_network (str or GCENetwork) – The network to associate with the node.
  • ex_tags (list of str or None) – A list of tags to associate with the node.
  • ex_service_accounts (list) –

    Specify a list of serviceAccounts when creating the instance. The format is a list of dictionaries containing email and list of scopes, e.g. [{‘email’:’default’,

    ‘scopes’:[‘compute’, ...]}, ...]

    Scopes can either be full URLs or short names. If not provided, use the ‘default’ service account email and a scope of ‘devstorage.read_only’. Also accepts the aliases defined in ‘gcloud compute’.

Returns:

A Node object for the new node.

Return type:

Node

destroy_node(node, destroy_boot_disk=False)[source]

Destroy a node.

Parameters:
  • node (Node) – Node object to destroy
  • destroy_boot_disk (bool) – If true, also destroy the node’s boot disk. (Note that this keyword is not accessible from the node’s .destroy() method.)
Returns:

True if successful

Return type:

bool

destroy_volume(volume)[source]

Destroy a volume.

Parameters:volume (StorageVolume) – Volume object to destroy
Returns:True if successful
Return type:bool
destroy_volume_snapshot(snapshot)[source]

Destroy a snapshot.

Parameters:snapshot (GCESnapshot) – Snapshot object to destroy
Returns:True if successful
Return type:bool
detach_volume(volume, ex_node=None)[source]

Detach a volume from a node.

Parameters:
  • volume (StorageVolume) – Volume object to detach
  • ex_node (Node) – Node object to detach volume from (required)
Returns:

True if successful

Return type:

bool

ex_copy_image(name, url, description=None)[source]

Copy an image to your image collection.

Parameters:
  • name (str) – The name of the image
  • url – The URL to the image. The URL can start with gs://
  • urlstr
  • description (str) – The description of the image
Returns:

NodeImage object based on provided information or None if an image with that name is not found.

Return type:

NodeImage or None

ex_create_address(name, region=None, address=None)[source]

Create a static address in a region.

Parameters:
  • name (str) – Name of static address
  • region (str or GCERegion) – Name of region for the address (e.g. ‘us-central1’)
  • address (str or None) – Ephemeral IP address to promote to a static one (e.g. ‘xxx.xxx.xxx.xxx’)
Returns:

Static Address object

Return type:

GCEAddress

ex_create_firewall(name, allowed, network='default', source_ranges=None, source_tags=None, target_tags=None)[source]

Create a firewall on a network.

Firewall rules should be supplied in the “allowed” field. This is a list of dictionaries formated like so (“ports” is optional):

[{"IPProtocol": "<protocol string or number>",
  "ports": "<port_numbers or ranges>"}]

For example, to allow tcp on port 8080 and udp on all ports, ‘allowed’ would be:

[{"IPProtocol": "tcp",
  "ports": ["8080"]},
 {"IPProtocol": "udp"}]

See Firewall Reference for more information.

Parameters:
  • name (str) – Name of the firewall to be created
  • allowed (list of dict) – List of dictionaries with rules
  • network (str or GCENetwork) – The network that the firewall applies to.
  • source_ranges (list of str) – A list of IP ranges in CIDR format that the firewall should apply to. Defaults to [‘0.0.0.0/0’]
  • source_tags (list of str) – A list of source instance tags the rules apply to.
  • target_tags (list of str) – A list of target instance tags the rules apply to.
Returns:

Firewall object

Return type:

GCEFirewall

ex_create_forwarding_rule(name, targetpool, region=None, protocol='tcp', port_range=None, address=None, description=None)[source]

Create a forwarding rule.

Parameters:
  • name (str) – Name of forwarding rule to be created
  • targetpool – Target pool to apply the rule to
  • targetpoolstr or GCETargetPool
  • region (str or GCERegion) – Region to create the forwarding rule in. Defaults to self.region
  • protocol (str) – Should be ‘tcp’ or ‘udp’
  • port_range (str) – Optional single port number or range separated by a dash. Examples: ‘80’, ‘5000-5999’.
  • address (str or GCEAddress) – Optional static address for forwarding rule. Must be in same region.
  • description (str or None) – The description of the forwarding rule. Defaults to None.
Returns:

Forwarding Rule object

Return type:

GCEForwardingRule

ex_create_healthcheck(name, host=None, path=None, port=None, interval=None, timeout=None, unhealthy_threshold=None, healthy_threshold=None, description=None)[source]

Create an Http Health Check.

Parameters:
  • name (str) – Name of health check
  • host (str) – Hostname of health check request. Defaults to empty and public IP is used instead.
  • path (str) – The request path for the check. Defaults to /.
  • port (int) – The TCP port number for the check. Defaults to 80.
  • interval (int) – How often (in seconds) to check. Defaults to 5.
  • timeout (int) – How long to wait before failing. Defaults to 5.
  • unhealthy_threshold (int) – How many failures before marking unhealthy. Defaults to 2.
  • healthy_threshold (int) – How many successes before marking as healthy. Defaults to 2.
  • description (str or None) – The description of the check. Defaults to None.
Returns:

Health Check object

Return type:

GCEHealthCheck

ex_create_image(name, volume, description=None, use_existing=True, wait_for_completion=True)[source]

Create an image from the provided volume.

Parameters:
  • name (str) – The name of the image to create.
  • volume (str or StorageVolume) – The volume to use to create the image, or the Google Cloud Storage URI
  • description (str) – Description of the new Image
  • use_existing (bool) – If True and an image with the given name already exists, return an object for that image instead of attempting to create a new image.
  • wait_for_completion (bool) – If True, wait until the new image is created before returning a new NodeImage Otherwise, return a new NodeImage instance, and let the user track the creation progress
Returns:

A GCENodeImage object for the new image

Return type:

GCENodeImage

ex_create_multiple_nodes(base_name, size, image, number, location=None, ex_network='default', ex_tags=None, ex_metadata=None, ignore_errors=True, use_existing_disk=True, poll_interval=2, external_ip='ephemeral', ex_disk_type='pd-standard', ex_auto_disk_delete=True, ex_service_accounts=None, timeout=180)[source]

Create multiple nodes and return a list of Node objects.

Nodes will be named with the base name and a number. For example, if the base name is ‘libcloud’ and you create 3 nodes, they will be named:

libcloud-000
libcloud-001
libcloud-002
Parameters:
  • base_name (str) – The base name of the nodes to create.
  • size (str or GCENodeSize) – The machine type to use.
  • image (str or GCENodeImage) – The image to use to create the nodes.
  • number (int) – The number of nodes to create.
  • location (str or NodeLocation or GCEZone or None) – The location (zone) to create the nodes in.
  • ex_network (str or GCENetwork) – The network to associate with the nodes.
  • ex_tags (list of str or None) – A list of tags to assiciate with the nodes.
  • ex_metadata (dict or None) – Metadata dictionary for instances.
  • ignore_errors (bool) – If True, don’t raise Exceptions if one or more nodes fails.
  • use_existing_disk (bool) – If True and if an existing disk with the same name/location is found, use that disk instead of creating a new one.
  • poll_interval (int) – Number of seconds between status checks.
  • external_ip (str or None) – The external IP address to use. If ‘ephemeral’ (default), a new non-static address will be used. If ‘None’, then no external address will be used. (Static addresses are not supported for multiple node creation.)
  • ex_disk_type (str) – Specify a pd-standard (default) disk or pd-ssd for an SSD disk.
  • ex_disk_auto_delete (bool) – Indicate that the boot disk should be deleted when the Node is deleted. Set to True by default.
  • ex_service_accounts (list) –

    Specify a list of serviceAccounts when creating the instance. The format is a list of dictionaries containing email and list of scopes, e.g. [{‘email’:’default’,

    ‘scopes’:[‘compute’, ...]}, ...]

    Scopes can either be full URLs or short names. If not provided, use the ‘default’ service account email and a scope of ‘devstorage.read_only’. Also accepts the aliases defined in ‘gcloud compute’.

  • timeout (int) – The number of seconds to wait for all nodes to be created before timing out.
Returns:

A list of Node objects for the new nodes.

Return type:

list of Node

ex_create_network(name, cidr)[source]

Create a network.

Parameters:
  • name (str) – Name of network to be created
  • cidr (str) – Address range of network in CIDR format.
Returns:

Network object

Return type:

GCENetwork

ex_create_targetpool(name, region=None, healthchecks=None, nodes=None, session_affinity=None)[source]

Create a target pool.

Parameters:
  • name (str) – Name of target pool
  • region (str or GCERegion or None) – Region to create the target pool in. Defaults to self.region
  • healthchecks (list of str or GCEHealthCheck) – Optional list of health checks to attach
  • nodes (list of str or Node) – Optional list of nodes to attach to the pool
  • session_affinity (str) – Optional algorithm to use for session affinity.
Returns:

Target Pool object

Return type:

GCETargetPool

ex_delete_image(image)[source]

Delete a specific image resource.

Parameters:image (str or GCENodeImage) – Image object to delete
Returns:True if successful
Return type:bool
ex_deprecate_image(image, replacement, state=None)[source]

Deprecate a specific image resource.

Parameters:
  • image (str or :class: GCENodeImage) – Image object to deprecate
  • replacement (str or :class: GCENodeImage) – Image object to use as a replacement
  • state (str) – State of the image
Returns:

True if successful

Return type:

bool

ex_destroy_address(address)[source]

Destroy a static address.

Parameters:address (GCEAddress) – Address object to destroy
Returns:True if successful
Return type:bool
ex_destroy_firewall(firewall)[source]

Destroy a firewall.

Parameters:firewall (GCEFirewall) – Firewall object to destroy
Returns:True if successful
Return type:bool
ex_destroy_forwarding_rule(forwarding_rule)[source]

Destroy a forwarding rule.

Parameters:forwarding_rule (GCEForwardingRule) – Forwarding Rule object to destroy
Returns:True if successful
Return type:bool
ex_destroy_healthcheck(healthcheck)[source]

Destroy a healthcheck.

Parameters:healthcheck (GCEHealthCheck) – Health check object to destroy
Returns:True if successful
Return type:bool
ex_destroy_multiple_nodes(node_list, ignore_errors=True, destroy_boot_disk=False, poll_interval=2, timeout=180)[source]

Destroy multiple nodes at once.

Parameters:
  • node_list (list of Node) – List of nodes to destroy
  • ignore_errors (bool) – If true, don’t raise an exception if one or more nodes fails to be destroyed.
  • destroy_boot_disk (bool) – If true, also destroy the nodes’ boot disks.
  • poll_interval (int) – Number of seconds between status checks.
  • timeout (int) – Number of seconds to wait for all nodes to be destroyed.
Returns:

A list of boolean values. One for each node. True means that the node was successfully destroyed.

Return type:

list of bool

ex_destroy_network(network)[source]

Destroy a network.

Parameters:network (GCENetwork) – Network object to destroy
Returns:True if successful
Return type:bool
ex_destroy_targetpool(targetpool)[source]

Destroy a target pool.

Parameters:targetpool (GCETargetPool) – TargetPool object to destroy
Returns:True if successful
Return type:bool
ex_get_address(name, region=None)[source]

Return an Address object based on an address name and optional region.

Parameters:
  • name (str) – The name of the address
  • region (str GCERegion or None) – The region to search for the address in (set to ‘all’ to search all regions)
Returns:

An Address object for the address

Return type:

GCEAddress

ex_get_firewall(name)[source]

Return a Firewall object based on the firewall name.

Parameters:name (str) – The name of the firewall
Returns:A GCEFirewall object
Return type:GCEFirewall
ex_get_forwarding_rule(name, region=None)[source]

Return a Forwarding Rule object based on the forwarding rule name.

Parameters:
  • name (str) – The name of the forwarding rule
  • region (str or None) – The region to search for the rule in (set to ‘all’ to search all regions).
Returns:

A GCEForwardingRule object

Return type:

GCEForwardingRule

ex_get_healthcheck(name)[source]

Return a HealthCheck object based on the healthcheck name.

Parameters:name (str) – The name of the healthcheck
Returns:A GCEHealthCheck object
Return type:GCEHealthCheck
ex_get_image(partial_name)[source]

Return an GCENodeImage object based on the name or link provided.

Parameters:partial_name (str) – The name, partial name, or full path of a GCE image.
Returns:GCENodeImage object based on provided information or None if an image with that name is not found.
Return type:GCENodeImage or None
ex_get_network(name)[source]

Return a Network object based on a network name.

Parameters:name (str) – The name of the network
Returns:A Network object for the network
Return type:GCENetwork
ex_get_node(name, zone=None)[source]

Return a Node object based on a node name and optional zone.

Parameters:
  • name (str) – The name of the node
  • zone (str or GCEZone or NodeLocation or None) – The zone to search for the node in. If set to ‘all’, search all zones for the instance.
Returns:

A Node object for the node

Return type:

Node

ex_get_project()[source]

Return a Project object with project-wide information.

Returns:A GCEProject object
Return type:GCEProject
ex_get_region(name)[source]

Return a Region object based on the region name.

Parameters:name (str) – The name of the region.
Returns:A GCERegion object for the region
Return type:GCERegion
ex_get_size(name, zone=None)[source]

Return a size object based on a machine type name and zone.

Parameters:
  • name (str) – The name of the node
  • zone (str or GCEZone or NodeLocation or None) – The zone to search for the machine type in
Returns:

A GCENodeSize object for the machine type

Return type:

GCENodeSize

ex_get_snapshot(name)[source]

Return a Snapshot object based on snapshot name.

Parameters:name (str) – The name of the snapshot
Returns:A GCESnapshot object for the snapshot
Return type:GCESnapshot
ex_get_targetpool(name, region=None)[source]

Return a TargetPool object based on a name and optional region.

Parameters:
  • name (str) – The name of the target pool
  • region (str or GCERegion or None) – The region to search for the target pool in (set to ‘all’ to search all regions).
Returns:

A TargetPool object for the pool

Return type:

GCETargetPool

ex_get_volume(name, zone=None)[source]

Return a Volume object based on a volume name and optional zone.

Parameters:
  • name (str) – The name of the volume
  • zone (str or GCEZone or NodeLocation or None) – The zone to search for the volume in (set to ‘all’ to search all zones)
Returns:

A StorageVolume object for the volume

Return type:

StorageVolume

ex_get_zone(name)[source]

Return a Zone object based on the zone name.

Parameters:name (str) – The name of the zone.
Returns:A GCEZone object for the zone or None if not found
Return type:GCEZone or None
ex_list_addresses(region=None)[source]

Return a list of static addresses for a region or all.

Parameters:region (str or None) – The region to return addresses from. For example: ‘us-central1’. If None, will return addresses from region of self.zone. If ‘all’, will return all addresses.
Returns:A list of static address objects.
Return type:list of GCEAddress
ex_list_firewalls()[source]

Return the list of firewalls.

Returns:A list of firewall objects.
Return type:list of GCEFirewall
ex_list_forwarding_rules(region=None)[source]

Return the list of forwarding rules for a region or all.

Parameters:region (str or GCERegion or None) – The region to return forwarding rules from. For example: ‘us-central1’. If None, will return forwarding rules from the region of self.region (which is based on self.zone). If ‘all’, will return all forwarding rules.
Returns:A list of forwarding rule objects.
Return type:list of GCEForwardingRule
ex_list_healthchecks()[source]

Return the list of health checks.

Returns:A list of health check objects.
Return type:list of GCEHealthCheck
ex_list_networks()[source]

Return the list of networks.

Returns:A list of network objects.
Return type:list of GCENetwork
ex_list_regions()[source]

Return the list of regions.

Returns:A list of region objects.
Return type:list of GCERegion
ex_list_snapshots()[source]

Return the list of disk snapshots in the project.

Returns:A list of snapshot objects
Return type:list of GCESnapshot
ex_list_targetpools(region=None)[source]

Return the list of target pools.

Returns:A list of target pool objects
Return type:list of GCETargetPool
ex_list_zones()[source]

Return the list of zones.

Returns:A list of zone objects.
Return type:list of GCEZone
ex_set_node_scheduling(node, on_host_maintenance=None, automatic_restart=None)[source]

Set the maintenance behavior for the node.

See Scheduling documentation for more info.

Parameters:
  • node (Node) – Node object
  • on_host_maintenance (str) – Defines whether node should be terminated or migrated when host machine goes down. Acceptable values are: ‘MIGRATE’ or ‘TERMINATE’ (If not supplied, value will be reset to GCE default value for the instance type.)
  • automatic_restart (bool) – Defines whether the instance should be automatically restarted when it is terminated by Compute Engine. (If not supplied, value will be set to the GCE default value for the instance type.)
Returns:

True if successful.

Return type:

bool

ex_set_node_tags(node, tags)[source]

Set the tags on a Node instance.

Note that this updates the node object directly.

Parameters:
  • node (Node) – Node object
  • tags (list of str) – List of tags to apply to the object
Returns:

True if successful

Return type:

bool

ex_set_volume_auto_delete(volume, node, auto_delete=True)[source]

Sets the auto-delete flag for a volume attached to a node.

Parameters:
  • volume (StorageVolume) – Volume object to auto-delete
  • ex_node (Node) – Node object to auto-delete volume from
  • auto_delete (bool (default True)) – Flag to set for the auto-delete value
Returns:

True if successful

Return type:

bool

ex_targetpool_add_healthcheck(targetpool, healthcheck)[source]

Add a health check to a target pool.

Parameters:
  • targetpool (str or GCETargetPool) – The targetpool to add health check to
  • healthcheck (str or GCEHealthCheck) – The healthcheck to add
Returns:

True if successful

Return type:

bool

ex_targetpool_add_node(targetpool, node)[source]

Add a node to a target pool.

Parameters:
  • targetpool (str or GCETargetPool) – The targetpool to add node to
  • node (str or Node) – The node to add
Returns:

True if successful

Return type:

bool

ex_targetpool_remove_healthcheck(targetpool, healthcheck)[source]

Remove a health check from a target pool.

Parameters:
  • targetpool (str or GCETargetPool) – The targetpool to remove health check from
  • healthcheck (str or GCEHealthCheck) – The healthcheck to remove
Returns:

True if successful

Return type:

bool

ex_targetpool_remove_node(targetpool, node)[source]

Remove a node from a target pool.

Parameters:
  • targetpool (str or GCETargetPool) – The targetpool to remove node from
  • node (str or Node) – The node to remove
Returns:

True if successful

Return type:

bool

ex_update_firewall(firewall)[source]

Update a firewall with new values.

To update, change the attributes of the firewall object and pass the updated object to the method.

Parameters:firewall (GCEFirewall) – A firewall object with updated values.
Returns:An object representing the new state of the firewall.
Return type:GCEFirewall
ex_update_healthcheck(healthcheck)[source]

Update a health check with new values.

To update, change the attributes of the health check object and pass the updated object to the method.

Parameters:healthcheck (GCEHealthCheck) – A healthcheck object with updated values.
Returns:An object representing the new state of the health check.
Return type:GCEHealthCheck
list_images(ex_project=None)[source]

Return a list of image objects for a project.

Parameters:ex_project (str or None) – Optional alternate project name.
Returns:List of GCENodeImage objects
Return type:list of GCENodeImage
list_locations()[source]

Return a list of locations (zones).

The ex_list_zones method returns more comprehensive results, but this is here for compatibility.

Returns:List of NodeLocation objects
Return type:list of NodeLocation
list_nodes(ex_zone=None)[source]

Return a list of nodes in the current zone or all zones.

Parameters:ex_zone (str or GCEZone or NodeLocation or None) – Optional zone name or ‘all’
Returns:List of Node objects
Return type:list of Node
list_sizes(location=None)[source]

Return a list of sizes (machineTypes) in a zone.

Parameters:location (str or GCEZone or NodeLocation or None) – Location or Zone for sizes
Returns:List of GCENodeSize objects
Return type:list of GCENodeSize
list_volume_snapshots(volume)[source]

List snapshots created from the provided volume.

For GCE, snapshots are global, but while the volume they were created from still exists, the source disk for the snapshot is tracked.

Parameters:volume (StorageVolume) – A StorageVolume object
Returns:A list of Snapshot objects
Return type:list of GCESnapshot
list_volumes(ex_zone=None)[source]

Return a list of volumes for a zone or all.

Will return list from provided zone, or from the default zone unless given the value of ‘all’.

Parameters:ex_zone (str or GCEZone or NodeLocation or None) – The zone to return volumes from.
Returns:A list of volume objects.
Return type:list of StorageVolume
name = 'Google Compute Engine'
reboot_node(node)[source]

Reboot a node.

Parameters:node (Node) – Node to be rebooted
Returns:True if successful, False if not
Return type:bool
type = 'gce'
website = 'https://cloud.google.com/'
class libcloud.compute.drivers.gce.GCENodeImage(id, name, driver, extra=None)[source]

Bases: libcloud.compute.base.NodeImage

A GCE Node Image class.

delete()[source]

Delete this image

Returns:True if successful
Return type:bool
deprecate(replacement, state)[source]

Deprecate this image

Parameters:
  • replacement (str or :class: GCENodeImage) – Image to use as a replacement
  • state (str) – Deprecation state of this image. Possible values include ‘DELETED’, ‘DEPRECATED’ or ‘OBSOLETE’.
Returns:

True if successful

Return type:

bool

class libcloud.compute.drivers.gce.GCENodeSize(id, name, ram, disk, bandwidth, price, driver, extra=None)[source]

Bases: libcloud.compute.base.NodeSize

A GCE Node Size (MachineType) class.

class libcloud.compute.drivers.gce.GCEProject(id, name, metadata, quotas, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

GCE Project information.

class libcloud.compute.drivers.gce.GCERegion(id, name, status, zones, quotas, deprecated, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

class libcloud.compute.drivers.gce.GCEResponse(response, connection)[source]

Bases: libcloud.common.google.GoogleResponse

Parameters:
class libcloud.compute.drivers.gce.GCESnapshot(id, name, size, status, driver, extra=None)[source]

Bases: libcloud.compute.base.VolumeSnapshot

class libcloud.compute.drivers.gce.GCETargetPool(id, name, region, healthchecks, nodes, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

add_healthcheck(healthcheck)[source]

Add a healthcheck to this target pool.

Parameters:healthcheck (str or GCEHealthCheck) – Healthcheck to add
Returns:True if successful
Return type:bool
add_node(node)[source]

Add a node to this target pool.

Parameters:node (str or Node) – Node to add
Returns:True if successful
Return type:bool
destroy()[source]

Destroy this Target Pool

Returns:True if successful
Return type:bool
remove_healthcheck(healthcheck)[source]

Remove a healthcheck from this target pool.

Parameters:healthcheck (str or GCEHealthCheck) – Healthcheck to remove
Returns:True if successful
Return type:bool
remove_node(node)[source]

Remove a node from this target pool.

Parameters:node (str or Node) – Node to remove
Returns:True if successful
Return type:bool
class libcloud.compute.drivers.gce.GCEZone(id, name, status, maintenance_windows, deprecated, driver, extra=None)[source]

Bases: libcloud.compute.base.NodeLocation

Subclass of NodeLocation to provide additional information.

next_mw_duration[source]

Returns the duration of the next Maintenance Window as a datetime.timedelta object.

time_until_mw[source]

Returns the time until the next Maintenance Window as a datetime.timedelta object.

libcloud.compute.drivers.gce.timestamp_to_datetime(timestamp)[source]

Return a datetime object that corresponds to the time in an RFC3339 timestamp.

Parameters:timestamp (str) – RFC3339 timestamp string
Returns:Datetime object corresponding to timestamp
Return type:datetime.datetime

libcloud.compute.drivers.gogrid module

GoGrid driver

class libcloud.compute.drivers.gogrid.GoGridNode(id, name, state, public_ips, private_ips, driver, size=None, image=None, extra=None)[source]

Bases: libcloud.compute.base.Node

Parameters:
  • id (str) – Node ID.
  • name (str) – Node name.
  • state (libcloud.compute.types.NodeState) – Node state.
  • public_ips (list) – Public IP addresses associated with this node.
  • private_ips (list) – Private IP addresses associated with this node.
  • driver (NodeDriver) – Driver this node belongs to.
  • size (NodeImage) – Size of this node. (optional)
  • image – Image of this node. (optional)
  • extra (dict) – Optional provider specific attributes associated with this node.
get_uuid()[source]
class libcloud.compute.drivers.gogrid.GoGridNodeDriver(*args, **kwargs)[source]

Bases: libcloud.common.gogrid.BaseGoGridDriver, libcloud.compute.base.NodeDriver

GoGrid node driver

@inherits: NodeDriver.__init__

api_name = 'gogrid'
connectionCls

alias of GoGridConnection

create_node(**kwargs)[source]

Create a new GoGird node

@inherits: NodeDriver.create_node

Parameters:
  • ex_description (str) – Description of a Node
  • ex_ip (str) – Public IP address to use for a Node. If not specified, first available IP address will be picked
Return type:

GoGridNode

destroy_node(node)[source]

@inherits: NodeDriver.reboot_node :type node: GoGridNode

ex_create_node_nowait(**kwargs)[source]

Don’t block until GoGrid allocates id for a node but return right away with id == None.

The existence of this method is explained by the fact that GoGrid assigns id to a node only few minutes after creation.

Parameters:
  • name (str) – String with a name for this new node (required)
  • size (NodeSize) – The size of resources allocated to this node . (required)
  • image (NodeImage) – OS Image to boot on node. (required)
  • ex_description (str) – Description of a Node
  • ex_ip (str) – Public IP address to use for a Node. If not specified, first available IP address will be picked
Return type:

GoGridNode

ex_edit_image(**kwargs)[source]

Edit metadata of a server image.

Parameters:
  • image (NodeImage) – image to be edited (required)
  • public (bool) – should be the image public (required)
  • ex_description (str) – description of the image (optional)
  • name (str) – name of the image
Return type:

NodeImage

ex_edit_node(**kwargs)[source]

Change attributes of a node.

Parameters:
  • node (GoGridNode) – node to be edited (required)
  • size (NodeSize) – new size of a node (required)
  • ex_description (str) – new description of a node
Return type:

Node

ex_list_ips(**kwargs)[source]

Return list of IP addresses assigned to the account.

Parameters:
  • public (bool) – set to True to list only public IPs or False to list only private IPs. Set to None or not specify at all not to filter by type
  • assigned (bool) – set to True to list only addresses assigned to servers, False to list unassigned addresses and set to None or don’t set at all not no filter by state
  • location (NodeLocation) – filter IP addresses by location
Return type:

list of GoGridIpAddress

ex_save_image(node, name)[source]

Create an image for node.

Please refer to GoGrid documentation to get info how prepare a node for image creation:

http://wiki.gogrid.com/wiki/index.php/MyGSI

Parameters:
  • node (GoGridNode) – node to use as a base for image
  • name (str) – name for new image
Return type:

NodeImage

features = {'create_node': ['generates_password']}
list_images(location=None)[source]
list_locations()[source]
list_nodes()[source]

@inherits: NodeDriver.list_nodes :rtype: list of GoGridNode

list_sizes(location=None)[source]
name = 'GoGrid'
reboot_node(node)[source]

@inherits: NodeDriver.reboot_node :type node: GoGridNode

type = 'gogrid'
website = 'http://www.gogrid.com/'

libcloud.compute.drivers.gridspot module

exception libcloud.compute.drivers.gridspot.GridspotAPIException[source]

Bases: exceptions.Exception

class libcloud.compute.drivers.gridspot.GridspotConnection(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.base.ConnectionKey

Connection class to connect to Gridspot’s API servers

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

add_default_params(params)[source]
host = 'gridspot.com'
responseCls

alias of GridspotResponse

class libcloud.compute.drivers.gridspot.GridspotNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Gridspot (http://www.gridspot.com/) node driver.

NODE_STATE_MAP = {'Running': 0, 'Starting': 3}
connectionCls

alias of GridspotConnection

destroy_node(node)[source]
list_nodes()[source]
name = 'Gridspot'
type = 'gridspot'
website = 'http://www.gridspot.com/'
class libcloud.compute.drivers.gridspot.GridspotResponse(response, connection)[source]

Bases: libcloud.common.base.JsonResponse

Response class for Gridspot

Parameters:
parse_body()[source]
parse_error()[source]

libcloud.compute.drivers.hostvirtual module

libcloud driver for the Host Virtual Inc. (VR) API Home page http://www.vr.org/

class libcloud.compute.drivers.hostvirtual.HostVirtualComputeConnection(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.hostvirtual.HostVirtualConnection

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

responseCls

alias of HostVirtualComputeResponse

class libcloud.compute.drivers.hostvirtual.HostVirtualComputeResponse(response, connection)[source]

Bases: libcloud.common.hostvirtual.HostVirtualResponse

Parameters:
class libcloud.compute.drivers.hostvirtual.HostVirtualNodeDriver(key, secure=True, host=None, port=None)[source]

Bases: libcloud.compute.base.NodeDriver

connectionCls

alias of HostVirtualComputeConnection

create_node(**kwargs)[source]
destroy_node(node)[source]
ex_delete_node(node)[source]

Delete a node.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_get_node(node_id)[source]

Get a single node.

Parameters:node_id (str) – id of the node that we need the node object for
Return type:Node
ex_provision_node(**kwargs)[source]

Provision a server on a VR package and get it booted

Parameters:
  • node (Node) – node which should be used
  • image (NodeImage) – The distribution to deploy on your server (mandatory)
  • auth (NodeAuthSSHKey or NodeAuthPassword) – an SSH key or root password (mandatory)
  • location (NodeLocation) – which datacenter to create the server in
Returns:

Node representing the newly built server

Return type:

Node

ex_start_node(node)[source]

Start a node.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_stop_node(node)[source]

Stop a node.

Parameters:node (Node) – Node which should be used
Return type:bool
features = {'create_node': ['ssh_key', 'password']}
list_images()[source]
list_locations()[source]
list_nodes()[source]
list_sizes(location=None)[source]
name = 'HostVirtual'
reboot_node(node)[source]
type = 'hostvirtual'
website = 'http://www.vr.org'

libcloud.compute.drivers.hpcloud module

HP Public cloud driver which is essentially just a small wrapper around OpenStack driver.

class libcloud.compute.drivers.hpcloud.HPCloudNodeDriver(key, secret, tenant_name, secure=True, host=None, port=None, region='region-b.geo-1', **kwargs)[source]

Bases: libcloud.compute.drivers.openstack.OpenStack_1_1_NodeDriver

Note: tenant_name argument is required for HP cloud.

connectionCls

alias of HPCloudConnection

name = 'HP Public Cloud (Helion)'
type = 'hpcloud'
website = 'http://www.hpcloud.com/'

libcloud.compute.drivers.ibm_sce module

Driver for IBM SmartCloud Enterprise

Formerly known as: - IBM Developer Cloud - IBM Smart Business Development and Test on the IBM Cloud - IBM SmartBusiness Cloud

class libcloud.compute.drivers.ibm_sce.Address(id, ip, state, options)[source]

Bases: object

A reserved IP address that can be attached to an instance. Properties: id, ip, state, options(location, type, created_time, state,

hostname, instance_ids, vlan, owner,

mode, offering_id)

class libcloud.compute.drivers.ibm_sce.IBMConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Connection class for the IBM SmartCloud Enterprise driver

add_default_headers(headers)[source]
encode_data(data)[source]
host = 'www-147.ibm.com'
responseCls

alias of IBMResponse

class libcloud.compute.drivers.ibm_sce.IBMNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Node driver for IBM SmartCloud Enterprise

NODE_STATE_MAP = {0: 3, 1: 3, 2: 2, 3: 2, 4: 2, 5: 0, 6: 4, 7: 3, 8: 1, 9: 3, 10: 3, 11: 2, 12: 3, 13: 3, 14: 3, 15: 3}
attach_volume(node, volume)[source]

Attaches volume to node.

Parameters:
  • node (Node) – Node to attach volume to
  • volume (StorageVolume) – Volume to attach
Return type:

bool

connectionCls

alias of IBMConnection

create_image(name, description=None, **kwargs)[source]

Create a new node image from an existing volume or image.

Parameters:
  • name (str) – Name of the image to be created (required)
  • description (str) – Description of the image to be created
  • image_id (str) – The ID of the source image if cloning the image
  • volume_id (str) – The ID of the storage volume if importing the image
Returns:

The newly created NodeImage.

Return type:

NodeImage

create_node(**kwargs)[source]

Creates a node in the IBM SmartCloud Enterprise.

See NodeDriver.create_node for more keyword args.

@inherits: NodeDriver.create_node

Parameters:
  • auth (NodeAuthSSHKey) – Name of the pubkey to use. When constructing NodeAuthSSHKey instance, ‘pubkey’ argument must be the name of the public key to use. You chose this name when creating a new public key on the IBM server.
  • ex_configurationData (dict) – Image-specific configuration parameters. Configuration parameters are defined in the parameters .xml file. The URL to this file is defined in the NodeImage at extra[parametersURL]. Note: This argument must be specified when launching a Windows instance. It must contain ‘UserName’ and ‘Password’ keys.
create_volume(size, name, location, **kwargs)[source]

Create a new block storage volume (virtual disk)

Parameters:
  • size (int) – Size of volume in gigabytes (required). Find out the possible sizes from the offerings/storage REST interface
  • name (str) – Name of the volume to be created (required)
  • location (NodeLocation) – Which data center to create a volume in. If empty, it will fail for IBM SmartCloud Enterprise (required)
  • snapshot (str) – Not supported for IBM SmartCloud Enterprise
  • kwargs.format (str) – Either RAW or EXT3 for IBM SmartCloud Enterprise (optional)
  • kwargs.offering_id (str) – The storage offering ID for IBM SmartCloud Enterprise Find this from the REST interface storage/offerings. (optional)
  • kwargs.source_disk_id (str) – If cloning a volume, the storage disk to make a copy from (optional)
  • kwargs.storage_area_id (str) – The id of the storage availability area to create the volume in (optional)
  • kwargs.target_location_id (str) – If cloning a volume, the storage disk to make a copy from (optional)
Returns:

The newly created StorageVolume.

Return type:

StorageVolume

destroy_node(node)[source]
destroy_volume(volume)[source]

Destroys a storage volume.

Parameters:volume (StorageVolume) – Volume to be destroyed
Return type:bool
detach_volume(node, volume)[source]

Detaches a volume from a node.

Parameters:
  • node (Node) – Node which should be used
  • volume (StorageVolume) – Volume to be detached
Return type:

bool

ex_allocate_address(location_id, offering_id, vlan_id=None)[source]

Allocate a new reserved IP address

Parameters:
  • location_id (str) – Target data center
  • offering_id (str) – Offering ID for address to create
  • vlan_id (str) – ID of target VLAN
Returns:

Address object

Return type:

Address

ex_copy_to(image, volume)[source]

Copies a node image to a storage volume

Parameters:
  • image (NodeImage) – source image to copy
  • volume (StorageVolume) – Target storage volume to copy to
Returns:

bool The success of the operation

Return type:

bool

ex_delete_address(resource_id)[source]

Delete a reserved IP address

Parameters:resource_id (str) – The address to delete (required)
Return type:bool
ex_destroy_image(image)[source]

Destroys an image.

Parameters:image (NodeImage) – Image to be destroyed
Returns:bool
ex_list_addresses(resource_id=None)[source]

List the reserved IP addresses

Parameters:resource_id (str) – If this is supplied only a single address will be returned (optional)
Return type:list of Address
ex_list_storage_offerings()[source]

List the storage center offerings

Return type:list of VolumeOffering
ex_wait_storage_state(volume, state='4', wait_period=60, timeout=1200)[source]

Block until storage volume state changes to the given value

Parameters:
  • volume (StorageVolume) – Storage volume.
  • state (int) – The target state to wait for
  • wait_period (int) – How many seconds to between each loop iteration (default is 3)
  • timeout (int) – How many seconds to wait before timing out (default is 1200)
Return type:

StorageVolume

list_images(location=None)[source]
list_locations()[source]
list_nodes()[source]
list_sizes(location=None)[source]

Returns a generic list of sizes. See list_images() for a list of supported sizes for specific images. In particular, you need to have a size that matches the architecture (32-bit vs 64-bit) of the virtual machine image operating system.

@inherits: NodeDriver.list_sizes

list_volumes()[source]

List storage volumes.

Return type:list of StorageVolume
name = 'IBM SmartCloud Enterprise'
reboot_node(node)[source]
type = 'ibm'
website = 'http://ibm.com/services/us/en/cloud-enterprise/'
class libcloud.compute.drivers.ibm_sce.IBMNodeLocation(id, name, country, driver, extra=None)[source]

Bases: libcloud.compute.base.NodeLocation

Extends the base LibCloud NodeLocation to contain additional attributes

class libcloud.compute.drivers.ibm_sce.IBMResponse(response, connection)[source]

Bases: libcloud.common.base.XmlResponse

Parameters:
parse_error()[source]
success()[source]
class libcloud.compute.drivers.ibm_sce.VolumeOffering(id, name, location, extra=None)[source]

Bases: object

An SCE specific storage volume offering class. The volume offering ID is needed to create a volume. Volume offering IDs are different for each data center.

class libcloud.compute.drivers.ibm_sce.VolumeState[source]

Bases: object

The SCE specific states for a storage volume

ATTACHED = '5'
ATTACHIED = '12'
ATTACHING = '10'
BEING_CLONED = '8'
CLONING = '9'
CREATING = '1'
DELETED = '3'
DELETE_PENDING = '7'
DELETING = '2'
DETACHED = '4'
DETACHING = '11'
FAILED = '6'
IMPORTING = '13'
NEW = '0'
TRANSFER_RETRYING = '14'

libcloud.compute.drivers.ikoula module

class libcloud.compute.drivers.ikoula.IkoulaNodeDriver(key, secret=None, secure=True, host=None, path=None, port=None, url=None, *args, **kwargs)[source]

Bases: libcloud.compute.drivers.cloudstack.CloudStackNodeDriver

Inherits:

NodeDriver.__init__

Parameters:
  • host (str) – The host where the API can be reached. (required)
  • path (str) – The path where the API can be reached. (required)
  • url (str) – Full URL to the API endpoint. Mutually exclusive with host and path argument.
host = 'cloudstack.ikoula.com'
name = 'Ikoula'
path = '/client/api'
type = 'ikoula'
website = 'http://express.ikoula.co.uk/cloudstack'

libcloud.compute.drivers.joyent module

Joyent Cloud (http://www.joyentcloud.com) driver.

class libcloud.compute.drivers.joyent.JoyentConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Joyent connection class.

add_default_headers(headers)[source]
allow_insecure = False
responseCls

alias of JoyentResponse

class libcloud.compute.drivers.joyent.JoyentNodeDriver(key, secret=None, secure=True, host=None, port=None, region='us-east-1', **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Joyent node driver class.

connectionCls

alias of JoyentConnection

create_node(**kwargs)[source]
destroy_node(node)[source]
ex_start_node(node)[source]

Start node

Parameters:node (Node) – The node to be stopped
Return type:bool
ex_stop_node(node)[source]

Stop node

Parameters:node (Node) – The node to be stopped
Return type:bool
features = {'create_node': ['generates_password']}
list_images()[source]
list_nodes()[source]
list_sizes()[source]
name = 'Joyent'
reboot_node(node)[source]
type = 'joyent'
website = 'http://www.joyentcloud.com'
class libcloud.compute.drivers.joyent.JoyentResponse(response, connection)[source]

Bases: libcloud.common.base.JsonResponse

Joyent response class.

Parameters:
parse_error()[source]
success()[source]
valid_response_codes = [200, 202, 201, 204]

libcloud.compute.drivers.kili module

HP Public cloud driver which is essentially just a small wrapper around OpenStack driver.

class libcloud.compute.drivers.kili.KiliCloudNodeDriver(key, secret, tenant_name, secure=True, host=None, port=None, **kwargs)[source]

Bases: libcloud.compute.drivers.openstack.OpenStack_1_1_NodeDriver

Note: tenant_name argument is required for Kili cloud.

connectionCls

alias of KiliCloudConnection

name = 'Kili Public Cloud'
type = 'hpcloud'
website = 'http://kili.io/'

libcloud.compute.drivers.ktucloud module

class libcloud.compute.drivers.ktucloud.KTUCloudNodeDriver(key, secret=None, secure=True, host=None, path=None, port=None, url=None, *args, **kwargs)[source]

Bases: libcloud.compute.drivers.cloudstack.CloudStackNodeDriver

Driver for KTUCloud Compute platform.

Inherits:

NodeDriver.__init__

Parameters:
  • host (str) – The host where the API can be reached. (required)
  • path (str) – The path where the API can be reached. (required)
  • url (str) – Full URL to the API endpoint. Mutually exclusive with host and path argument.
EMPTY_DISKOFFERINGID = '0'
create_node(name, size, image, location=None, **kwargs)[source]
list_images(location=None)[source]
list_sizes(location=None)[source]
name = 'KTUCloud'
type = 'ktucloud'
website = 'https://ucloudbiz.olleh.com/'

libcloud.compute.drivers.libvirt_driver module

class libcloud.compute.drivers.libvirt_driver.LibvirtNodeDriver(uri)[source]

Bases: libcloud.compute.base.NodeDriver

Libvirt (http://libvirt.org/) node driver.

To enable debug mode, set LIBVIR_DEBUG environment variable.

Parameters:uri (str) – Hypervisor URI (e.g. vbox:///session, qemu:///system, etc.).
NODE_STATE_MAP = {0: 2, 1: 0, 2: 3, 3: 2, 4: 2, 5: 2, 6: 4, 7: 4}
destroy_node(node)[source]
ex_get_hypervisor_hostname()[source]

Return a system hostname on which the hypervisor is running.

ex_get_hypervisor_sysinfo()[source]

Retrieve hypervisor system information.

Return type:dict
ex_resume_node(node)[source]

Resume a suspended node.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_shutdown_node(node)[source]

Shutdown a running node.

Note: Usually this will result in sending an ACPI event to the node.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_start_node(node)[source]

Start a stopped node.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_suspend_node(node)[source]

Suspend a running node.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_take_node_screenshot(node, directory, screen=0)[source]

Take a screenshot of a monitoring of a running instance.

Parameters:
  • node (libcloud.compute.base.Node) – Node to take the screenshot of.
  • directory (str) – Path where the screenshot will be saved.
  • screen (int) – ID of the monitor to take the screenshot of.
Returns:

Full path where the screenshot has been saved.

Return type:

str

list_nodes()[source]
name = 'Libvirt'
reboot_node(node)[source]
type = 'libvirt'
website = 'http://libvirt.org/'

libcloud.compute.drivers.linode module

libcloud driver for the Linode(R) API

This driver implements all libcloud functionality for the Linode API. Since the API is a bit more fine-grained, create_node abstracts a significant amount of work (and may take a while to run).

Linode home page http://www.linode.com/ Linode API documentation http://www.linode.com/api/ Alternate bindings for reference http://github.com/tjfontaine/linode-python

Linode(R) is a registered trademark of Linode, LLC.

class libcloud.compute.drivers.linode.LinodeNodeDriver(key)[source]

Bases: libcloud.compute.base.NodeDriver

libcloud driver for the Linode API

Rough mapping of which is which:

list_nodes linode.list reboot_node linode.reboot destroy_node linode.delete create_node linode.create, linode.update,

linode.disk.createfromdistribution, linode.disk.create, linode.config.create, linode.ip.addprivate, linode.boot

list_sizes avail.linodeplans list_images avail.distributions list_locations avail.datacenters

For more information on the Linode API, be sure to read the reference:

Instantiate the driver with the given API key

Parameters:key (str) – the API key to use (required)
Return type:None
LINODE_STATES = {0: 3, 1: 0, 2: 2, 3: 1, 4: 4, -2: 4, -1: 3}
connectionCls

alias of LinodeConnection

create_node(**kwargs)[source]

Create a new Linode, deploy a Linux distribution, and boot

This call abstracts much of the functionality of provisioning a Linode and getting it booted. A global grant to add Linodes to the account is required, as this call will result in a billing charge.

Note that there is a safety valve of 5 Linodes per hour, in order to prevent a runaway script from ruining your day.

Parameters:
  • name (str) – the name to assign the Linode (mandatory)
  • image (NodeImage) – which distribution to deploy on the Linode (mandatory)
  • size (NodeSize) – the plan size to create (mandatory)
  • auth (NodeAuthSSHKey or NodeAuthPassword) – an SSH key or root password (mandatory)
  • location (NodeLocation) – which datacenter to create the Linode in
  • ex_swap (int) – size of the swap partition in MB (128)
  • ex_rsize (int) – size of the root partition in MB (plan size - swap).
  • ex_kernel (str) – a kernel ID from avail.kernels (Latest 2.6 Stable).
  • ex_payment (int) – one of 1, 12, or 24; subscription length (1)
  • ex_comment (str) – a small comment for the configuration (libcloud)
  • ex_private (bool) – whether or not to request a private IP (False)
  • lconfig (str) – what to call the configuration (generated)
  • lroot (str) – what to call the root image (generated)
  • lswap (str) – what to call the swap space (generated)
Returns:

Node representing the newly-created Linode

Return type:

Node

destroy_node(node)[source]

Destroy the given Linode

Will remove the Linode from the account and issue a prorated credit. A grant for removing Linodes from the account is required, otherwise this method will fail.

In most cases, all disk images must be removed from a Linode before the Linode can be removed; however, this call explicitly skips those safeguards. There is no going back from this method.

Parameters:node (Node) – the Linode to destroy
Return type:bool
features = {'create_node': ['ssh_key', 'password']}
linode_set_datacenter(dc)[source]

Set the default datacenter for Linode creation

Since Linodes must be created in a facility, this function sets the default that create_node will use. If a location keyword is not passed to create_node, this method must have already been used.

Parameters:dc (NodeLocation) – the datacenter to create Linodes in unless specified
Return type:bool
list_images()[source]

List available Linux distributions

Retrieve all Linux distributions that can be deployed to a Linode.

Return type:list of NodeImage
list_locations()[source]

List available facilities for deployment

Retrieve all facilities that a Linode can be deployed in.

Return type:list of NodeLocation
list_nodes()[source]

List all Linodes that the API key can access

This call will return all Linodes that the API key in use has access
to.

If a node is in this list, rebooting will work; however, creation and destruction are a separate grant.

Returns:List of node objects that the API key can access
Return type:list of Node
list_sizes(location=None)[source]

List available Linode plans

Gets the sizes that can be used for creating a Linode. Since available Linode plans vary per-location, this method can also be passed a location to filter the availability.

Parameters:location (NodeLocation) – the facility to retrieve plans in
Return type:list of NodeSize
name = 'Linode'
reboot_node(node)[source]

Reboot the given Linode

Will issue a shutdown job followed by a boot job, using the last booted configuration. In most cases, this will be the only configuration.

Parameters:node (Node) – the Linode to reboot
Return type:bool
type = 'linode'
website = 'http://www.linode.com/'

libcloud.compute.drivers.nephoscale module

NephoScale Cloud driver (http://www.nephoscale.com) API documentation: http://docs.nephoscale.com Created by Markos Gogoulos (https://mist.io)

class libcloud.compute.drivers.nephoscale.NephoscaleConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Nephoscale connection class. Authenticates to the API through Basic Authentication with username/password

add_default_headers(headers)[source]

Add parameters that are necessary for every request

allow_insecure = False
host = 'api.nephoscale.com'
responseCls

alias of NephoscaleResponse

class libcloud.compute.drivers.nephoscale.NephoscaleNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Nephoscale node driver class.

>>> from libcloud.compute.providers import get_driver
>>> driver = get_driver('nephoscale')
>>> conn = driver('nepho_user','nepho_password')
>>> conn.list_nodes()
api_name = 'nephoscale'
connectionCls

alias of NephoscaleConnection

create_node(name, size, image, server_key=None, console_key=None, zone=None, **kwargs)[source]

Creates the node, and sets the ssh key, console key NephoScale will respond with a 200-200 response after sending a valid request. If nowait=True is specified in the args, we then ask a few times until the server is created and assigned a public IP address, so that deploy_node can be run

>>> from libcloud.compute.providers import get_driver
>>> driver = get_driver('nephoscale')
>>> conn = driver('nepho_user','nepho_password')
>>> conn.list_nodes()
>>> name = 'staging-server'
>>> size = conn.list_sizes()[0]
<NodeSize: id=27, ...name=CS025 - 0.25GB, 10GB, ...>
>>> image = conn.list_images()[9]
<NodeImage: id=49, name=Linux Ubuntu Server 10.04 LTS 64-bit, ...>
>>> server_keys = conn.ex_list_keypairs(key_group=1)[0]
<NodeKey: id=71211, name=markos>
>>> server_key = conn.ex_list_keypairs(key_group=1)[0].id
70867
>>> console_keys = conn.ex_list_keypairs(key_group=4)[0]
<NodeKey: id=71213, name=mistio28434>
>>> console_key = conn.ex_list_keypairs(key_group=4)[0].id
70907
>>> node = conn.create_node(name=name, size=size, image=image,                 console_key=console_key, server_key=server_key)

We can also create an ssh key, plus a console key and deploy node with them >>> server_key = conn.ex_create_keypair(name, public_key=‘123’) 71211 >>> console_key = conn.ex_create_keypair(name, key_group=4) 71213

We can increase the number of connect attempts to wait until the node is created, so that deploy_node has ip address to deploy the script We can also specify the location >>> location = conn.list_locations()[0] >>> node = conn.create_node(name=name,

... size=size, ... image=image, ... console_key=console_key, ... server_key=server_key, ... connect_attempts=10, ... nowait=True, ... zone=location.id)
destroy_node(node)[source]

destroy a node

ex_create_keypair(name, public_key=None, password=None, key_group=None)[source]

Creates a key, ssh or password, for server or console The group for the key (key_group) is 1 for Server and 4 for Console Returns the id of the created key

ex_delete_keypair(key_id, ssh=False)[source]

Delete an ssh key or password given it’s id

ex_list_keypairs(ssh=False, password=False, key_group=None)[source]

List available console and server keys There are two types of keys for NephoScale, ssh and password keys. If run without arguments, lists all keys. Otherwise list only ssh keys, or only password keys. Password keys with key_group 4 are console keys. When a server is created, it has two keys, one password or ssh key, and one password console key.

Parameters:
  • ssh (bool) – if specified, show ssh keys only (optional)
  • password (bool) – if specified, show password keys only (optional)
  • key_group (int) – if specified, show keys with this key_group only eg key_group=4 for console password keys (optional)
Return type:

list of NodeKey

ex_start_node(node)[source]

start a stopped node

ex_stop_node(node)[source]

stop a running node

features = {'create_node': ['ssh_key']}
list_images()[source]

List available images for deployment

Return type:list of NodeImage
list_locations()[source]

List available zones for deployment

Return type:list of NodeLocation
list_nodes()[source]

List available nodes

Return type:list of Node
list_sizes()[source]

List available sizes containing prices

Return type:list of NodeSize
name = 'NephoScale'
random_password(size=8)[source]
reboot_node(node)[source]

reboot a running node

rename_node(node, name, hostname=None)[source]

rename a cloud server, optionally specify hostname too

type = 'nephoscale'
website = 'http://www.nephoscale.com'
class libcloud.compute.drivers.nephoscale.NephoscaleResponse(response, connection)[source]

Bases: libcloud.common.base.JsonResponse

Nephoscale API Response

Parameters:
parse_error()[source]
success()[source]
class libcloud.compute.drivers.nephoscale.NodeKey(id, name, public_key=None, key_group=None, password=None)[source]

Bases: object

libcloud.compute.drivers.ninefold module

class libcloud.compute.drivers.ninefold.NinefoldNodeDriver(key, secret=None, secure=True, host=None, path=None, port=None, url=None, *args, **kwargs)[source]

Bases: libcloud.compute.drivers.cloudstack.CloudStackNodeDriver

Driver for Ninefold’s Compute platform.

Inherits:

NodeDriver.__init__

Parameters:
  • host (str) – The host where the API can be reached. (required)
  • path (str) – The path where the API can be reached. (required)
  • url (str) – Full URL to the API endpoint. Mutually exclusive with host and path argument.
host = 'api.ninefold.com'
name = 'Ninefold'
path = '/compute/v1.0/'
type = 'ninefold'
website = 'http://ninefold.com/'

libcloud.compute.drivers.opennebula module

OpenNebula.org driver.

class libcloud.compute.drivers.opennebula.ACTION[source]

Bases: object

All actions, except RESUME, only apply when the VM is in the “Running” state.

CANCEL = 'CANCEL'

The VM is forcibly shutdown, its memory state is deleted. If a persistent disk image was used, that disk image is transferred back to the front-end. Any non-persistent disk images are deleted.

DONE = 'DONE'

The VM is forcibly shutdown, its memory state is deleted. If a persistent disk image was used, that disk image is transferred back to the front-end. Any non-persistent disk images are deleted.

REBOOT = 'REBOOT'

Introduced in OpenNebula v3.2.

The VM is gracefully restarted by sending the ACPI signal.

RESUME = 'RESUME'

The VM is resumed using the saved memory state from the checkpoint file, and the VM’s disk image. The VM is either started immediately, or re-scheduled depending on how it was suspended.

SHUTDOWN = 'SHUTDOWN'

The VM is gracefully shutdown by sending the ACPI signal. If the VM does not shutdown, then it is considered to still be running. If successfully, shutdown, its memory state is deleted. If a persistent disk image was used, that disk image is transferred back to the front-end. Any non-persistent disk images are deleted.

STOP = 'STOPPED'

The VM is stopped, and its memory state stored to a checkpoint file. VM state, and disk image, are transferred back to the front-end. Resuming the VM requires the VM instance to be re-scheduled.

SUSPEND = 'SUSPENDED'

The VM is stopped, and its memory state stored to a checkpoint file. The VM state, and disk image, are left on the host to be resumed later. Resuming the VM does not require the VM to be re-scheduled. Rather, after suspending, the VM resources are reserved for later resuming.

class libcloud.compute.drivers.opennebula.OpenNebulaResponse(response, connection)[source]

Bases: libcloud.common.base.XmlResponse

XmlResponse class for the OpenNebula.org driver.

Parameters:
parse_error()[source]

Check if response contains any errors.

@raise: InvalidCredsError

Return type:ElementTree
Returns:Contents of HTTP response body.
success()[source]

Check if response has the appropriate HTTP response code to be a success.

Return type:bool
Returns:True is success, else False.
class libcloud.compute.drivers.opennebula.OpenNebulaConnection(*args, **kwargs)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Connection class for the OpenNebula.org driver. with plain_auth support

add_default_headers(headers)[source]

Add headers required by the OpenNebula.org OCCI interface.

Includes adding Basic HTTP Authorization headers for authenticating against the OpenNebula.org OCCI interface.

Parameters:headers (dict) – Dictionary containing HTTP headers.
Return type:dict
Returns:Dictionary containing updated headers.
host = ''
plain_auth = False
port = (4567, 443)
responseCls

alias of OpenNebulaResponse

secure = True
class libcloud.compute.drivers.opennebula.OpenNebulaNodeSize(id, name, ram, disk, bandwidth, price, driver, cpu=None, vcpu=None)[source]

Bases: libcloud.compute.base.NodeSize

NodeSize class for the OpenNebula.org driver.

class libcloud.compute.drivers.opennebula.OpenNebulaNetwork(id, name, address, size, driver, extra=None)[source]

Bases: object

Provide a common interface for handling networks of all types.

Network objects are analogous to physical switches connecting two or more physical nodes together. The Network object provides the interface in libcloud through which we can manipulate networks in different cloud providers in the same way. Network objects don’t actually do much directly themselves, instead the network driver handles the connection to the network.

You don’t normally create a network object yourself; instead you use a driver and then have that create the network for you.

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver()
>>> network = driver.create_network()
>>> network = driver.list_networks()[0]
>>> network.name
'dummy-1'
get_uuid()[source]

Unique hash for this network.

The hash is a function of an SHA1 hash of the network’s ID and its driver which means that it should be unique between all networks. In some subclasses (e.g. GoGrid) there is no ID available so the public IP address is used. This means that, unlike a properly done system UUID, the same UUID may mean a different system install at a different time

>>> from libcloud.network.drivers.dummy import DummyNetworkDriver
>>> driver = DummyNetworkDriver()
>>> network = driver.create_network()
>>> network.get_uuid()
'd3748461511d8b9b0e0bfa0d4d3383a619a2bb9f'

Note, for example, that this example will always produce the same UUID!

Return type:str
Returns:Unique identifier for this instance.
class libcloud.compute.drivers.opennebula.OpenNebulaNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

OpenNebula.org node driver.

NODE_STATE_MAP = {'FAILED': 2, 'INIT': 3, 'STOPPED': 2, 'SUSPENDED': 3, 'ACTIVE': 0, 'DONE': 2, 'HOLD': 3, 'PENDING': 3}
connectionCls

alias of OpenNebulaConnection

create_node(**kwargs)[source]

Create a new OpenNebula node.

@inherits: NodeDriver.create_node

Parameters:networks (OpenNebulaNetwork or list of OpenNebulaNetwork) – List of virtual networks to which this node should connect. (optional)
destroy_node(node)[source]
ex_list_networks(location=None)[source]

List virtual networks on a provider.

Parameters:location (NodeLocation) – Location from which to request a list of virtual networks. (optional)
Returns:List of virtual networks available to be connected to a compute node.
Return type:list of OpenNebulaNetwork
ex_node_action(node, action)[source]

Build action representation and instruct node to commit action.

Build action representation from the compute node ID, and the action which should be carried out on that compute node. Then instruct the node to carry out that action.

Parameters:
  • node (Node) – Compute node instance.
  • action (str) – Action to be carried out on the compute node.
Returns:

False if an HTTP Bad Request is received, else, True is returned.

Return type:

bool

list_images(location=None)[source]
list_locations()[source]
list_nodes()[source]
list_sizes(location=None)[source]

Return list of sizes on a provider.

@inherits: NodeDriver.list_sizes

Returns:List of compute node sizes supported by the cloud provider.
Return type:list of OpenNebulaNodeSize
name = 'OpenNebula'
type = 'opennebula'
website = 'http://opennebula.org/'
class libcloud.compute.drivers.opennebula.OpenNebula_1_4_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.drivers.opennebula.OpenNebulaNodeDriver

OpenNebula.org node driver for OpenNebula.org v1.4.

name = 'OpenNebula (v1.4)'
class libcloud.compute.drivers.opennebula.OpenNebula_2_0_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.drivers.opennebula.OpenNebulaNodeDriver

OpenNebula.org node driver for OpenNebula.org v2.0 through OpenNebula.org v2.2.

create_node(**kwargs)[source]

Create a new OpenNebula node.

@inherits: NodeDriver.create_node

Parameters:
  • networks (OpenNebulaNetwork or list of OpenNebulaNetwork) – List of virtual networks to which this node should connect. (optional)
  • context (dict) – Custom (key, value) pairs to be injected into compute node XML description. (optional)
Returns:

Instance of a newly created node.

Return type:

Node

destroy_node(node)[source]
list_sizes(location=None)[source]

Return list of sizes on a provider.

@inherits: NodeDriver.list_sizes

Returns:List of compute node sizes supported by the cloud provider.
Return type:list of OpenNebulaNodeSize
name = 'OpenNebula (v2.0 - v2.2)'
class libcloud.compute.drivers.opennebula.OpenNebula_3_0_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.drivers.opennebula.OpenNebula_2_0_NodeDriver

OpenNebula.org node driver for OpenNebula.org v3.0.

ex_node_set_save_name(node, name)[source]

Build action representation and instruct node to commit action.

Build action representation from the compute node ID, the disk image which will be saved, and the name under which the image will be saved upon shutting down the compute node.

Parameters:
  • node (Node) – Compute node instance.
  • name (str) – Name under which the image should be saved after shutting down the compute node.
Returns:

False if an HTTP Bad Request is received, else, True is returned.

Return type:

bool

name = 'OpenNebula (v3.0)'
class libcloud.compute.drivers.opennebula.OpenNebula_3_2_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.drivers.opennebula.OpenNebula_3_0_NodeDriver

OpenNebula.org node driver for OpenNebula.org v3.2.

list_sizes(location=None)[source]

Return list of sizes on a provider.

@inherits: NodeDriver.list_sizes

Returns:List of compute node sizes supported by the cloud provider.
Return type:list of OpenNebulaNodeSize
name = 'OpenNebula (v3.2)'
reboot_node(node)[source]
class libcloud.compute.drivers.opennebula.OpenNebula_3_8_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.drivers.opennebula.OpenNebula_3_6_NodeDriver

OpenNebula.org node driver for OpenNebula.org v3.8.

name = 'OpenNebula (v3.8)'
plain_auth = False

libcloud.compute.drivers.openstack module

OpenStack driver

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

Bases: libcloud.common.openstack.OpenStackResponse

class libcloud.compute.drivers.openstack.OpenStack_1_0_Connection(user_id, key, secure=True, host=None, port=None, timeout=None, ex_force_base_url=None, ex_force_auth_url=None, ex_force_auth_version=None, ex_force_auth_token=None, ex_tenant_name=None, ex_force_service_type=None, ex_force_service_name=None, ex_force_service_region=None)[source]

Bases: libcloud.compute.drivers.openstack.OpenStackComputeConnection

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(*args, **kwargs)[source]

Bases: libcloud.compute.drivers.openstack.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
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(**kwargs)[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]

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 = {'create_node': ['generates_password']}
type = 'openstack'
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_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_1_Response(*args, **kwargs)[source]

Bases: libcloud.common.openstack.OpenStackResponse

class libcloud.compute.drivers.openstack.OpenStack_1_1_Connection(user_id, key, secure=True, host=None, port=None, timeout=None, ex_force_base_url=None, ex_force_auth_url=None, ex_force_auth_version=None, ex_force_auth_token=None, ex_tenant_name=None, ex_force_service_type=None, ex_force_service_name=None, ex_force_service_region=None)[source]

Bases: libcloud.compute.drivers.openstack.OpenStackComputeConnection

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

alias of OpenStack_1_1_Response

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

Bases: libcloud.compute.drivers.openstack.OpenStackNodeDriver

OpenStack node driver.

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_node(**kwargs)[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_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 no de
  • 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 (bool) – 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
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
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()[source]

Create new floating IP

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]

Get a list of NodeNetorks that are available.

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_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_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 no de
  • 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_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 = {'create_node': ['generates_password']}
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]
import_key_pair_from_string(name, key_material)[source]
list_key_pairs()[source]
type = 'openstack'
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 – floating IP to remove

:type ip:OpenStack_1_1_FloatingIpAddress

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_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.OpenStackNodeDriver(*args, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver, libcloud.common.openstack.OpenStackDriverMixin

Base OpenStack node driver. Should not be used directly.

NODE_STATE_MAP = {'RESCUE': 3, 'DELETE_IP': 3, 'PREP_RESIZE': 3, 'DELETED': 2, 'UNKNOWN': 4, 'REBUILD': 3, 'ERROR': 7, 'REBOOT': 1, 'SHUTOFF': 5, 'VERIFY_RESIZE': 0, 'QUEUE_RESIZE': 3, 'BUILD': 3, 'SUSPENDED': 5, 'SHARE_IP': 3, 'ACTIVE': 0, 'SHARE_IP_NO_CONFIG': 3, 'PASSWORD': 3, 'HARD_REBOOT': 1}
api_name = 'openstack'
attach_volume(node, volume, device='auto')[source]
create_volume(size, name, location=None, snapshot=None)[source]
destroy_node(node)[source]
destroy_volume(volume)[source]
detach_volume(volume, ex_node=None)[source]
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
list_locations()[source]
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_volumes()[source]
name = 'OpenStack'
reboot_node(node)[source]
website = 'http://openstack.org/'

libcloud.compute.drivers.opsource module

Opsource Driver

exception libcloud.compute.drivers.opsource.OpsourceAPIException(code, msg, driver)[source]

Bases: libcloud.common.types.LibcloudError

class libcloud.compute.drivers.opsource.OpsourceConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Connection class for the Opsource driver

add_default_headers(headers)[source]
allow_insecure = False
api_path = '/oec'
api_version = '0.9'
get_resource_path()[source]

This method returns a resource path which is necessary for referencing resources that require a full path instead of just an ID, such as networks, and customer snapshots.

host = 'api.opsourcecloud.net'
request(action, params=None, data='', headers=None, method='GET')[source]
request_with_orgId(action, params=None, data='', headers=None, method='GET')[source]
responseCls

alias of OpsourceResponse

class libcloud.compute.drivers.opsource.OpsourceNetwork(id, name, description, location, privateNet, multicast, status)[source]

Bases: object

Opsource network with location.

class libcloud.compute.drivers.opsource.OpsourceNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Opsource node driver.

connectionCls

alias of OpsourceConnection

create_node(**kwargs)[source]

Create a new opsource node

Parameters:
  • name (str) – String with a name for this new node (required)
  • image (NodeImage) – OS Image to boot on node. (required)
  • auth (NodeAuthPassword) – Initial authentication information for the node (required)
  • ex_description (str) – description for this node (required)
  • ex_network (OpsourceNetwork) – Network to create the node within (required)
  • ex_isStarted (bool) – Start server after creation? default true (required)
Returns:

The newly created Node. NOTE: Opsource does not provide a way to determine the ID of the server that was just created, so the returned Node is not guaranteed to be the same one that was created. This is only the case when multiple nodes with the same name exist.

Return type:

Node

destroy_node(node)[source]
ex_get_location_by_id(id)[source]

Get location by ID.

Parameters:id (str) – ID of the node location which should be used
Return type:NodeLocation
ex_list_networks()[source]

List networks deployed across all data center locations for your organization. The response includes the location of each network.

Returns:a list of OpsourceNetwork objects
Return type:list of OpsourceNetwork
ex_power_off(node)[source]

This function will abruptly power-off a server. Unlike ex_shutdown_graceful, success ensures the node will stop but some OS and application configurations may be adversely affected by the equivalent of pulling the power plug out of the machine.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_shutdown_graceful(node)[source]

This function will attempt to “gracefully” stop a server by initiating a shutdown sequence within the guest operating system. A successful response on this function means the system has successfully passed the request into the operating system.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_start_node(node)[source]

Powers on an existing deployed server

Parameters:node (Node) – Node which should be used
Return type:bool
features = {'create_node': ['password']}
list_images(location=None)[source]
return a list of available images
Currently only returns the default ‘base OS images’ provided by opsource. Customer images (snapshots) are not yet supported.

@inherits: NodeDriver.list_images

list_locations()[source]

list locations (datacenters) available for instantiating servers and networks.

@inherits: NodeDriver.list_locations

list_networks(location=None)[source]

List networks deployed across all data center locations for your organization. The response includes the location of each network.

Parameters:location (NodeLocation) – The location
Returns:a list of OpsourceNetwork objects
Return type:list of OpsourceNetwork
list_nodes()[source]
list_sizes(location=None)[source]
name = 'Opsource'
reboot_node(node)[source]
type = 'opsource'
website = 'http://www.opsource.net/'
class libcloud.compute.drivers.opsource.OpsourceResponse(response, connection)[source]

Bases: libcloud.common.base.XmlResponse

Parameters:
parse_error()[source]
class libcloud.compute.drivers.opsource.OpsourceStatus(action=None, requestTime=None, userName=None, numberOfSteps=None, updateTime=None, step_name=None, step_number=None, step_percentComplete=None, failureReason=None)[source]

Bases: object

Opsource API pending operation status class
action, requestTime, username, numberOfSteps, updateTime, step.name, step.number, step.percentComplete, failureReason,

libcloud.compute.drivers.profitbricks module

ProfitBricks Compute driver

class libcloud.compute.drivers.profitbricks.ProfitBricksNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Base ProfitBricks node driver.

AVAILABILITY_ZONE = {'1': {'name': 'AUTO'}, '3': {'name': 'ZONE_2'}, '2': {'name': 'ZONE_1'}}

ProfitBricks is unique in that they allow the user to define all aspects of the instance size, i.e. disk size, core size, and memory size.

These are instance types that match up with what other providers support.

You can configure disk size, core size, and memory size using the ex_ parameters on the create_node method.

NODE_STATE_MAP = {'PAUSE': 5, 'NOSTATE': 4, 'RUNNING': 0, 'CRASHED': 5, 'SHUTOFF': 5, 'SHUTDOWN': 3, 'BLOCKED': 5}
PROFIT_BRICKS_GENERIC_SIZES = {'1': {'disk': 50, 'cores': 1, 'ram': 1024, 'id': '1', 'name': 'Micro'}, '3': {'disk': 50, 'cores': 2, 'ram': 4096, 'id': '3', 'name': 'Medium Instance'}, '2': {'disk': 50, 'cores': 1, 'ram': 2048, 'id': '2', 'name': 'Small Instance'}, '5': {'disk': 50, 'cores': 8, 'ram': 14336, 'id': '5', 'name': 'ExtraLarge Instance'}, '4': {'disk': 50, 'cores': 4, 'ram': 7168, 'id': '4', 'name': 'Large Instance'}, '7': {'disk': 50, 'cores': 8, 'ram': 57344, 'id': '7', 'name': 'Memory Intensive Instance Large'}, '6': {'disk': 50, 'cores': 4, 'ram': 28672, 'id': '6', 'name': 'Memory Intensive Instance Medium'}}

Core Functions

PROVISIONING_STATE = {'AVAILABLE': 0, 'DELETED': 2, 'INACTIVE': 3, 'INPROCESS': 3}
REGIONS = {'1': {'country': 'USA', 'region': 'us/las'}, '3': {'country': 'DEU', 'region': 'de/fkb'}, '2': {'country': 'DEU', 'region': 'de/fra'}}
attach_volume(node, volume, device=None, ex_bus_type=None)[source]

Attaches a volume.

Parameters:
  • volume (StorageVolume) – The volume you’re attaching.
  • node (Node) – The node to which you’re attaching the volume.
  • device (: int) – The device number order.
  • ex_bus_type (str) – Bus type. Either IDE or VIRTIO (default).
Returns:

Instance of class StorageVolume

Return type:

StorageVolume

connectionCls

alias of ProfitBricksConnection

create_node(name, image, size=None, volume=None, ex_datacenter=None, ex_internet_access=True, ex_availability_zone=None, ex_ram=None, ex_cores=None, ex_disk=None, **kwargs)[source]

Creates a node.

image is optional as long as you pass ram, cores, and disk to the method. ProfitBricks allows you to adjust compute resources at a much more granular level.

Parameters:
  • volume (StorageVolume) – If the volume already exists then pass this in.
  • ex_datacenter (Datacenter) – If you’ve already created the DC then pass it in.
  • ex_internet_access (: bool) – Configure public Internet access.
  • ex_availability_zone (class: ProfitBricksAvailabilityZone) – The availability zone.
  • ex_ram (: int) – The amount of ram required.
  • ex_cores (: int) – The number of cores required.
  • ex_disk (: int) – The amount of disk required.
Returns:

Instance of class Node

Return type:

Node

create_volume(size, name=None, ex_datacenter=None, ex_image=None, ex_password=None)[source]

Creates a volume.

Parameters:
  • ex_datacenter (Datacenter) – The datacenter you’re placing the storage in. (req)
  • ex_image (NodeImage) – The OS image for the volume.
  • ex_password (: str) – Optional password for root.
Returns:

Instance of class StorageVolume

Return type:

StorageVolume

destroy_node(node, ex_remove_attached_disks=False)[source]

Destroys a node.

Parameters:
  • node – The node you wish to destroy.
  • ex_remove_attached_disks (: bool) – True to destroy all attached volumes.
Return type:

: bool

destroy_volume(volume)[source]

Destroys a volume.

Parameters:volume (StorageVolume) – The volume you’re attaching.
Return type:: bool
detach_volume(volume)[source]

Detaches a volume.

Parameters:volume (StorageVolume) – The volume you’re detaching.
Return type::bool
ex_clear_datacenter(datacenter)[source]

Clear a datacenter.

This removes all objects in a DC.

Parameters:datacenter (Datacenter) – The DC you’re clearing.
Return type:: bool
ex_create_datacenter(name, location)[source]

Creates a datacenter.

ProfitBricks has a concept of datacenters. These represent buckets into which you can place various compute resources.

Parameters:
  • name (: str) – The DC name.
  • location (: str) – The DC region.
Returns:

Instance of class Datacenter

Return type:

Datacenter

ex_create_network_interface(node, lan_id=None, ip=None, nic_name=None, dhcp_active=True)[source]

Creates a network interface.

Parameters:
  • lan_id (: int) – The ID for the LAN.
  • ip (str) – The IP address for the NIC.
  • nic_name (str) – The name of the NIC, e.g. PUBLIC.
  • dhcp_active (bool) – Set to false to disable.
Returns:

Instance of class ProfitBricksNetworkInterface

Return type:

ProfitBricksNetworkInterface

ex_describe_datacenter(datacenter_id)[source]

Describes a datacenter.

Parameters:datacenter_id (str) – The DC you are describing.
Returns:Instance of class Datacenter
Return type:Datacenter
ex_describe_network_interface(network_interface)[source]

Describes a network interface.

Parameters:network_interface (ProfitBricksNetworkInterface) – The NIC you wish to describe.
Returns:Instance of class ProfitBricksNetworkInterface
Return type:ProfitBricksNetworkInterface
ex_describe_node(node)[source]

Describes a node.

Parameters:node (Node) – The node you wish to describe.
Returns:Instance of class Node
Return type:Node
ex_describe_volume(volume_id)[source]

Describes a volume.

Parameters:volume_id (StorageVolume) – The ID of the volume you’re describing.
Returns:Instance of class StorageVolume
Return type:StorageVolume
ex_destroy_datacenter(datacenter)[source]

Destroys a datacenter.

Parameters:datacenter (Datacenter) – The DC you’re destroying.
Return type:: bool
ex_destroy_network_interface(network_interface)[source]

Destroy a network interface.

Parameters:network_interface (ProfitBricksNetworkInterface) – The NIC you wish to describe.
Return type:: bool
ex_list_availability_zones()[source]

Returns a list of availability zones.

ex_list_datacenters()[source]

Lists all datacenters.

Returns:list of class Datacenter
Return type:Datacenter
ex_list_network_interfaces()[source]

Lists all network interfaces.

Returns:list of class ProfitBricksNetworkInterface
Return type:ProfitBricksNetworkInterface
ex_rename_datacenter(datacenter, name)[source]

Update a datacenter.

Parameters:
  • datacenter (Datacenter) – The DC you are renaming.
  • name (: str) – The DC name.
Return type:

: bool

ex_set_inet_access(datacenter, network_interface, internet_access=True)[source]
ex_start_node(node)[source]

Starts a volume.

Parameters:node (Node) – The node you wish to start.
Return type:: bool
ex_stop_node(node)[source]

Stops a node.

This also dealloctes the public IP space.

Parameters:node (Node) – The node you wish to halt.
Return type:: bool
ex_update_network_interface(network_interface, name=None, lan_id=None, ip=None, dhcp_active=None)[source]

Updates a network interface.

Parameters:
  • lan_id (: int) – The ID for the LAN.
  • ip (str) – The IP address for the NIC.
  • name (str) – The name of the NIC, e.g. PUBLIC.
  • dhcp_active (bool) – Set to false to disable.
Return type:

: bool

ex_update_node(node, name=None, cores=None, ram=None, availability_zone=None)[source]

Updates a node.

Parameters:
  • cores – The number of CPUs the node should have.
  • ram (: int) – The amount of ram the machine should have.
  • ex_availability_zone (ProfitBricksAvailabilityZone) – Update the availability zone.
Return type:

: bool

ex_update_volume(volume, storage_name=None, size=None)[source]

Updates a volume.

Parameters:
  • volume (StorageVolume) – The volume you’re attaching..
  • storage_name (: str) – The name of the volume.
  • size (int) – The desired size.
Return type:

: bool

list_images()[source]

List all images.

Return type:list of NodeImage
list_locations()[source]

List all locations.

list_nodes()[source]

List all nodes.

Return type:list of Node
list_sizes()[source]

Lists all sizes

Return type:list of NodeSize
list_volumes()[source]

Lists all voumes.

name = 'ProfitBricks'
reboot_node(node)[source]

Reboots the node.

Return type:bool
type = 'profitbricks'
website = 'http://www.profitbricks.com'
class libcloud.compute.drivers.profitbricks.Datacenter(id, name, version, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

Class which stores information about ProfitBricks datacenter instances.

Parameters:
  • id (str) – The datacenter ID.
  • name (str) – The datacenter name.
  • version (str) – Datacenter version.

Note: This class is ProfitBricks specific.

class libcloud.compute.drivers.profitbricks.ProfitBricksNetworkInterface(id, name, state, extra=None)[source]

Bases: object

Class which stores information about ProfitBricks network interfaces.

Parameters:
  • id (str) – The network interface ID.
  • name (str) – The network interface name.
  • state (int) – The network interface name.

Note: This class is ProfitBricks specific.

class libcloud.compute.drivers.profitbricks.ProfitBricksAvailabilityZone(name)[source]

Bases: object

Extension class which stores information about a ProfitBricks availability zone.

Note: This class is ProfitBricks specific.

libcloud.compute.drivers.rackspace module

Rackspace driver

class libcloud.compute.drivers.rackspace.RackspaceConnection(*args, **kwargs)[source]

Bases: libcloud.compute.drivers.openstack.OpenStack_1_1_Connection

Connection class for the Rackspace next-gen OpenStack base driver.

auth_url = 'https://auth.api.rackspacecloud.com'
get_endpoint()[source]
class libcloud.compute.drivers.rackspace.RackspaceFirstGenConnection(*args, **kwargs)[source]

Bases: libcloud.compute.drivers.openstack.OpenStack_1_0_Connection

Connection class for the Rackspace first-gen driver.

XML_NAMESPACE = 'http://docs.rackspacecloud.com/servers/api/v1.0'
auth_url = 'https://auth.api.rackspacecloud.com'
cache_busting = True
get_endpoint()[source]
responseCls

alias of OpenStack_1_0_Response

class libcloud.compute.drivers.rackspace.RackspaceFirstGenNodeDriver(key, secret=None, secure=True, host=None, port=None, region='us', **kwargs)[source]

Bases: libcloud.compute.drivers.openstack.OpenStack_1_0_NodeDriver

@inherits: NodeDriver.__init__

Parameters:region (str) – Region ID which should be used
api_name = 'rackspace'
connectionCls

alias of RackspaceFirstGenConnection

list_locations()[source]

Lists available locations

Locations cannot be set or retrieved via the API, but currently there are two locations, DFW and ORD.

@inherits: OpenStack_1_0_NodeDriver.list_locations

name = 'Rackspace Cloud (First Gen)'
type = 'rackspace_first_gen'
website = 'http://www.rackspace.com'
class libcloud.compute.drivers.rackspace.RackspaceNodeDriver(key, secret=None, secure=True, host=None, port=None, region='dfw', **kwargs)[source]

Bases: libcloud.compute.drivers.openstack.OpenStack_1_1_NodeDriver

@inherits: NodeDriver.__init__

Parameters:region (str) – ID of the region which should be used.
connectionCls

alias of RackspaceConnection

name = 'Rackspace Cloud (Next Gen)'
type = 'rackspace'
website = 'http://www.rackspace.com'

libcloud.compute.drivers.rimuhosting module

RimuHosting Driver

class libcloud.compute.drivers.rimuhosting.RimuHostingConnection(key, secure=True)[source]

Bases: libcloud.common.base.ConnectionKey

Connection class for the RimuHosting driver

add_default_headers(headers)[source]
api_context = '/r'
host = 'rimuhosting.com'
port = 443
request(action, params=None, data='', headers=None, method='GET')[source]
responseCls

alias of RimuHostingResponse

exception libcloud.compute.drivers.rimuhosting.RimuHostingException[source]

Bases: exceptions.Exception

Exception class for RimuHosting driver

class libcloud.compute.drivers.rimuhosting.RimuHostingNodeDriver(key, host='rimuhosting.com', port=443, api_context='/r', secure=True)[source]

Bases: libcloud.compute.base.NodeDriver

RimuHosting node driver

Parameters:
  • key (str) – API key (required)
  • host (str) – hostname for connection
  • port (int) – Override port used for connections.
  • api_context (str) – Optional API context.
  • secure (bool) – Weither to use HTTPS or HTTP.
Return type:

None

connectionCls

alias of RimuHostingConnection

create_node(**kwargs)[source]

Creates a RimuHosting instance

@inherits: NodeDriver.create_node

Parameters:
  • name (str) – Must be a FQDN. e.g example.com.
  • ex_billing_oid (str) – If not set, a billing method is automatically picked.
  • ex_host_server_oid (str) – The host server to set the VPS up on.
  • ex_vps_order_oid_to_clone (str) – Clone another VPS to use as the image for the new VPS.
  • ex_num_ips (int) – Number of IPs to allocate. Defaults to 1.
  • ex_extra_ip_reason (str) – Reason for needing the extra IPs.
  • ex_memory_mb (int) – Memory to allocate to the VPS.
  • ex_disk_space_mb (int) – Diskspace to allocate to the VPS. Defaults to 4096 (4GB).
  • ex_disk_space_2_mb (int) – Secondary disk size allocation. Disabled by default.
  • ex_control_panel (str) – Control panel to install on the VPS.
destroy_node(node)[source]
features = {'create_node': ['password']}
list_images(location=None)[source]
list_locations()[source]
list_nodes()[source]
list_sizes(location=None)[source]
name = 'RimuHosting'
reboot_node(node)[source]
type = 'rimuhosting'
website = 'http://rimuhosting.com/'
class libcloud.compute.drivers.rimuhosting.RimuHostingResponse(response, connection)[source]

Bases: libcloud.common.base.JsonResponse

Response Class for RimuHosting driver

Parameters:
parse_body()[source]
success()[source]

libcloud.compute.drivers.serverlove module

ServerLove Driver

class libcloud.compute.drivers.serverlove.ServerLoveConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.compute.drivers.elasticstack.ElasticStackBaseConnection

host = 'api.z1-man.serverlove.com'
class libcloud.compute.drivers.serverlove.ServerLoveNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.drivers.elasticstack.ElasticStackBaseNodeDriver

api_name = 'serverlove'
connectionCls

alias of ServerLoveConnection

features = {'create_node': ['generates_password']}
name = 'ServerLove'
type = 'serverlove'
website = 'http://www.serverlove.com/'

libcloud.compute.drivers.skalicloud module

skalicloud Driver

class libcloud.compute.drivers.skalicloud.SkaliCloudConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.compute.drivers.elasticstack.ElasticStackBaseConnection

host = 'api.sdg-my.skalicloud.com'
class libcloud.compute.drivers.skalicloud.SkaliCloudNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.drivers.elasticstack.ElasticStackBaseNodeDriver

api_name = 'skalicloud'
connectionCls

alias of SkaliCloudConnection

features = {'create_node': ['generates_password']}
name = 'skalicloud'
type = 'skalicloud'
website = 'http://www.skalicloud.com/'

libcloud.compute.drivers.softlayer module

Softlayer driver

class libcloud.compute.drivers.softlayer.SoftLayerConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.xmlrpc.XMLRPCConnection, libcloud.common.base.ConnectionUserAndKey

endpoint = '/xmlrpc/v3'
host = 'api.softlayer.com'
request(service, method, *args, **kwargs)[source]
responseCls

alias of SoftLayerResponse

exception libcloud.compute.drivers.softlayer.SoftLayerException(value, driver=None)[source]

Bases: libcloud.common.types.LibcloudError

Exception class for SoftLayer driver

class libcloud.compute.drivers.softlayer.SoftLayerNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

SoftLayer node driver

Extra node attributes:
  • password: root password
  • hourlyRecurringFee: hourly price (if applicable)
  • recurringFee : flat rate (if applicable)
  • recurringMonths : The number of months in which the recurringFee
will be incurred.
connectionCls

alias of SoftLayerConnection

create_key_pair(name, ex_size=4096)[source]
create_node(**kwargs)[source]

Create a new SoftLayer node

@inherits: NodeDriver.create_node

Parameters:
  • ex_domain (str) – e.g. libcloud.org
  • ex_cpus (int) – e.g. 2
  • ex_disk (int) – e.g. 100
  • ex_ram (int) – e.g. 2048
  • ex_bandwidth (int) – e.g. 100
  • ex_local_disk (bool) – e.g. True
  • ex_datacenter (str) – e.g. Dal05
  • ex_os (str) – e.g. UBUNTU_LATEST
  • ex_keyname (str) – The name of the key pair
delete_key_pair(key_pair)[source]
destroy_node(node)[source]
ex_start_node(node)[source]
ex_stop_node(node)[source]
features = {'create_node': ['generates_password', 'ssh_key']}
get_key_pair(name)[source]
import_key_pair_from_string(name, key_material)[source]
list_images(location=None)[source]
list_key_pairs()[source]
list_locations()[source]
list_nodes()[source]
list_sizes(location=None)[source]
name = 'SoftLayer'
reboot_node(node)[source]
type = 'softlayer'
website = 'http://www.softlayer.com/'
class libcloud.compute.drivers.softlayer.SoftLayerResponse(response, connection)[source]

Bases: libcloud.common.xmlrpc.XMLRPCResponse

Parameters:
defaultExceptionCls

alias of SoftLayerException

exceptions = {'SoftLayer_Account': <class 'libcloud.common.types.InvalidCredsError'>}

libcloud.compute.drivers.vcl module

VCL driver

class libcloud.compute.drivers.vcl.VCLConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.xmlrpc.XMLRPCConnection, libcloud.common.base.ConnectionUserAndKey

add_default_headers(headers)[source]
endpoint = '/index.php?mode=xmlrpccall'
class libcloud.compute.drivers.vcl.VCLNodeDriver(key, secret, secure=True, host=None, port=None, *args, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

VCL node driver

Parameters:
  • host (str) – The VCL host to which you make requests(required)
  • key (str) – API key or username to used (required)
  • secret (str) – Secret password to be used (required)
  • secure (bool) – Weither to use HTTPS or HTTP.
  • host – Override hostname used for connections. (required)
  • port (int) – Override port used for connections.
Return type:

None

NODE_STATE_MAP = {'notready': 3, 'failed': 2, 'loading': 3, 'error': 4, 'success': 3, 'time': 3, 'ready': 0, 'future': 3, 'timedout': 2, 'notavailable': 2}
connectionCls

alias of VCLConnection

create_node(**kwargs)[source]

Create a new VCL reservation size and name ignored, image is the id from list_image

@inherits: NodeDriver.create_node

Parameters:
  • image (str) – image is the id from list_image
  • start (str) – start time as unix timestamp
  • length (str) – length of time in minutes
destroy_node(node)[source]

End VCL reservation for the node passed in. Throws error if request fails.

Parameters:node (Node) – The node to be destroyed
Return type:bool
ex_extend_request_time(node, minutes)[source]

Time in minutes to extend the requested node’s reservation time

Parameters:
  • node (Node) – the reservation node to update
  • minutes (str) – the number of mintes to update
Returns:

true on success, throws error on failure

Return type:

bool

ex_get_request_end_time(node)[source]

Get the ending time of the node reservation.

Parameters:node (Node) – the reservation node to update
Returns:unix timestamp
Return type:int
ex_update_node_access(node, ipaddr)[source]

Update the remote ip accessing the node.

Parameters:
  • node (Node) – the reservation node to update
  • ipaddr (str) – the ipaddr used to access the node
Returns:

node with updated information

Return type:

Node

list_images(location=None)[source]

List images available to the user provided credentials

@inherits: NodeDriver.list_images

list_nodes(ipaddr)[source]

List nodes

Parameters:ipaddr (str) – IP address which should be used
Return type:list of Node
list_sizes(location=None)[source]

VCL does not choosing sizes for node creation. Size of images are statically set by administrators.

@inherits: NodeDriver.list_sizes

name = 'VCL'
type = 'vcl'
website = 'http://incubator.apache.org/vcl/'
class libcloud.compute.drivers.vcl.VCLResponse(response, connection)[source]

Bases: libcloud.common.xmlrpc.XMLRPCResponse

Parameters:
exceptions = {'VCL_Account': <class 'libcloud.common.types.InvalidCredsError'>}

libcloud.compute.drivers.vcloud module

VMware vCloud driver.

class libcloud.compute.drivers.vcloud.Capacity(limit, used, units)[source]

Bases: object

Represents CPU, Memory or Storage capacity of vDC.

class libcloud.compute.drivers.vcloud.ControlAccess(node, everyone_access_level, subjects=None)[source]

Bases: object

Represents control access settings of a node

class AccessLevel[source]

Bases: object

CHANGE = 'Change'
FULL_CONTROL = 'FullControl'
READ_ONLY = 'ReadOnly'
libcloud.compute.drivers.vcloud.DEFAULT_API_VERSION = '0.8'

Valid vCloud API v1.5 input values.

class libcloud.compute.drivers.vcloud.HostingComConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.compute.drivers.vcloud.VCloudConnection

vCloud connection subclass for Hosting.com

host = 'vcloud.safesecureweb.com'
class libcloud.compute.drivers.vcloud.HostingComDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.drivers.vcloud.VCloudNodeDriver

vCloud node driver for Hosting.com

connectionCls

alias of HostingComConnection

class libcloud.compute.drivers.vcloud.InstantiateVAppXML(name, template, net_href, cpus, memory, password=None, row=None, group=None)[source]

Bases: object

tostring()[source]
class libcloud.compute.drivers.vcloud.Instantiate_1_5_VAppXML(name, template, network, vm_network=None, vm_fence=None)[source]

Bases: object

tostring()[source]
class libcloud.compute.drivers.vcloud.Subject(type, name, access_level, id=None)[source]

Bases: object

User or group subject

class libcloud.compute.drivers.vcloud.TerremarkConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.compute.drivers.vcloud.VCloudConnection

vCloud connection subclass for Terremark

host = 'services.vcloudexpress.terremark.com'
class libcloud.compute.drivers.vcloud.TerremarkDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.drivers.vcloud.VCloudNodeDriver

vCloud node driver for Terremark

connectionCls

alias of TerremarkConnection

list_locations()[source]
class libcloud.compute.drivers.vcloud.VCloudConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Connection class for the vCloud driver

add_default_headers(headers)[source]
check_org()[source]
host = None
request(*args, **kwargs)[source]
responseCls

alias of VCloudResponse

token = None
class libcloud.compute.drivers.vcloud.VCloudNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

vCloud node driver

NODE_STATE_MAP = {'1': 3, '0': 3, '3': 3, '2': 3, '4': 0}
connectionCls

alias of VCloudConnection

create_node(**kwargs)[source]

Creates and returns node.

Parameters:
  • ex_network (str) – link to a “Network” e.g., https://services.vcloudexpress...
  • ex_vdc (str) – Name of organisation’s virtual data center where vApp VMs will be deployed.
  • ex_cpus (int) – number of virtual cpus (limit depends on provider)
destroy_node(node)[source]
ex_list_nodes(vdcs=None)[source]

List all nodes across all vDCs. Using ‘vdcs’ you can specify which vDCs should be queried.

Parameters:vdcs (Vdc) – None, vDC or a list of vDCs to query. If None all vDCs will be queried.
Return type:list of Node
features = {'create_node': ['password']}
list_images(location=None)[source]
list_nodes()[source]
list_sizes(location=None)[source]
name = 'vCloud'
networks[source]
org = None
reboot_node(node)[source]
type = 'vcloud'
vdcs[source]

vCloud virtual data centers (vDCs).

Returns:list of vDC objects
Return type:list of Vdc
website = 'http://www.vmware.com/products/vcloud/'
class libcloud.compute.drivers.vcloud.VCloudResponse(response, connection)[source]

Bases: libcloud.common.base.XmlResponse

Parameters:
success()[source]
class libcloud.compute.drivers.vcloud.VCloud_1_5_Connection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.compute.drivers.vcloud.VCloudConnection

add_default_headers(headers)[source]
class libcloud.compute.drivers.vcloud.VCloud_1_5_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.drivers.vcloud.VCloudNodeDriver

NODE_STATE_MAP = {'8': 5, '10': 4, '1': 3, '0': 3, '3': 3, '2': 3, '-1': 4, '4': 0, '7': 4, '6': 4, '9': 4, '5': 0}
connectionCls

alias of VCloud_1_5_Connection

create_node(**kwargs)[source]
Creates and returns node. If the source image is:
  • vApp template - a new vApp is instantiated from template

  • existing vApp - a new vApp is cloned from the source vApp. Can

    not clone more vApps is parallel otherwise resource busy error is raised.

@inherits: NodeDriver.create_node

Parameters:
  • image (NodeImage or Node) – OS Image to boot on node. (required). Can be a NodeImage or existing Node that will be cloned.
  • ex_network (str) – Organisation’s network name for attaching vApp VMs to.
  • ex_vdc (str) – Name of organisation’s virtual data center where vApp VMs will be deployed.
  • ex_vm_names (list of str) – list of names to be used as a VM and computer name. The name must be max. 15 characters long and follow the host name requirements.
  • ex_vm_cpu (int) – number of virtual CPUs/cores to allocate for each vApp VM.
  • ex_vm_memory (int) – amount of memory in MB to allocate for each vApp VM.
  • ex_vm_script (str) – full path to file containing guest customisation script for each vApp VM. Useful for creating users & pushing out public SSH keys etc.
  • ex_vm_network (str) – Override default vApp VM network name. Useful for when you’ve imported an OVF originating from outside of the vCloud.
  • ex_vm_fence (str) – Fence mode for connecting the vApp VM network (ex_vm_network) to the parent organisation network (ex_network).
  • ex_vm_ipmode (str) – IP address allocation mode for all vApp VM network connections.
  • ex_deploy (bool) – set to False if the node shouldn’t be deployed (started) after creation
  • ex_clone_timeout (int) – timeout in seconds for clone/instantiate VM operation. Cloning might be a time consuming operation especially when linked clones are disabled or VMs are created on different datastores. Overrides the default task completion value.
destroy_node(node)[source]
ex_add_vm_disk(vapp_or_vm_id, vm_disk_size)[source]

Adds a virtual disk to the specified VM or VMs under the vApp. If the vapp_or_vm_id param represents a link to an vApp all VMs that are attached to this vApp will be modified.

Parameters:
  • vapp_or_vm_id (str) – vApp or VM ID that will be modified. If a vApp ID is used here all attached VMs will be modified
  • vm_disk_size (int) – the disk capacity in GB that will be added to the specified VM or VMs
Return type:

None

ex_deploy_node(node)[source]

Deploys existing node. Equal to vApp “start” operation.

Parameters:node (Node) – The node to be deployed
Return type:Node
ex_find_node(node_name, vdcs=None)[source]

Searches for node across specified vDCs. This is more effective than querying all nodes to get a single instance.

Parameters:
  • node_name (str) – The name of the node to search for
  • vdcs (Vdc) – None, vDC or a list of vDCs to search in. If None all vDCs will be searched.
Returns:

node instance or None if not found

Return type:

Node or None

ex_get_control_access(node)[source]

Returns the control access settings for specified node.

Parameters:node (Node) – node to get the control access for
Return type:ControlAccess
ex_get_metadata(node)[source]
Parameters:node (Node) – node
Returns:dictionary mapping metadata keys to metadata values
Return type:dictionary mapping str to str
ex_power_off_node(node)[source]

Powers on all VMs under specified node. VMs need to be This operation is allowed only when the vApp/VM is powered on.

Parameters:node (Node) – The node to be powered off
Return type:Node
ex_power_on_node(node)[source]

Powers on all VMs under specified node. This operation is allowed only when the vApp/VM is powered off or suspended.

Parameters:node (Node) – The node to be powered on
Return type:Node
ex_query(type, filter=None, page=1, page_size=100, sort_asc=None, sort_desc=None)[source]

Queries vCloud for specified type. See http://www.vmware.com/pdf/vcd_15_api_guide.pdf for details. Each element of the returned list is a dictionary with all attributes from the record.

Parameters:
  • type (str) – type to query (r.g. user, group, vApp etc.)
  • filter (str) – filter expression (see documentation for syntax)
  • page (int) – page number
  • page_size (int) – page size
  • sort_asc (str) – sort in ascending order by specified field
  • sort_desc (str) – sort in descending order by specified field
Return type:

list of dict

ex_set_control_access(node, control_access)[source]

Sets control access for the specified node.

Parameters:
  • node (Node) – node
  • control_access (ControlAccess) – control access settings
Return type:

None

ex_set_metadata_entry(node, key, value)[source]
Parameters:
  • node (Node) – node
  • key (str) – metadata key to be set
  • value (str) – metadata value to be set
Return type:

None

ex_set_vm_cpu(vapp_or_vm_id, vm_cpu)[source]

Sets the number of virtual CPUs for the specified VM or VMs under the vApp. If the vapp_or_vm_id param represents a link to an vApp all VMs that are attached to this vApp will be modified.

Please ensure that hot-adding a virtual CPU is enabled for the powered on virtual machines. Otherwise use this method on undeployed vApp.

Parameters:
  • vapp_or_vm_id (str) – vApp or VM ID that will be modified. If a vApp ID is used here all attached VMs will be modified
  • vm_cpu (int) – number of virtual CPUs/cores to allocate for specified VMs
Return type:

None

ex_set_vm_memory(vapp_or_vm_id, vm_memory)[source]

Sets the virtual memory in MB to allocate for the specified VM or VMs under the vApp. If the vapp_or_vm_id param represents a link to an vApp all VMs that are attached to this vApp will be modified.

Please ensure that hot-change of virtual memory is enabled for the powered on virtual machines. Otherwise use this method on undeployed vApp.

Parameters:
  • vapp_or_vm_id (str) – vApp or VM ID that will be modified. If a vApp ID is used here all attached VMs will be modified
  • vm_memory (int) – virtual memory in MB to allocate for the specified VM or VMs
Return type:

None

ex_shutdown_node(node)[source]

Shutdowns all VMs under specified node. This operation is allowed only when the vApp/VM is powered on.

Parameters:node (Node) – The node to be shut down
Return type:Node
ex_suspend_node(node)[source]

Suspends all VMs under specified node. This operation is allowed only when the vApp/VM is powered on.

Parameters:node (Node) – The node to be suspended
Return type:Node
ex_undeploy_node(node)[source]

Undeploys existing node. Equal to vApp “stop” operation.

Parameters:node (Node) – The node to be deployed
Return type:Node
list_locations()[source]
reboot_node(node)[source]
class libcloud.compute.drivers.vcloud.VCloud_5_1_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.drivers.vcloud.VCloud_1_5_NodeDriver

class libcloud.compute.drivers.vcloud.Vdc(id, name, driver, allocation_model=None, cpu=None, memory=None, storage=None)[source]

Bases: object

Virtual datacenter (vDC) representation

libcloud.compute.drivers.vcloud.fixxpath(root, xpath)[source]

ElementTree wants namespaces in its xpaths, so here we add them.

libcloud.compute.drivers.vcloud.get_url_path(url)[source]

libcloud.compute.drivers.voxel module

Voxel VoxCloud driver

class libcloud.compute.drivers.voxel.VoxelConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Connection class for the Voxel driver

add_default_params(params)[source]
host = 'api.voxel.net'
responseCls

alias of VoxelResponse

class libcloud.compute.drivers.voxel.VoxelNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Voxel VoxCLOUD node driver

connectionCls

alias of VoxelConnection

create_node(**kwargs)[source]

Create Voxel Node

Parameters:
  • name (str) – the name to assign the node (mandatory)
  • image (NodeImage) – distribution to deploy
  • size (NodeSize) – the plan size to create (mandatory) Requires size.disk (GB) to be set manually
  • location (NodeLocation) – which datacenter to create the node in
  • ex_privateip (str) – Backend IP address to assign to node; must be chosen from the customer’s private VLAN assignment.
  • ex_publicip (str) – Public-facing IP address to assign to node; must be chosen from the customer’s public VLAN assignment.
  • ex_rootpass (str) – Password for root access; generated if unset.
  • ex_consolepass (str) – Password for remote console; generated if unset.
  • ex_sshuser (str) – Username for SSH access
  • ex_sshpass (str) – Password for SSH access; generated if unset.
  • ex_voxel_access (bool) – Allow access Voxel administrative access. Defaults to False.
Return type:

Node or None

destroy_node(node)[source]
features = {'create_node': [], 'list_sizes': ['variable_disk']}
list_images(location=None)[source]
list_locations()[source]
list_nodes()[source]
list_sizes(location=None)[source]
name = 'Voxel VoxCLOUD'
reboot_node(node)[source]
type = 'voxel'
website = 'http://www.voxel.net/'
class libcloud.compute.drivers.voxel.VoxelResponse(response, connection)[source]

Bases: libcloud.common.base.XmlResponse

parse_body()[source]
parse_error()[source]
success()[source]

libcloud.compute.drivers.vpsnet module

VPS.net driver

class libcloud.compute.drivers.vpsnet.VPSNetConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Connection class for the VPS.net driver

add_default_headers(headers)[source]
allow_insecure = False
host = 'api.vps.net'
responseCls

alias of VPSNetResponse

class libcloud.compute.drivers.vpsnet.VPSNetNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

VPS.net node driver

api_name = 'vps_net'
connectionCls

alias of VPSNetConnection

create_node(name, image, size, **kwargs)[source]

Create a new VPS.net node

@inherits: NodeDriver.create_node

Parameters:
  • ex_backups_enabled (bool) – Enable automatic backups
  • ex_fqdn (str) – Fully Qualified domain of the node
destroy_node(node)[source]
list_images(location=None)[source]
list_locations()[source]
list_nodes()[source]
list_sizes(location=None)[source]
name = 'vps.net'
reboot_node(node)[source]
type = 'vpsnet'
website = 'http://vps.net/'
class libcloud.compute.drivers.vpsnet.VPSNetResponse(response, connection)[source]

Bases: libcloud.common.base.JsonResponse

Parameters:
parse_body()[source]
parse_error()[source]
success()[source]

libcloud.compute.drivers.vsphere module

Module contents

Drivers for working with different providers