OpenNebulaEndpoint

OpenNebula Endpoint base class implementation for the OpenNebula cloud service.

class DIRAC.Resources.Cloud.OpenNebulaEndpoint.OpenNebulaEndpoint(parameters=None)

Bases: Endpoint

OpenNebula implementation of the Cloud Endpoint interface

__init__(parameters=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 | S_ERROR

createInstance(instanceID='', createPublicIP=True)

Creates VM in OpenNebula cloud.

one.template.instantiate XML-RPC method is called with the following parameters 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.

  • template ID is obtained from Endpoint’s TemplateID constructor parameter

  • VM name equals to instanceID method argument

  • onhold flag is obtained from Endpoint’s Onhold constructor parameter

  • template string contains userdata scripts encoded in base64 and DNS servers adresses

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

Parameters:
instanceID - string

name of a new VM

createPublicIP - bool

ignored

It boots the node. If IPpool is defined on the imageConfiguration, a floating IP is created and assigned to the node.

Returns:

S_OK( ( nodeID, publicIP ) ) | S_ERROR

createInstances(vmsToSubmit)
deleteFloatingIP(nodeID)

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

getParameterDict()
getProxyFileLocation()
getVMFloatingIP(publicIP)
getVMIDs()

Get all the VM IDs on the endpoint

Returns:

list of VM ids

getVMNetworkInterface(network)

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

getVMNetworks()

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

getVMStatus(nodeID)

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, publicIP='')

Terminates VM specified by nodeID by sending one.vm.action(…, ‘delete’, ..) request.

Parameters:
nodeID - string

OpenNebula VM id specifier

publicIP - string

ignored

Returns:

S_OK | S_ERROR