dans l'optique de remettre ClusterController en production, les administateurs peuvent désormais ajouter ou supprimer une machine du contrôle du cluster controller

This commit is contained in:
Guillaume Raffy 2012-06-28 12:22:07 +00:00
parent 2c807fefe2
commit d67c4d6a21
2 changed files with 24 additions and 12 deletions

View File

@ -57,17 +57,17 @@ class ClusterNode:
bUpdateRequiredChecks = True
if bUpdateRequiredChecks:
if self.m_powerState == PowerState.ON:
self.m_machineStatusUpdater.m_bCheckPowerState = True
self.m_machineStatusUpdater.m_bCheckSensors = True
self.m_machineStatusUpdater.m_bCheckPowerState = True
self.m_machineStatusUpdater.m_bCheckSensors = True
elif self.m_powerState == PowerState.OFF:
self.m_machineStatusUpdater.m_bCheckPowerState = True
self.m_machineStatusUpdater.m_bCheckSensors = False
self.m_machineStatusUpdater.m_bCheckPowerState = True
self.m_machineStatusUpdater.m_bCheckSensors = False
elif self.m_powerState == PowerState.SLEEP:
self.m_machineStatusUpdater.m_bCheckPowerState = True
self.m_machineStatusUpdater.m_bCheckSensors = False
self.m_machineStatusUpdater.m_bCheckPowerState = True
self.m_machineStatusUpdater.m_bCheckSensors = False
elif self.m_powerState == PowerState.UNPLUGGED:
self.m_machineStatusUpdater.m_bCheckPowerState = True
self.m_machineStatusUpdater.m_bCheckSensors = False
self.m_machineStatusUpdater.m_bCheckPowerState = True
self.m_machineStatusUpdater.m_bCheckSensors = False
else:
assert( False )

View File

@ -7,6 +7,7 @@ import threading
import Util
#import pri
from urlparse import urlparse, parse_qs
import xml.dom.minidom
#>>> url = 'http://example.com/?foo=bar&one=1'
#>>> parse_qs(urlparse(url).query)
#{'foo': ['bar'], 'one': ['1']}
@ -36,12 +37,23 @@ class MyHandler(BaseHTTPRequestHandler):
return
if self.path.endswith("ShowControlledMachines"): #http://simpatix10.univ-rennes1.fr:8080/ShowControlledMachines
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.send_header('Content-type', 'text/xml')
self.end_headers()
self.wfile.write("hey, today is the" + str(time.localtime()[7]))
self.wfile.write(" day in the year " + str(time.localtime()[0]))
# Create the minidom document
doc = xml.dom.minidom.Document()
# Create the <ControlledMachines> root element
controlledMachinesElement = doc.createElement("ControlledMachines")
doc.appendChild(controlledMachinesElement)
for machine in self.server.m_clusterController.m_clusterStatus.m_clusterNodes.itervalues():
self.wfile.write("%s is controlled by ClusterController" % machine.getName())
# Create the main <card> element
controlledMachineElement = doc.createElement("Machine")
controlledMachineElement.setAttribute("name", machine.getName())
controlledMachinesElement.appendChild(controlledMachineElement)
# Print our newly created XML
self.wfile.write(doc.toprettyxml(indent=" "))
return
if urlparse(self.path).path == '/SetControlOnMachine': #http://simpatix10.univ-rennes1.fr:8080/SetControlOnMachine?machineName=simpatix30&control=1
machineName = paramsDict['machineName'][0]