CloudEndpoint
CloudEndpoint is a base class for the clients used to connect to different cloud providers
- class DIRAC.Resources.Cloud.CloudEndpoint.CloudEndpoint(parameters=None)
Bases:
Endpoint
CloudEndpoint base class
- __init__(parameters=None)
- assignFloatingIP(node)
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(publicIP, node)
Deletes a floating IP <public_ip> from the server.
- getParameterDict()
- getProxyFileLocation()
- getVMFloatingIP(publicIP)
- getVMNetwork(networkNames=None)
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
- getVMNode(nodeID)
Given a Node ID, returns all its configuration details on a libcloud.compute.base.Node object.
- Parameters:
- nodeID - string
openstack node id ( not uuid ! )
- Returns:
S_OK( Node ) | S_ERROR
- getVMNodes()
Get all the nodes on the endpoint
- Returns:
S_OK(list of Node) / S_ERROR
- getVMPool(poolName)
- 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