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__
- attach_volume(node, volume, device=None)[source]
Attach a volume to a node.
- Parameters:
node (
Node
) – The node to attach the volume tovolume (
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
orKeyPair
) – 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 createlocation (
NodeLocation
orNone
) – Location (zone) to create the volume insnapshot (
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
- 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 usedvolume (
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_interfaces()[source]
Specific method to list network interfaces
- Return type:
list
ofGandiNetworkInterface
- ex_node_attach_disk(node, disk)[source]
Specific method to attach a disk to a node
- Parameters:
node (
Node
) – Node which should be useddisk (
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 usediface (
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 useddisk (
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 usediface (
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 usedname (
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 usednew_size (
int
) – New sizenew_name (
str
) – New name
- Return type:
bool
- features: Dict[str, List[str]] = {}
- List of available features for a driver.
libcloud.compute.base.NodeDriver.create_node()
ssh_key: Supports
NodeAuthSSHKey
as an authentication method for nodes.password: Supports
NodeAuthPassword
as an authentication method for nodes.generates_password: Returns a password attribute on the Node object returned from creation.
- 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:
- 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:
- 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
ofGCENodeImage
- list_key_pairs()[source]
List registered key pairs.
- Returns:
A list of key par objects.
- Return type:
list
oflibcloud.compute.base.KeyPair
- list_locations()[source]
Return a list of locations (datacenters).
- Returns:
List of NodeLocation objects
- Return type:
list
ofNodeLocation
- list_nodes()[source]
Return a list of nodes in the current zone or all zones.
- Returns:
List of Node objects
- Return type:
list
ofNode
- list_sizes(location=None)[source]
Return a list of sizes (machineTypes) in a zone.
- Parameters:
location (
NodeLocation
orNone
) – Which data center to filter a sizes in.- Returns:
List of NodeSize objects
- Return type:
list
ofNodeSize
- list_volumes()[source]
Return a list of volumes.
- Returns:
A list of volume objects.
- Return type:
list
ofStorageVolume