libcloud.compute.drivers.gandi module

Gandi driver for compute

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

Bases: BaseGandiDriver, NodeDriver

Gandi node driver

@inherits: NodeDriver.__init__

api_name: str = 'gandi'
attach_volume(node, volume, device=None)[source]

Attach a volume to a node.

Parameters:
  • node (Node) – The node to attach the volume to

  • volume (StorageVolume) – The volume to attach.

  • device (None) – Not used in this cloud.

Returns:

True if successful

Return type:

bool

country = 'FR'
create_node(name, size, image, location=None, login=None, password=None, inet_family=4, keypairs=None)[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)

  • keypairs (list of int or KeyPair) – IDs of keypairs or Keypairs object

Return type:

Node

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

Create a volume (disk).

Parameters:
  • size (int) – Size of volume to create (in GB).

  • name (str) – Name of volume to create

  • location (NodeLocation or None) – Location (zone) to create the volume in

  • snapshot (Snapshot) – Snapshot to create image from

Returns:

Storage Volume object

Return type:

StorageVolume

delete_key_pair(key_pair)[source]

Delete an existing key pair.

Parameters:

key_pair (:class.KeyPair` or int) – Key pair object or ID.

Returns:

True of False based on success of Keypair deletion

Return type:

bool

deploy_node(**kwargs)[source]

deploy_node is not implemented for gandi driver

Return type:

bool

destroy_node(node)[source]

Destroy a node.

Parameters:

node (Node) – Node object to destroy

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

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_get_node(node_id)[source]

Return a Node object based on a node id.

Parameters:

name (int) – The ID of the node

Returns:

A Node object for the node

Return type:

Node

ex_get_volume(volume_id)[source]

Return a Volume object based on a volume ID.

Parameters:

volume_id (int) – The ID of the volume

Returns:

A StorageVolume object for the volume

Return type:

StorageVolume

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: Dict[str, List[str]] = {}
List of available features for a driver.
friendly_name = 'Gandi.net'
get_key_pair(name)[source]

Retrieve a single key pair.

Parameters:

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

Return type:

KeyPair

import_key_pair_from_string(name, key_material)[source]

Create a new key pair object.

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

  • key_material (str) – Public key material.

Returns:

Imported key pair object.

Return type:

KeyPair

list_images(location=None)[source]

Return a list of image objects.

Parameters:

location (NodeLocation) – Which data center to filter a images in.

Returns:

List of GCENodeImage objects

Return type:

list of GCENodeImage

list_instance_type(location=None)[source]
list_key_pairs()[source]

List registered key pairs.

Returns:

A list of key par objects.

Return type:

list of libcloud.compute.base.KeyPair

list_locations()[source]

Return a list of locations (datacenters).

Returns:

List of NodeLocation objects

Return type:

list of NodeLocation

list_nodes()[source]

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

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 (NodeLocation or None) – Which data center to filter a sizes in.

Returns:

List of NodeSize objects

Return type:

list of NodeSize

list_volumes()[source]

Return a list of volumes.

Returns:

A list of volume objects.

Return type:

list of StorageVolume

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: Provider | str = 'gandi'
website: str = 'http://www.gandi.net/'