VirtualMachineManagerHandler

VirtualMachineHandler provides remote access to VirtualMachineDB

The following methods are available in the Service interface:

  • insertInstance

  • declareInstanceSubmitted

  • declareInstanceRunning

  • instanceIDHeartBeat

  • declareInstanceHalting

  • getInstancesByStatus

  • declareInstancesStopping

  • getUniqueID( instanceID ) return cloud manager uniqueID form VMDIRAC instanceID

class DIRAC.WorkloadManagementSystem.Service.VirtualMachineManagerHandler.VirtualMachineManagerHandler(handlerInitDict, trid)

Bases: RequestHandler

__init__(handlerInitDict, trid)

Constructor

Parameters:
  • handlerInitDict (dictionary) – Information vars for the service

  • trid (object) – Transport to use

auth_ping = ['all']
auth_refreshConfiguration = ['CSAdministrator']
auth_whoami = ['all']
classmethod checkStalledInstances()

To avoid stalling instances consuming resources at cloud endpoint, attempts to halt the stalled list in the cloud endpoint

classmethod createEndpoint(uniqueID)
export_checkVmWebOperation(operation)

return true if rpc has OPERATOR

export_declareInstanceHalting(uniqueID, load)

Insert the heart beat info from a halting instance The VM has the uniqueID, which is the Cloud manager VM id Declares “Halted” the instance and the image It returns S_ERROR if the status is not OK

export_declareInstanceRunning(uniqueID, privateIP)

Declares an instance Running and sets its associated info (uniqueID, publicIP, privateIP) Returns S_ERROR if: - instanceName does not have a “Submitted” entry - uniqueID is not unique

export_declareInstanceSubmitted(uniqueID)

After submission of the instance the Director should declare the new Status

export_declareInstancesStopping(instanceIdList)

Declares “Stopping” the instance because the Delete button of Browse Instances The instanceID is the VMDIRAC VM id When next instanceID heat beat with stopping status on the DB the VM will stop the job agent and terminates properly It returns S_ERROR if the status is not OK

static export_echo(data)

This method is used for testing performance of the service

Parameters:

data (str) – data to be sent back to the caller

Returns:

S_OK, Value is the input data

export_getAllInfoForUniqueID(uniqueID)

Get all the info for a UniqueID

export_getCEInstances(siteList, ceList, vo)
export_getHistoryForInstanceID(instanceId)

Retrieve the contents of the DB

export_getHistoryValues(averageBucket, selDict, fields2Get=None, timespan=0)

Retrieve the contents of the DB

export_getInstanceCounters(groupField, selDict)

Retrieve the contents of the DB

export_getInstancesByStatus(status)

Get dictionary of Image Names with InstanceIDs in given status

export_getInstancesContent(selDict, sortDict, start, limit)

Retrieve the contents of the DB

export_getPilotOutput(pilotReference)
export_getRunningInstancesBEPHistory(timespan, bucketSize)

Retrieve number of running instances in each bucket by End-Point History

export_getRunningInstancesByImageHistory(timespan, bucketSize)

Retrieve number of running instances in each bucket by Running Pod History

export_getRunningInstancesByRunningPodHistory(timespan, bucketSize)

Retrieve number of running instances in each bucket by Running Pod History

export_getRunningInstancesHistory(timespan, bucketSize)

Retrieve number of running instances in each bucket

export_getUniqueID(instanceID)

return cloud manager uniqueID from VMDIRAC instanceID

export_getUniqueIDByName(instanceName)

return cloud manager uniqueID from VMDIRAC name

export_insertInstance(uniqueID, imageName, instanceName, endpoint, runningPodName)

Check Status of a given image Will insert a new Instance in the DB

export_instanceIDHeartBeat(uniqueID, load, jobs, transferredFiles, transferredBytes, uptime=0)

Insert the heart beat info from a running instance It checks the status of the instance and the corresponding image Declares “Running” the instance and the image It returns S_ERROR if the status is not OK

export_ping()
static export_refreshConfiguration(fromMaster)

Force refreshing the configuration data

Parameters:

fromMaster (bool) – flag to refresh from the master configuration service

export_setInstanceUniqueID(instanceID, uniqueID)

Check Status of a given image Will insert a new Instance in the DB

export_stopInstance(site, endpoint, nodeID)
export_whoami()

A simple whoami, returns all credential dictionary, except certificate chain object.

classmethod getCEInstances(siteList=None, ceList=None, vo=None)
classmethod getCSOption(optionName, defaultValue=False)

Get an option from the CS section of the services

Returns:

Value for serviceSection/optionName in the CS being defaultValue the default

classmethod getPilotOutput(pilotRef)
getRemoteAddress()

Get the address of the remote peer.

Returns:

Address of remote peer.

getRemoteCredentials()

Get the credentials of the remote peer.

Returns:

Credentials dictionary of remote peer.

classmethod haltInstances(vmList)

Common haltInstances for Running(from class VirtualMachineManagerHandler) and Stalled(from checkStalledInstances periodic task) to Halt

classmethod haltStalledInstances()
initialize()

Initialize this instance of the handler (to be overwritten)

classmethod initializeHandler(serviceInfo)
srv_disconnect(trid=None)
classmethod srv_disconnectClient(trid)
srv_getActionTuple()
classmethod srv_getCSOption(optionName, defaultValue=False)

Get an option from the CS section of the services

Returns:

Value for serviceSection/optionName in the CS being defaultValue the default

srv_getClientSetup()
srv_getClientVO()
srv_getClientVersion()
srv_getFormattedRemoteCredentials()
classmethod srv_getMonitor()
srv_getRemoteAddress()

Get the address of the remote peer.

Returns:

Address of remote peer.

srv_getRemoteCredentials()

Get the credentials of the remote peer.

Returns:

Credentials dictionary of remote peer.

classmethod srv_getServiceName()
srv_getTransportID()
classmethod srv_getURL()
classmethod srv_msgCreate(msgName)
srv_msgReply(msgObj)
classmethod srv_msgSend(trid, msgObj)
classmethod stopInstance(site, endpoint, nodeID)
transfer_bulkFromClient(bulkId, token, bulkSize, fileHelper)
transfer_bulkToClient(bulkId, token, fileHelper)
transfer_fromClient(fileId, token, fileSize, fileHelper)
transfer_listBulk(bulkId, token, fileHelper)
transfer_toClient(fileId, token, fileHelper)
types_checkVmWebOperation = [<class 'str'>]
types_declareInstanceHalting = [<class 'str'>, <class 'float'>]
types_declareInstanceRunning = [<class 'str'>, <class 'str'>]
types_declareInstanceSubmitted = [<class 'str'>]
types_declareInstancesStopping = [<class 'list'>]
types_echo = [<class 'str'>]
types_getAllInfoForUniqueID = [<class 'str'>]
types_getCEInstances = [(<class 'list'>, <class 'NoneType'>), (<class 'list'>, <class 'NoneType'>), <class 'str'>]
types_getHistoryForInstanceID = [<class 'int'>]
types_getHistoryValues = [<class 'int'>, <class 'dict'>]
types_getInstanceCounters = [<class 'str'>, <class 'dict'>]
types_getInstancesByStatus = [<class 'str'>]
types_getInstancesContent = [<class 'dict'>, (<class 'list'>, <class 'tuple'>), <class 'int'>, <class 'int'>]
types_getPilotOutput = [<class 'str'>]
types_getRunningInstancesBEPHistory = [<class 'int'>, <class 'int'>]
types_getRunningInstancesByImageHistory = [<class 'int'>, <class 'int'>]
types_getRunningInstancesByRunningPodHistory = [<class 'int'>, <class 'int'>]
types_getRunningInstancesHistory = [<class 'int'>, <class 'int'>]
types_getUniqueID = [<class 'str'>]
types_getUniqueIDByName = [<class 'str'>]
types_insertInstance = [<class 'str'>, <class 'str'>, <class 'str'>, <class 'str'>, <class 'str'>]
types_instanceIDHeartBeat = [<class 'str'>, <class 'float'>, <class 'int'>, <class 'int'>, <class 'int'>]
types_ping = []
types_refreshConfiguration = [<class 'bool'>]
types_setInstanceUniqueID = [<class 'int'>, <class 'str'>]
types_stopInstance = [<class 'str'>, <class 'str'>, <class 'str'>]
types_whoami = []