git://git.onelab.eu
/
monitor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
This commit changes the 'soltesz.py' module into 'moncommands.py' and
[monitor.git]
/
plc.py
diff --git
a/plc.py
b/plc.py
index
5bc5349
..
0506ad5
100644
(file)
--- a/
plc.py
+++ b/
plc.py
@@
-21,6
+21,7
@@
except:
import time
try:
from config import config
import time
try:
from config import config
+ config = config()
debug = config.debug
except:
debug = False
debug = config.debug
except:
debug = False
@@
-29,9
+30,6
@@
XMLRPC_SERVER="https://boot.planet-lab.org/PLCAPI/"
logger = logging.getLogger("monitor")
logger = logging.getLogger("monitor")
-#XMLRPC_SERVER = config.XMLRPC_SERVER
-
-config = config()
api = xmlrpclib.Server(XMLRPC_SERVER, verbose=False, allow_none=True)
def getAPI(url):
api = xmlrpclib.Server(XMLRPC_SERVER, verbose=False, allow_none=True)
def getAPI(url):
@@
-54,6
+52,10
@@
class PLC:
def __repr__(self):
return self.api.__repr__()
def __repr__(self):
return self.api.__repr__()
+def getAuthAPI():
+ import monitorconfig
+ return PLC(monitorconfig.API_AUTH, monitorconfig.API_SERVER)
+
'''
Returns list of nodes in dbg as reported by PLC
'''
'''
Returns list of nodes in dbg as reported by PLC
'''
@@
-140,8
+142,11
@@
def getSites(filter=None, fields=None):
sites = []
anon = {'AuthMethod': "anonymous"}
try:
sites = []
anon = {'AuthMethod': "anonymous"}
try:
- sites = api.GetSites(anon, filter, fields)
+ #sites = api.GetSites(anon, filter, fields)
+ sites = api.GetSites(auth.auth, filter, fields)
except Exception, exc:
except Exception, exc:
+ import traceback
+ traceback.print_exc()
print "getSites: %s" % exc
logger.info("getSites: %s" % exc)
return sites
print "getSites: %s" % exc
logger.info("getSites: %s" % exc)
return sites
@@
-257,6
+262,7
@@
def enableSliceCreation(nodename):
Removes ability to create slices. Returns previous max_slices
'''
def removeSliceCreation(nodename):
Removes ability to create slices. Returns previous max_slices
'''
def removeSliceCreation(nodename):
+ print "removeSliceCreation(%s)" % nodename
api = xmlrpclib.Server(XMLRPC_SERVER, verbose=False)
try:
loginbase = siteId(nodename)
api = xmlrpclib.Server(XMLRPC_SERVER, verbose=False)
try:
loginbase = siteId(nodename)
@@
-279,7
+285,7
@@
QED
# if len(siteid) == 1:
# logger.info("Enabling slice creation for site %s" % siteId(nodename))
# try:
# if len(siteid) == 1:
# logger.info("Enabling slice creation for site %s" % siteId(nodename))
# try:
-# if not
config.
debug:
+# if not debug:
# api.AdmUpdateSite(auth.auth, siteid[0], {"max_slices" : maxslices})
# except Exception, exc:
# logger.info("API: %s" % exc)
# api.AdmUpdateSite(auth.auth, siteid[0], {"max_slices" : maxslices})
# except Exception, exc:
# logger.info("API: %s" % exc)