libcloud.compute.drivers.abiquo module
Abiquo Compute Driver
The driver implements the compute Abiquo functionality for the Abiquo API. This version is compatible with the following versions of Abiquo:
Abiquo 3.4 (http://wiki.abiquo.com/display/ABI34/The+Abiquo+API)
- class libcloud.compute.drivers.abiquo.AbiquoNodeDriver(user_id, secret, endpoint, **kwargs)[source]
Bases:
NodeDriver
Implements the
NodeDriver
’s for the Abiquo Compute ProviderInitializes Abiquo Driver
Initializes the
NodeDriver
object and populate the cache.- Parameters:
user_id (
str
) – identifier of Abiquo user (required)secret (
str
) – password of the Abiquo user (required)endpoint (
str
that can be parsed as URL) – Abiquo API endpoint (required)
- AR_MIME_TYPE = 'application/vnd.abiquo.acceptedrequest+xml'
- DCRS_MIME_TYPE = 'application/vnd.abiquo.datacenterrepositories+xml'
- DCR_MIME_TYPE = 'application/vnd.abiquo.datacenterrepository+xml'
- DCS_MIME_TYPE = 'application/vnd.abiquo.datacenters+xml'
- ENT_MIME_TYPE = 'application/vnd.abiquo.enterprise+xml'
- GIGABYTE = 1073741824
- NICS_MIME_TYPE = 'application/vnd.abiquo.nics+xml'
- NODES_MIME_TYPE = 'application/vnd.abiquo.virtualmachines+xml'
- NODE_MIME_TYPE = 'application/vnd.abiquo.virtualmachine+xml'
- USER_MIME_TYPE = 'application/vnd.abiquo.user+xml'
- VAPPS_MIME_TYPE = 'application/vnd.abiquo.virtualappliances+xml'
- VAPP_MIME_TYPE = 'application/vnd.abiquo.virtualappliance+xml'
- VDCS_MIME_TYPE = 'application/vnd.abiquo.virtualdatacenters+xml'
- VDC_MIME_TYPE = 'application/vnd.abiquo.virtualdatacenter+xml'
- VMTPLS_MIME_TYPE = 'application/vnd.abiquo.virtualmachinetemplates+xml'
- VMTPL_MIME_TYPE = 'application/vnd.abiquo.virtualmachinetemplate+xml'
- VM_TASK_MIME_TYPE = 'application/vnd.abiquo.virtualmachinetask+xml'
- connectionCls
alias of
AbiquoConnection
- create_node(image, name=None, size=None, location=None, ex_group_name=None)[source]
Create a new node instance in Abiquo
All the
Node`s need to be defined inside a VirtualAppliance (called :class:`NodeGroup
here). If there is no group name defined, ‘libcloud’ name will be used instead.This method wraps these Abiquo actions:
Create a group if it does not exist.
Register a new node in the group.
Deploy the node and boot it.
Retrieves it again to get schedule-time attributes (such as ips and vnc ports).
The rest of the driver methods has been created in a way that, if any of these actions fail, the user can not reach an inconsistent state
- Parameters:
name (
str
) – The name for this new node (required)size (
NodeSize
) – The size of resources allocated to this node.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)ex_group_name (c{str}) – Which group this node belongs to. If empty, it will be created into ‘libcloud’ group. If it does not found any group in the target location (random location if you have not set the parameter), then it will create a new group with this name.
- Returns:
The newly created node.
- Return type:
Node
- destroy_node(node)[source]
Destroy a node
Depending on the provider, this may destroy all data associated with the node, including backups.
- Parameters:
node (
Node
) – The node to be destroyed- Returns:
True if the destroy was successful, otherwise False
- Return type:
bool
- ex_create_group(name, location=None)[source]
Create an empty group.
You can specify the location as well.
- Parameters:
group (
str
) – name of the group (required)location (
NodeLocation
) – location were to create the group
- Returns:
the created group
- Return type:
- ex_destroy_group(group)[source]
Destroy a group.
Be careful! Destroying a group means destroying all the
Node
instances there and the group itself!If there is currently any action over any
Node
of theNodeGroup
, then the method will raise an exception.- Parameters:
name (
NodeGroup
) – The group (required)- Returns:
If the group was destroyed successfully
- Return type:
bool
- ex_list_groups(location=None)[source]
List all groups.
- Parameters:
location (a
NodeLocation
instance.) – filter the groups by location (optional)- Returns:
the list of
NodeGroup
- ex_populate_cache()[source]
Populate the cache.
For each connection, it is good to store some objects that will be useful for further requests, such as the ‘user’ and the ‘enterprise’ objects.
Executes the ‘login’ resource after setting the connection parameters and, if the execution is successful, it sets the ‘user’ object into cache. After that, it also requests for the ‘enterprise’ and ‘locations’ data.
List of locations should remain the same for a single libcloud connection. However, this method is public and you are able to refresh the list of locations any time.
- ex_run_node(node)[source]
Runs a node
Here there is a bit difference between Abiquo states and libcloud states, so this method is created to have better compatibility. In libcloud, if the node is not running, then it does not exist (avoiding UNKNOWN and temporal states). In Abiquo, you can define a node, and then deploy it.
If the node is in
NodeState.TERMINATED
libcloud’s state and in ‘NOT_DEPLOYED’ Abiquo state, there is a way to run and recover it for libcloud using this method. There is no way to reach this state if you are using only libcloud, but you may have used another Abiquo client and now you want to recover your node to be used by libcloud.- Parameters:
node (
Node
) – The node to run- Returns:
The node itself, but with the new state
- Return type:
Node
- list_images(location=None)[source]
List images on Abiquo Repositories
- Parameters:
location (
NodeLocation
) – The location to list images for.- Returns:
list of node image objects
- Return type:
list
ofNodeImage
- list_locations()[source]
Return list of locations where the user has access to.
- Returns:
the list of
NodeLocation
available for the current user- Return type:
list
ofNodeLocation
- list_nodes(location=None)[source]
List all nodes.
- Parameters:
location (a
NodeLocation
instance.) – Filter the groups by location (optional)- Returns:
List of node objects
- Return type:
list
ofNode
- list_sizes(location=None)[source]
List sizes on a provider.
Abiquo does not work with sizes. However, this method returns a list of predefined ones (copied from
DummyNodeDriver
but without price neither bandwidth) to help the users to create their own.If you call the method
AbiquoNodeDriver.create_node
with the size informed, it will just override the ‘ram’ value of the ‘image’ template. So it is no too much useful work with sizes…- Returns:
The list of sizes
- Return type:
list
ofNodeSizes
- reboot_node(node)[source]
Reboot a node.
- Parameters:
node (
Node
) – The node to be rebooted- Returns:
True if the reboot was successful, otherwise False
- Return type:
bool
- timeout = 2000
- class libcloud.compute.drivers.abiquo.NodeGroup(driver, name='libcloud', nodes=[], uri='')[source]
Bases:
object
Group of virtual machines that can be managed together
All
Node`s in Abiquo must be defined inside a Virtual Appliance. We offer a way to handle virtual appliances (called NodeGroup to maintain some kind of name conventions here) inside the :class:`AbiquoNodeDriver
without breaking compatibility of the rest of libcloud API.If the user does not want to handle groups, all the virtual machines will be created inside a group named ‘libcloud’
Initialize a new group object.
- DEFAULT_GROUP_NAME = 'libcloud'
- destroy()[source]
Destroys the group delegating the execution to
AbiquoNodeDriver
.