OcciEndpoint
OcciEndpoint is Endpoint base class implementation for the Occi cloud service.
- class DIRAC.Resources.Cloud.OcciEndpoint.OcciEndpoint(parameters=None)
Bases:
Endpoint
OCCI 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( public_ip ) | S_ERROR
- createInstance(instanceID='', createPublicIP=True)
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>
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.
- 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='')
Given the node ID it gets the node details, which are used to destroy the node making use of the libcloud.openstack driver. If three is any public IP ( floating IP ) assigned, frees it as well.
- Parameters:
- uniqueId - string
openstack node id ( not uuid ! )
- public_ip - string
public IP assigned to the node if any
- Returns:
S_OK | S_ERROR