l.c.d.a.AbiquoNodeDriver(NodeDriver) : class documentation

Part of libcloud.compute.drivers.abiquo View Source View In Hierarchy

Implements the L{NodeDriver}'s for the Abiquo Compute Provider
Method __init__ Initializes Abiquo Driver
Method create_node Create a new node instance in Abiquo
Method destroy_node Destroy a node
Method ex_run_node Runs a node
Method ex_set_context Generates the context
Method ex_create_group Create an empty group.
Method ex_destroy_group Destroy a group.
Method ex_list_groups List all groups.
Method list_images List images on Abiquo Repositories
Method list_locations Return list of locations where the user has access to.
Method list_nodes List all nodes.
Method list_sizes List sizes on a provider.
Method reboot_node Reboot a node.
Method _ex_connection_class_kwargs Set the endpoint as an extra L{AbiquoConnection} argument.
Method _deploy_remote Asynchronous call to create the node.
Method _to_location Generates the L{NodeLocation} class.
Method _to_node Generates the L{Node} class.
Method _to_nodeimage Generates the L{NodeImage} class.
Method _get_locations Returns the locations as a generator.
Method _get_enterprise_id Returns the identifier of the logged user's enterprise.
Method _define_create_node_location Search for a location where to create the node.
Method _define_create_node_group Search for a group where to create the node.
Method _define_create_node_node Defines the node before to create.

Inherited from NodeDriver:

Method deploy_node Create a new node, and start deployment.
Method create_volume Create a new volume.
Method destroy_volume Destroys a storage volume.
Method attach_volume Attaches volume to node.
Method detach_volume Detaches a volume from a node.
Method wait_until_running Block until the given nodes are fully booted and have an IP address assigned.
Method _wait_until_running Undocumented
Method _ssh_client_connect Try to connect to the remote SSH server. If a connection times out or is refused it is retried up to timeout number of seconds.
Method _connect_and_run_deployment_script Undocumented
Method _run_deployment_script Run the deployment script on the provided node. At this point it is assumed that SSH connection has already been established.
Method _get_size_price Undocumented
def __init__(self, user_id, secret, endpoint, **kwargs): (source)
Initializes Abiquo Driver

Initializes the L{NodeDriver} object. After that, it generates the
context

@param       user_id: identifier of Abiquo user (required)
@type        user_id: C{str}
@param       secret: password of the Abiquo user (required)
@type        secret: C{str}
@param       endpoint: Abiquo API endpoint (required)
@type        endpoint: C{str} that can be parsed as URL
def create_node(self, **kwargs): (source)
Create a new node instance in Abiquo

All the L{Node}s need to be defined inside a VirtualAppliance
(called L{NodeGroup} here). If there is no group name defined,
'libcloud' name will be used instead.

This method wraps these Abiquo actions:

    1. Create a group if it does not exist.
    2. Register a new node in the group.
    3. Deploy the node and boot it.
    4. 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

@keyword    name:   The name for this new node (required)
@type       name:   C{str}

@keyword    size:   The size of resources allocated to this node.
@type       size:   L{NodeSize}

@keyword    image:  OS Image to boot on node. (required)
@type       image:  L{NodeImage}

@keyword    location: Which data center to create a node in. If empty,
                      undefined behavoir will be selected. (optional)
@type       location: L{NodeLocation}

@keyword    auth:   Initial authentication information for the node
                    (optional)
@type       auth:   L{NodeAuthPassword}

@keyword   group_name:  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.
@type     group_name:  c{str}

@return:               The newly created node.
@rtype:                L{Node}
def destroy_node(self, node): (source)
Destroy a node

Depending on the provider, this may destroy all data associated with
the node, including backups.

@param node: The node to be destroyed
@type node: L{Node}

@return: True if the destroy was successful, otherwise False
@rtype: C{bool}
def ex_run_node(self, 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 L{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.

@param node: The node to run
@type node: L{Node}

@return: The node itself, but with the new state
@rtype: L{Node}
def ex_set_context(self): (source)
Generates the context

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
context. 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.
def ex_create_group(self, name, location=None): (source)
Create an empty group.

You can specify the location as well.

@param     name:     name of the group (required)
@type      name:     C{str}

@param     location: location were to create the group
@type      location: L{NodeLocation}

@returns:            the created group
@rtype:              L{NodeGroup}
def ex_destroy_group(self, group): (source)
Destroy a group.

Be careful! Destroying a group means destroying all the L{Node}s there
and the group itself!

If there is currently any action over any L{Node} of the L{NodeGroup},
then the method will raise an exception.

@param     name: The group (required)
@type      name: L{NodeGroup}

@return:         If the group was destroyed successfully
@rtype:          C{bool}
def ex_list_groups(self, location=None): (source)
List all groups.

@param location: filter the groups by location (optional)
@type  location: a L{NodeLocation} instance.

@return:         the list of L{NodeGroup}
def list_images(self, location=None): (source)
List images on Abiquo Repositories

@keyword location: The location to list images for.
@type    location: L{NodeLocation}

@return:           list of node image objects
@rtype:            C{list} of L{NodeImage}
def list_locations(self): (source)
Return list of locations where the user has access to.

@return: the list of L{NodeLocation} available for the current user
@rtype:  C{list} of L{NodeLocation}
def list_nodes(self, location=None): (source)
List all nodes.

@param location: Filter the groups by location (optional)
@type  location: a L{NodeLocation} instance.

@return:  List of node objects
@rtype: C{list} of L{Node}
def list_sizes(self, 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 L{DummyNodeDriver} but
without price neither bandwidth) to help the users to create their own.

If you call the method L{AbiquoNodeDriver.create_node} with the size
informed, it will just override the 'ram' value of the 'image'
template. So it is no too much usefull work with sizes...

@return: The list of sizes
@rtype:  C{list} of L{NodeSizes}
def reboot_node(self, node): (source)
Reboot a node.

@param node: The node to be rebooted
@type node: L{Node}

@return: True if the reboot was successful, otherwise False
@rtype: C{bool}
def _ex_connection_class_kwargs(self): (source)
Set the endpoint as an extra L{AbiquoConnection} argument.

According to Connection code, the "url" argument should be
parsed properly to connection.

@return: C{dict} of L{AbiquoConnection} input arguments
def _deploy_remote(self, e_vm): (source)
Asynchronous call to create the node.
def _to_location(self, vdc, dc, driver): (source)
Generates the L{NodeLocation} class.
def _to_node(self, vm, driver): (source)
Generates the L{Node} class.
def _to_nodeimage(self, template, driver, repo): (source)
Generates the L{NodeImage} class.
def _get_locations(self, location=None): (source)
Returns the locations as a generator.
def _get_enterprise_id(self): (source)
Returns the identifier of the logged user's enterprise.
def _define_create_node_location(self, **kwargs): (source)
Search for a location where to create the node.

Based on 'create_node' **kwargs argument, decide in which
location will be created.
def _define_create_node_group(self, xml_loc, loc, **kwargs): (source)
Search for a group where to create the node.

If we can not find any group, create it into argument 'location'
def _define_create_node_node(self, group, **kwargs): (source)
Defines the node before to create.

In Abiquo, you first need to 'register' or 'define' the node in
the API before to create it into the target hypervisor.
API Documentation for libcloud, generated by pydoctor at 2013-07-01 17:02:02.