Dimension Data Cloud Compute Driver Documentation¶
Dimension Data are a global IT Services company and form part of the NTT Group. Dimension Data provide IT-as-a-Service to customers around the globe on their cloud platform (Compute as a Service). The CaaS service is available either on one of the public cloud instances or as a private instance on premises.
CaaS has its own non-standard API , libcloud provides a Python wrapper on top of this API with common methods with other IaaS solutions and Public cloud providers. Therefore, you can use use the Dimension Data libcloud driver to communicate with both the public and private clouds.
Instantiating a driver¶
When you instantiate a driver you need to pass the following arguments to the driver constructor:
user_id
- Your Dimension Data Cloud usernamekey
- Your Dimension Data Cloud passwordregion
- The region key, one of the possible region keys
Possible regions:
dd-na
: Dimension Data North America (USA)dd-eu
: Dimension Data Europedd-af
: Dimension Data Africadd-au
: Dimension Data Australiadd-latam
: Dimension Data Latin Americadd-ap
: Dimension Data Asia Pacificdd-canada
: Dimension Data Canada region
The base libcloud API allows you to:
- list nodes, images, instance types, locations
Non-standard functionality and extension methods¶
The Dimension Data driver exposes some libcloud non-standard functionalities through extension methods and arguments.
These functionalities include:
- start and stop a node
- list networks
For information on how to use these functionalities please see the method docstrings below. You can also use an interactive shell for exploration as shown in the examples.
API Docs¶
-
class
libcloud.compute.drivers.dimensiondata.
DimensionDataNodeDriver
(key, secret=None, secure=True, host=None, port=None, api_version=None, region='dd-na', **kwargs)[source]¶ DimensionData node driver.
-
attach_volume
(node, volume, device=None)¶ Attaches volume to node.
Parameters: - node (
Node
) – Node to attach volume to. - volume (
StorageVolume
) – Volume to attach. - device (
str
) – Where the device is exposed, e.g. ‘/dev/sdb’
Rytpe: bool
- node (
-
connectionCls
¶ alias of
DimensionDataConnection
-
copy_image
(source_region, node_image, name, description=None)¶ Copies an image from a source region to the current region.
Parameters: - source_region (
str
) – Region to copy the node from. - node_image (
NodeImage
:) – NodeImage to copy. - name (
str
) – name for new image. - description – description for new image.
Return type: Returns: NodeImage instance on success.
- source_region (
-
create_image
(node, name, description=None)¶ Creates an image from a node object.
Parameters: - node (
Node
) – Node to run the task on. - name (
description
) – name for new image. - description – description for new image.
Return type: Returns: NodeImage instance on success.
- node (
-
create_key_pair
(name)¶ Create a new key pair object.
Parameters: name ( str
) – Key pair name.
-
create_node
(name, image, auth, ex_description, ex_network=None, ex_network_domain=None, ex_vlan=None, ex_is_started=True, **kwargs)[source]¶ Create a new DimensionData 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 (
DimensionDataNetwork
) – Network to create the node within (required, unless using Network Domain) - ex_network_domain (
DimensionDataNetworkDomain
) – Network Domain to create the node (required unless using network) - ex_vlan (
DimensionDataVlan
) – VLAN to create the node within (required unless using network) - ex_is_started (
bool
) – Start server after creation? default true (required)
Returns: The newly created
Node
.Return type: Node
- name (
-
create_volume
(size, name, location=None, snapshot=None)¶ Create a new volume.
Parameters: - size (
int
) – Size of volume in gigabytes (required) - name (
str
) – Name of the volume to be created - location (
NodeLocation
) – Which data center to create a volume in. If empty, undefined behavior will be selected. (optional) - snapshot (
VolumeSnapshot
) – Snapshot from which to create the new volume. (optional)
Returns: The newly created volume.
Return type: StorageVolume
- size (
-
create_volume_snapshot
(volume, name=None)¶ Creates a snapshot of the storage volume.
Parameters: - volume (
VolumeSnapshot
) – The StorageVolume to create a VolumeSnapshot from - name (str) – Name of created snapshot (optional)
Return type: VolumeSnapshot
- volume (
-
delete_image
(node_image)¶ Deletes a node image from a provider.
Parameters: node_image ( NodeImage
) – Node image object.Returns: True
if delete_image was successful,False
otherwise.Return type: bool
-
delete_key_pair
(key_pair)¶ Delete an existing key pair.
Parameters: key_pair ( KeyPair
) – Key pair object.
-
deploy_node
(**kwargs)¶ Create a new node, and start deployment.
In order to be able to SSH into a created node access credentials are required.
A user can pass either a
NodeAuthPassword
orNodeAuthSSHKey
to theauth
argument. If thecreate_node
implementation supports that kind if credential (as declared inself.features['create_node']
) then it is passed on tocreate_node
. Otherwise it is not passed on tocreate_node
and it is only used for authentication.If the
auth
parameter is not supplied but the driver declares it supportsgenerates_password
then the password returned bycreate_node
will be used to SSH into the server.Finally, if the
ssh_key_file
is supplied that key will be used to SSH into the server.This function may raise a
DeploymentException
, if a create_node call was successful, but there is a later error (like SSH failing or timing out). This exception includes a Node object which you may want to destroy if incomplete deployments are not desirable.>>> from libcloud.compute.drivers.dummy import DummyNodeDriver >>> from libcloud.compute.deployment import ScriptDeployment >>> from libcloud.compute.deployment import MultiStepDeployment >>> from libcloud.compute.base import NodeAuthSSHKey >>> driver = DummyNodeDriver(0) >>> key = NodeAuthSSHKey('...') # read from file >>> script = ScriptDeployment("yum -y install emacs strace tcpdump") >>> msd = MultiStepDeployment([key, script]) >>> def d(): ... try: ... driver.deploy_node(deploy=msd) ... except NotImplementedError: ... print ("not implemented for dummy driver") >>> d() not implemented for dummy driver
Deploy node is typically not overridden in subclasses. The existing implementation should be able to handle most such.
Parameters: - deploy (
Deployment
) – Deployment to run once machine is online and available to SSH. - ssh_username (
str
) – Optional name of the account which is used when connecting to SSH server (default is root) - ssh_alternate_usernames (
list
) – Optional list of ssh usernames to try to connect with if using the default one fails - ssh_port (
int
) – Optional SSH server port (default is 22) - ssh_timeout (
float
) – Optional SSH connection timeout in seconds (default is 10) - auth (
NodeAuthSSHKey
orNodeAuthPassword
) – Initial authentication information for the node (optional) - ssh_key (
str
orlist
ofstr
) – A path (or paths) to an SSH private key with which to attempt to authenticate. (optional) - timeout (
int
) – How many seconds to wait before timing out. (default is 600) - max_tries (
int
) – How many times to retry if a deployment fails before giving up (default is 3) - ssh_interface (
str
) – The interface to wait for. Default is ‘public_ips’, other option is ‘private_ips’.
- deploy (
-
destroy_volume
(volume)¶ Destroys a storage volume.
Parameters: volume ( StorageVolume
) – Volume to be destroyedReturn type: bool
-
destroy_volume_snapshot
(snapshot)¶ Destroys a snapshot.
Parameters: snapshot ( VolumeSnapshot
) – The snapshot to deleteReturn type: bool
-
detach_volume
(volume)¶ Detaches a volume from a node.
Parameters: volume ( StorageVolume
) – Volume to be detachedReturn type: bool
-
ex_create_network_domain
(location, name, service_plan, description=None)[source]¶ Deploy a new network domain to a data center
-
ex_create_vlan
(network_domain, name, private_ipv4_base_address, description=None, private_ipv4_prefix_size='24')[source]¶ Deploy a new VLAN to a network domain
-
ex_expand_vlan
(vlan)[source]¶ Expands the VLAN to the prefix size in private_ipv4_range_size The expansion will not be permitted if the proposed IP space overlaps with an already deployed VLANs IP space.
-
ex_get_location_by_id
(id)[source]¶ Get location by ID.
Parameters: id ( str
) – ID of the node location which should be usedReturn type: NodeLocation
-
ex_list_network_domains
(location=None)[source]¶ List networks deployed across all data center locations for your organization. The response includes the location of each network.
Returns: a list of DimensionDataNetwork objects Return type: list
ofDimensionDataNetwork
-
ex_list_networks
(location=None)[source]¶ List networks deployed across all data center locations for your organization. The response includes the location of each network.
Returns: a list of DimensionDataNetwork objects Return type: list
ofDimensionDataNetwork
-
ex_list_vlans
(location=None, network_domain=None)[source]¶ List VLANs available in a given networkDomain
Returns: a list of DimensionDataVlan objects Return type: list
ofDimensionDataVlan
-
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 usedReturn type: bool
-
ex_reset
(node)[source]¶ This function will abruptly reset a server. Unlike reboot_node, success ensures the node will restart 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 usedReturn 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 usedReturn type: bool
-
ex_start_node
(node)[source]¶ Powers on an existing deployed server
Parameters: node ( Node
) – Node which should be usedReturn type: bool
-
ex_update_vlan
(vlan)[source]¶ Updates the properties of the given VLAN Only name and description are updated
-
get_image
(image_id)¶ Returns a single node image from a provider.
Parameters: image_id ( str
) – Node to run the task on.:rtype
NodeImage
: :return: NodeImage instance on success.
-
get_key_pair
(name)¶ Retrieve a single key pair.
Parameters: name ( str
) – Name of the key pair to retrieve.Return type: KeyPair
-
import_key_pair_from_file
(name, key_file_path)¶ Import a new public key from string.
Parameters: - name (
str
) – Key pair name. - key_file_path (
str
) – Path to the public key file.
Return type: KeyPair
object- name (
-
import_key_pair_from_string
(name, key_material)¶ Import a new public key from string.
Parameters: - name (
str
) – Key pair name. - key_material (
str
) – Public key material.
Return type: KeyPair
object- name (
-
list_images
(location=None)[source]¶ - return a list of available images
- Currently only returns the default ‘base OS images’ provided by DimensionData. 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 locationReturns: a list of DimensionDataNetwork objects Return type: list
ofDimensionDataNetwork
-
list_sizes
(location=None)[source]¶ - return a list of available sizes
- Currently, the size of the node is dictated by the chosen OS base image, they cannot be set explicitly.
@inherits:
NodeDriver.list_sizes
-
list_volume_snapshots
(volume)¶ List snapshots for a storage volume.
Return type: list
ofVolumeSnapshot
-
list_volumes
()¶ List storage volumes.
Return type: list
ofStorageVolume
-
wait_until_running
(nodes, wait_period=3, timeout=600, ssh_interface='public_ips', force_ipv4=True, ex_list_nodes_kwargs=None)¶ Block until the provided nodes are considered running.
Node is considered running when it’s state is “running” and when it has at least one IP address assigned.
Parameters: - nodes (
list
ofNode
) – List of nodes to wait for. - wait_period (
int
) – How many seconds to wait between each loop iteration. (default is 3) - timeout (
int
) – How many seconds to wait before giving up. (default is 600) - ssh_interface (
str
) – Which attribute on the node to use to obtain an IP address. Valid options: public_ips, private_ips. Default is public_ips. - force_ipv4 (
bool
) – Ignore IPv6 addresses (default is True). - ex_list_nodes_kwargs (
dict
) – Optional driver-specific keyword arguments which are passed to thelist_nodes
method.
Returns: [(Node, ip_addresses)]
list of tuple of Node instance and list of ip_address on success.Return type: list
oftuple
- nodes (
-