libcloud.compute.drivers.gig_g8 module

GiG G8 Driver

class libcloud.compute.drivers.gig_g8.G8Network(id, name, cidr, publicipaddress, driver, extra=None)[source]

Bases: UuidMixin

G8 Network object class.

This class maps to a cloudspace

property cidr

Cidr is not part of the list result we will lazily fetch it with a get request

create_portforward(node, publicport, privateport, protocol='tcp')[source]
destroy()[source]
list_nodes()[source]
list_portforwards()[source]
class libcloud.compute.drivers.gig_g8.G8NodeDriver(user_id, key, api_url)[source]

Bases: NodeDriver

GiG G8 node driver

Parameters:
  • key (str) – Token to use for api (jwt)

  • user_id (int) – Id of the account to connect to (accountId)

  • api_url (str) – G8 api url

Return type:

None

NODE_STATE_MAP: Dict[str, NodeState] = {'ADDING_DISK': NodeState.RECONFIGURING, 'ATTACHING_DISK': NodeState.RECONFIGURING, 'ATTACHING_NIC': NodeState.RECONFIGURING, 'CHANGING_DISK_LIMITS': NodeState.RECONFIGURING, 'CLONING': NodeState.PENDING, 'CREATING_TEMPLATE': NodeState.PENDING, 'DELETED': NodeState.TERMINATED, 'DELETING': NodeState.TERMINATED, 'DELETING_DISK': NodeState.RECONFIGURING, 'DEPLOYING': NodeState.PENDING, 'DESTROYED': NodeState.TERMINATED, 'DESTROYING': NodeState.TERMINATED, 'DETACHING_DISK': NodeState.RECONFIGURING, 'DETTACHING_NIC': NodeState.RECONFIGURING, 'ERROR': NodeState.ERROR, 'HALTED': NodeState.STOPPED, 'MOVING': NodeState.MIGRATING, 'PAUSED': NodeState.PAUSED, 'PAUSING': NodeState.PENDING, 'RESETTING': NodeState.REBOOTING, 'RESIZING': NodeState.RECONFIGURING, 'RESTORING': NodeState.PENDING, 'RESUMING': NodeState.PENDING, 'RUNNING': NodeState.RUNNING, 'STARTING': NodeState.STARTING, 'STOPPING': NodeState.STOPPING, 'VIRTUAL': NodeState.PENDING}
attach_volume(node, volume)[source]

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

connectionCls

alias of G8Connection

create_node(name, image, ex_network, ex_description, size=None, auth=None, ex_create_attr=None, ex_expose_ssh=False)[source]

Create a node.

The ex_create_attr parameter can include the following dictionary key and value pairs:

  • memory: int Memory in MiB

    (only used if size is None and vcpus is passed

  • vcpus: int Amount of vcpus

    (only used if size is None and memory is passed)

  • disk_size: int Size of bootdisk

    defaults to minimumsize of the image

  • user_data: str for cloud-config data

  • private_ip: str Private Ip inside network

  • data_disks: list(int) Extra data disks to assign

    to vm list of disk sizes in GiB

Parameters:
  • name (str) – the name to assign the vm

  • size (: str) – the plan size to create mutual exclusive with memory vcpus

  • image (NodeImage) – which distribution to deploy on the vm

  • network – G8 Network to place vm in

  • ex_description – Description of vm

  • auth (NodeAuthSSHKey) – an SSH key

  • ex_create_attr (dict) – A dictionary of optional attributes for vm creation

  • ex_expose_ssh (int) – Create portforward for ssh port

Returns:

The newly created node.

Return type:

Node

create_volume(size, name, ex_description, ex_disk_type='D')[source]

Create volume

Parameters:
  • size (int) – Size of the volume to create in GiB

  • name (str) – Name of the volume

  • description (str) – Description of the volume

  • disk_type (str) – Type of the disk depending on the G8 D for datadisk is always available

Return type:

class:StorageVolume

destroy_node(node)[source]

Destroy node

destroy_volume(volume)[source]

Destroys a storage volume.

Parameters:

volume (StorageVolume) – Volume to be destroyed

Return type:

bool

detach_volume(node, volume)[source]

Detaches a volume from a node.

Parameters:

volume (StorageVolume) – Volume to be detached

Return type:

bool

ex_create_network(name, private_network='192.168.103.0/24', type='vgw')[source]

Create network also known as cloudspace

Parameters:
  • name (str) – the name to assign to the network

  • private_network (str) – subnet used as private network

  • type (str) – type of the gateway vgw or routeros

ex_create_portforward(network, node, publicport, privateport, protocol='tcp')[source]
ex_delete_portforward(portforward)[source]
ex_destroy_network(network)[source]
ex_expose_ssh_node(node)[source]

Create portforward for ssh purposed

Parameters:

node (Node) – Node to expose ssh for

Return type:

int

ex_list_networks()[source]

Return the list of networks.

Returns:

A list of network objects.

Return type:

list of G8Network

ex_list_portforwards(network)[source]
list_images()[source]

Returns a list of images as a cloud provider might have

@inherits: NodeDriver.list_images

list_nodes(ex_network=None)[source]

List the nodes known to a particular driver; There are two default nodes created at the beginning

list_sizes()[source]

Returns a list of node sizes as a cloud provider might have

list_volumes()[source]

List storage volumes.

Return type:

list of StorageVolume

name: str = 'GiG G8 Node Provider'
reboot_node(node)[source]

Reboot node returns True as if the reboot had been successful.

start_node(node)[source]

Start virtual machine

stop_node(node)[source]

Stop virtual machine

type: Provider | str = 'gig_g8'
website: str = 'https://gig.tech'
class libcloud.compute.drivers.gig_g8.G8PortForward(network, node_id, publicport, privateport, protocol, driver)[source]

Bases: UuidMixin

destroy()[source]
exception libcloud.compute.drivers.gig_g8.G8ProvisionError[source]

Bases: Exception