OpenStackEndpoint

OpenStackEndpoint is Endpoint base class implementation for the OpenStack cloud service.

class DIRAC.Resources.Cloud.OpenStackEndpoint.OpenStackEndpoint(parameters=None, bootstrapParameters=None)

Bases: Endpoint

OpenStack implementation of the Cloud Endpoint interface

__init__(parameters=None, bootstrapParameters=None)
assignFloatingIP(nodeID)

Given a node, assign a floating IP from the ipPool defined on the imageConfiguration on the CS.

Parameters:
node - libcloud.compute.base.Node

node object with the vm details

Returns:

S_OK( public_ip ) | S_ERROR

createInstance(instanceID='')

This creates a VM instance for the given boot image and creates a context script, taken the given parameters. Successful creation returns instance VM

Boots a new node on the OpenStack server defined by self.endpointConfig. The ‘personality’ of the node is done by self.imageConfig. Both variables are defined on initialization phase.

The node name has the following format: <bootImageName><contextMethod><time>

Returns:

S_OK( ( nodeID, publicIP ) ) | S_ERROR

createInstances(vmsToSubmit)
deleteFloatingIP(nodeID, floatingIP=None)

Deletes a floating IP <public_ip> from the server.

Parameters:
  • publicIP (str) – public IP to be deleted

  • node (object) – node to which IP is attached

Returns:

S_OK | S_ERROR

getFlavors()
getImages()
getNetworks()

Get a network object corresponding to the networkName

Parameters:

networkName (str) – network name

Returns:

S_OK|S_ERROR network object in case of S_OK

getParameterDict()
getProxyFileLocation()
getVMFloatingIP(nodeID)
getVMIDs()

Get all the VM IDs on the endpoint

Returns:

list of VM ids

getVMInfo(vmID)
getVMStatus(vmID)

Get the status for a given node ID. libcloud translates the status into a digit from 0 to 4 using a many-to-one relation ( ACTIVE and RUNNING -> 0 ), which means we cannot undo that translation. It uses an intermediate states mapping dictionary, SITEMAP, which we use here inverted to return the status as a meaningful string. The five possible states are ( ordered from 0 to 4 ): RUNNING, REBOOTING, TERMINATED, PENDING & UNKNOWN.

Parameters:
uniqueId - string

openstack node id ( not uuid ! )

Returns:

S_OK( status ) | S_ERROR

initialize()
isValid()
setBootstrapParameters(bootstrapParameters)
setParameters(parameters)
setProxy(proxy)
stopVM(nodeID)

Given the node ID it gets the node details, which are used to destroy the node

Parameters:

uniqueId (str) – openstack node id ( not uuid ! )

Returns:

S_OK | S_ERROR