/usr/lib/python2.7/dist-packages/lbserver/Test1.py is in ltsp-cluster-lbserver 2.0.0-0ubuntu5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #!/usr/bin/env python
"""
Test file
"""
import traceback
from lbserverfactory import *
from lbserver import *
class TestLBServerFactory(LBServerFactory):
def _createLBServer(self):
return TestLBServer()
def newLBServer(self):
lbServer = self._loadLBServer(self.dom.childNodes[0])
return lbServer
class TestLBServer(LBServer):
def refreshNodesValues(self):
for n in self.getNodes():
if n.name == "server1":
list = {}
list["CPUVENDOR"] = LBNodeValue(n,{"name":"CPUVENDOR","value":"GenuineIntel"})
list["CPUCOUNT"] = LBNodeValue(n,{"name":"CPUCOUNT","value":"1"})
list["CPUFREQ"] = LBNodeValue(n,{"name":"CPUFREQ","value":"2000"})
list["MEMTOTAL"] = LBNodeValue(n,{"name":"MEMTOTAL","value":"514212"})
list["IP"] = LBNodeValue(n,{"name":"IP","value":"1.1.1.1"})
list["NBX11SESS"] = LBNodeValue(n,{"name":"NBX11SESS","value":"0"})
list["X11_INACTIVE"] = LBNodeValue(n,{"name":"X11_INACTIVE","value":"0"})
list["MEMUSED"] = LBNodeValue(n,{"name":"MEMUSED","value":"0"})
list["LOADAVG"] = LBNodeValue(n,{"name":"LOADAVG","value":"0"})
n.updateValues(list)
elif n.name == "server2":
list = {}
list["CPUFREQ"] = LBNodeValue(n,{"name":"CPUFREQ","value":"1000"})
list["CPUVENDOR"] = LBNodeValue(n,{"name":"CPUVENDOR","value":"GenuineIntel"})
list["CPUCOUNT"] = LBNodeValue(n,{"name":"CPUCOUNT","value":"1"})
list["MEMTOTAL"] = LBNodeValue(n,{"name":"MEMTOTAL","value":"256212"})
list["IP"] = LBNodeValue(n,{"name":"IP","value":"0.0.0.0"})
list["NBX11SESS"] = LBNodeValue(n,{"name":"NBX11SESS","value":"5"})
list["X11_INACTIVE"] = LBNodeValue(n,{"name":"X11_INACTIVE","value":"0"})
list["MEMUSED"] = LBNodeValue(n,{"name":"MEMUSED","value":"112000"})
list["LOADAVG"] = LBNodeValue(n,{"name":"LOADAVG","value":".6"})
n.updateValues(list)
elif n.name == "server3":
list = {}
list["1"] = LBNodeValue(n,{"name":"1","value":"2"})
list["1"] = LBNodeValue(n,{"name":"1","value":"2"})
n.updateValues(list)
elif n.name == "server4":
list = {}
list["1"] = LBNodeValue(n,{"name":"1","value":"2"})
list["1"] = LBNodeValue(n,{"name":"1","value":"2"})
n.updateValues(list)
def test1():
try:
factory = TestLBServerFactory("lbsconfig.xml")
lbServer = factory.newLBServer()
lbServer.refreshNodesValues()
#for x in range(70):
print lbServer.getNextServerForGroup('SCHOOL_X')
# print lbServer.getStatusStruct()
except Exception,e:
traceback.print_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2])
print "END"
def main():
test1()
if __name__ == "__main__":
main()
|