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
) – uuidfamily (
str
) – family of ip (v4 or v6)prefix (
str
) – prefix of ipip_address (
str
) – Ip addresscreate_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
) – uuidname (
str
) – Name of Networkstatus (
str
) – Network statusrelations (
object
) – object related to networkcreate_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
- 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_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
ofstr
) – List of SSH key IDs to add to the server.
- Returns:
The newly created Node.
- Return type:
- 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:
- 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:
- 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:
- 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:
- 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, otherwiseFalse
- Return type:
bool
- ex_link_ip_to_node(node, ip)[source]¶
links a existing ip with a node
- Parameters:
node (
object
) – node objectip (
object
) – ip object
- Returns:
Request ID
- Return type:
str
- ex_link_isoimage_to_node(node, isoimage)[source]¶
link and isoimage to a node
- Parameters:
node (
object
) – Node you want to link the iso image toisoimage (
object
) – isomiage you want to link
- Returns:
None -> success
- Return type:
None
- ex_link_network_to_node(node, network)[source]¶
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, otherwiseFalse
- Return type:
bool
- ex_list_ips()[source]¶
Lists all IPs available.
- Returns:
List of IP objects.
- Return type:
list
ofGridscaleIp
- ex_list_ips_for_node(node)[source]¶
Return a list of associated IPs for the provided node.
- Rype:
list
ofGridscaleIp
- ex_list_networks()[source]¶
List all networks.
- Returns:
List of objects.
- Return type:
list
ofGridscaleNetwork
- ex_list_volumes_for_node(node)[source]¶
Return a list of associated volumes for the provided node.
- Return type:
list
ofStorageVolume
- ex_rename_network(network, name)[source]¶
Modify networks name.
- Parameters:
network (
GridscaleNetwork
) – Network.name (
str
) – New network name.
- Returns:
True
orFalse
- Return type:
bool
- ex_rename_node(node, name)[source]¶
Modify node name.
- Parameters:
name (
str
) – New node name.node (
Node
) – Node
- Returns:
True
orFalse
- 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
orFalse
- Return type:
bool
- ex_storage_rollback(volume, snapshot, rollback)[source]¶
initiate a rollback on your storage
- Parameters:
volume (
string
) – storage uuidsnapshot (
string
) – snapshot uuidrollback (
bool
) – variable
- Returns:
RequestID
- Return type:
str
- ex_unlink_ip_from_node(node, ip)[source]¶
unlink ips from server
- Parameters:
node (
object
) – node you want to unlink the ip fromip (
object
) – the ip you want to unlink
- Returns:
None -> success
- Return type:
None
- ex_unlink_isoimage_from_node(node, isoimage)[source]¶
unlink isoimages from server
- Parameters:
node (
object
) – node you want to unlink the image fromisoimage (
object
) – isoimage you want to unlink
- Returns:
None -> success
- Return type:
None
- features: Dict[str, List[str]] = {'create_node': ['ssh_key']}¶
- 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.
- 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:
- 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
ofNodeImage
- list_locations()[source]¶
List all available data centers.
- Returns:
List of node location objects
- Return type:
list
ofNodeLocation
- 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
ofVolumeSnapshot
- list_volumes()[source]¶
List all volumes.
- Returns:
List of StorageVolume object
- Return type:
list
ofStorageVolume
- 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