libcloud.compute.drivers.gridscale module

class libcloud.compute.drivers.gridscale.GridscaleIp(id, family, prefix, create_time, address, extra=None)[source]

Bases: object

Ip Object

Parameters:
  • id (str) – uuid

  • family (str) – family of ip (v4 or v6)

  • prefix (str) – prefix of ip

  • ip_address (str) – Ip address

  • create_time (str) – Time ip was created

class libcloud.compute.drivers.gridscale.GridscaleNetwork(id, name, status, create_time, relations)[source]

Bases: object

Network Object

Parameters:
  • id (str) – uuid

  • name (str) – Name of Network

  • status (str) – Network status

  • relations (object) – object related to network

  • create_time (str) – Time Network was created

class libcloud.compute.drivers.gridscale.GridscaleNodeDriver(user_id, key, **kwargs)[source]

Bases: GridscaleBaseDriver, NodeDriver

create and entry in libcloud/compute/providers for gridscale

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

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

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

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

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

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

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

Return type:

None

api_name: str = 'gridscale'
attach_volume(node, volume)[source]

Attaches volume to node.

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

  • volume (StorageVolume) – Volume to attach.

Rytpe:

bool

connectionCls

alias of GridscaleConnection

create_image(node, name)[source]

Creates an image from a node object.

Parameters:
  • node (Node) – Node to run the task on.

  • name (str) – Name for new image.

Returns:

NodeImage.

Return type:

NodeImage

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

Create a simple node with a name, cores, memory at the designated location.

Parameters:
  • name (str) – Name of the server.

  • size (NodeSize) – Nodesize object.

  • image (GridscaleTemplate) – OS image to attach to the storage.

  • location (NodeLocation) – The data center to create a node in.

  • ex_ssh_key_ids (list of str) – List of SSH key IDs to add to the server.

Returns:

The newly created Node.

Return type:

Node

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

Create a new volume.

Parameters:
  • size (int) – Integer in GB.

  • name (str) – Name of the volume.

  • location (NodeLocation) – The server location.

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

Returns:

Newly created StorageVolume.

Return type:

StorageVolume

create_volume_snapshot(volume, name)[source]

Creates a snapshot of the current state of your volume, you can rollback to.

Parameters:
  • volume (StorageVolume) – Volume you want to create a snapshot of.

  • name (str) – Name of the snapshot.

Returns:

VolumeSnapshot.

Return type:

VolumeSnapshot

delete_image(node_image)[source]

Destroy an image.

Parameters:

node_image (NodeImage) – Node image object.

Returns:

True if the destroy was successful, otherwise False

Return type:

bool

destroy_node(node, ex_destroy_associated_resources=False)[source]

Destroy node.

Parameters:
  • node (Node) – Node object.

  • ex_destroy_associated_resources – True to destroy associated

resources such as storage volumes and IPs. :type ex_destroy_associated_resources: bool

Returns:

True if the destroy was successful, otherwise False.

Return type:

bool

destroy_volume(volume)[source]

Delete volume.

Parameters:

volume (StorageVolume) – Volume to be destroyed.

Returns:

True if the destroy was successful, otherwise False.

Return type:

bool

destroy_volume_snapshot(snapshot)[source]

Destroy a snapshot.

Parameters:

snapshot (:class:'.VolumeSnapshot`) – The snapshot to delete.

Returns:

True if the destroy was successful, otherwise False.

Return type:

bool

detach_volume(volume)[source]

Detaches a volume from a node.

Parameters:

volume (StorageVolume) – Volume to be detached

Return type:

bool

ex_create_ip(family, location, name)[source]

Create either an ip_v4 ip or a ip_v6.

Parameters:
  • family (int) – Defines if the ip is v4 or v6 with int 4 or int 6.

  • location (NodeLocation) – Defines which datacenter the created ip responds with.

  • name (str) – Name of your Ip.

Returns:

Ip

Return type:

GridscaleIp

ex_create_networks(name, location)[source]

Create a network at the data center location.

Parameters:
  • name (str) – Name of the network.

  • location (NodeLocation) – Location.

Returns:

Network.

Return type:

GridscaleNetwork

ex_destroy_ip(ip)[source]

Delete an ip.

Parameters:

ip (GridscaleIp) – IP object.

Returns:

True if delete_image was successful, False otherwise.

Return type:

bool

ex_destroy_network(network)[source]

Delete network.

Parameters:

network (GridscaleNetwork) – Network object.

Returns:

True if destroyed successfully, otherwise False

Return type:

bool

links a existing ip with a node

Parameters:
  • node (object) – node object

  • ip (object) – ip object

Returns:

Request ID

Return type:

str

link and isoimage to a node

Parameters:
  • node (object) – Node you want to link the iso image to

  • isoimage (object) – isomiage you want to link

Returns:

None -> success

Return type:

None

Link a network to a node.

Parameters:
  • node (Node) – Node object to link networks to.

  • network (GridscaleNetwork) – Network you want to link.

Returns:

True if linked successfully, otherwise False

Return type:

bool

ex_list_ips()[source]

Lists all IPs available.

Returns:

List of IP objects.

Return type:

list of GridscaleIp

ex_list_ips_for_node(node)[source]

Return a list of associated IPs for the provided node.

Rype:

list of GridscaleIp

ex_list_networks()[source]

List all networks.

Returns:

List of objects.

Return type:

list of GridscaleNetwork

ex_list_volumes_for_node(node)[source]

Return a list of associated volumes for the provided node.

Return type:

list of StorageVolume

ex_rename_network(network, name)[source]

Modify networks name.

Parameters:
Returns:

True or False

Return type:

bool

ex_rename_node(node, name)[source]

Modify node name.

Parameters:
  • name (str) – New node name.

  • node (Node) – Node

Returns:

True or False

Return type:

bool

ex_rename_volume(volume, name)[source]

Modify storage volume name

Parameters:
  • volume (:class:.`StorageVolume`) – Storage.

  • name (str) – New storage name.

Returns:

True or False

Return type:

bool

ex_start_node(node)[source]
ex_storage_rollback(volume, snapshot, rollback)[source]

initiate a rollback on your storage

Parameters:
  • volume (string) – storage uuid

  • snapshot (string) – snapshot uuid

  • rollback (bool) – variable

Returns:

RequestID

Return type:

str

unlink ips from server

Parameters:
  • node (object) – node you want to unlink the ip from

  • ip (object) – the ip you want to unlink

Returns:

None -> success

Return type:

None

unlink isoimages from server

Parameters:
  • node (object) – node you want to unlink the image from

  • isoimage (object) – isoimage you want to unlink

Returns:

None -> success

Return type:

None

Unlink network from node.

Parameters:
  • node (Node) – Node you want to unlink from network.

  • network (:class:`.GridscaleNetwork) – Network you want to unlink.

Returns:

True if unlink was successful, otherwise False

Return type:

bool

features: Dict[str, List[str]] = {'create_node': ['ssh_key']}
List of available features for a driver.
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

import_key_pair_from_string(name, key_material)[source]

Import a new public key from string.

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

  • key_material (str) – Public key material.

Return type:

KeyPair object

list_images()[source]

List images.

Returns:

List of node image objects

Return type:

list of NodeImage

list_key_pairs()[source]

List all the available key pair objects.

Return type:

``list``of KeyPair objects

list_locations()[source]

List all available data centers.

Returns:

List of node location objects

Return type:

list of NodeLocation

list_nodes()[source]

List all nodes.

Returns:

List of node objects

Return type:

list of Node

list_volume_snapshots(volume)[source]

Lists all snapshots for storage volume.

Parameters:

volume (StorageVolume) – storage the snapshot is attached to

Returns:

Snapshots

Return type:

list of VolumeSnapshot

list_volumes()[source]

List all volumes.

Returns:

List of StorageVolume object

Return type:

list of StorageVolume

name: str = 'Gridscale'
reboot_node(node, ex_sleep_interval=3)[source]

Reboot a node.

Parameters:
  • node (Node) – Node object.

  • ex_sleep_interval (int) – time to let the shutdown process finish

Returns:

True if the reboot was successful, otherwise False.

Return type:

bool

start_node(node)[source]

Start a node.

Parameters:

node (Node) – The node to be started

Returns:

True if the start was successful, otherwise False

Return type:

bool

type: Provider | str = 'gridscale'
website: str = 'https://gridscale.io'