Example #1
0
#
# vGridAuthors:
#    Omer Khalid <Omer.Khalid AT cern DOT ch>
#    Thomas Koeckerbauer
import cgitb; cgitb.enable()
import socket, os, sys, cgi, urllib2, logging
os.chdir("..")
sys.path.insert(0,"modules")
import configNode, deployer, forkworker
#, logger

print "Content-type: text/html\n"

#log = logger.getLogger()
remoteData=cgi.FieldStorage()
vnConfigNode = configNode.getVNodeNodeConfig()

path="/cgi/server/cgi-bin/status.py"
proto=vnConfigNode.getProtocol()

def reportState(vmHostname, state , serverHostname=None):
  """Reports the current state to Server
      Keyword arguments:
      vmHostname -- Hostname of the virtual machine
      state -- state of the virtual machine
  """
  if serverHostname == None: 
    serverHostname = vnConfigNode.getServerHostname()
  logging.info("sending the state " + state + " to " + serverHostname)
  logging.info(proto + serverHostname + path + "?vmAction=setstate&vmHostname=" + vmHostname + "&state=" + state)
  addr = proto + serverHostname + path + "?vmAction=setstate&vmHostname=" + vmHostname + "&state=" + state
Example #2
0
 def __init__(self):
     self.__config = configNode.getVNodeNodeConfig()
     self.__vgName = self.__config.getVolumeGroupName()
     self.__protocol = self.__config.getProtocol()
Example #3
0
 def getDeployerForImage(imageTag):
     vnConfig = configNode.getVNodeNodeConfig()
     type = vnConfig.getVMType(imageTag)
     return VNodeDeployer.getDeployer(type)