Ejemplo n.º 1
0
 def __initMissingEntriesWithDefaultValues(self):
     vnConfig = configCommon.getVNodeCommonConfig()
     virtualHosts = vnConfig.getVirtualHostList()
     for host in virtualHosts:
         if (not self.__state.has_section(host)):
             logging.error('Host "' + host + '" not in state file, adding default value' )
             self.__state.add_section(host)
             self.setNotDeployed(host)
Ejemplo n.º 2
0
 def getPhysicalHostsBelowMaxVMCountList(self):
     hosts = []
     vnConfigCommon = configCommon.getVNodeCommonConfig()
     maxVMs = vnConfigCommon.getPhysicalHostMaxVMDict()
     allHosts = vnConfigCommon.getPhysicalHostList()
     for host in allHosts:
         if (self.getNrOfVMsOnPhysicalHost(host) < eval(maxVMs[host])):
             hosts.append(host)
     hosts.sort()
     return hosts
Ejemplo n.º 3
0
import simplejson

print "Content-type: text/html\n"
data = []
data_f = {'Result': data}

log = logger.getLogger()
username = os.getenv('SSL_CLIENT_S_DN_CN');
try:
  username = "".join([x.strip() for x in username.split(' ')])
except:
  username = '******'
form=cgi.FieldStorage();
state = vmstate.VNodeVMState()
vnConfigServer = configServer.getVNodeServerConfig()
vnConfigCommon = configCommon.getVNodeCommonConfig()

proto=vnConfigServer.getProtocol()
path="/cgi/node/cgi-bin/main.py"

def getReservedHostData():
   """ Returns a JSON list with the reserved virtual machines for a given user
   """
   global state
   logging.info(username + "@" +os.getenv('REMOTE_ADDR') + " is requesting reserved host data")
   reservedNodesHostname = state.getHostsForUserInState(username,'reserved')
   for reservedHostname in reservedNodesHostname:
       reservedNodesInfo = state.getVirtualHostInfo(reservedHostname)
       expiryAtSeconds = reservedNodesInfo['reservedexpirytime']
       if (abs(float(time.time()) - float(expiryAtSeconds)) == 0):
            state.setNotDeployed(reservedHostname)