Commit f99bb7f9 authored by David Johnson's avatar David Johnson

Fix some type-specific stuff, and some debug stuff.

parent 372b4706
...@@ -377,14 +377,19 @@ class XmlrpcNodeInfoFetcher: ...@@ -377,14 +377,19 @@ class XmlrpcNodeInfoFetcher:
continue continue
# now add the node: # now add the node:
# note that we force some ints to strings because the xml file
# siteParser didn't force them to ints.
adi = { 'HNAME' : n['hostname'], adi = { 'HNAME' : n['hostname'],
'PLABID' : n['node_id'], 'PLABID' : str(n['node_id']),
'IP' : nni_map[nnid]['IP'], 'IP' : nni_map[nnid]['IP'],
'MAC' : nni_map[nnid]['MAC'], 'MAC' : nni_map[nnid]['MAC'],
'BWLIMIT' : nni_map[nnid]['BWLIMIT'], 'BWLIMIT' : nni_map[nnid]['BWLIMIT'],
'SITE' : si_map[n['site_id']]['SITE'], 'SITE' : si_map[n['site_id']]['SITE'],
'LATITUDE' : si_map[n['site_id']]['LATITUDE'], 'LATITUDE' : si_map[n['site_id']]['LATITUDE'],
'LONGITUDE' : si_map[n['site_id']]['LONGITUDE'] } 'LONGITUDE' : si_map[n['site_id']]['LONGITUDE'] }
if adi['BWLIMIT']:
adi['BWLIMIT'] = str(adi['BWLIMIT'])
pass
if n.has_key('boot_status'): if n.has_key('boot_status'):
adi['STATUS'] = n['boot_status'] adi['STATUS'] = n['boot_status']
pass pass
...@@ -493,10 +498,16 @@ class Plab: ...@@ -493,10 +498,16 @@ class Plab:
slicename = "%s_elab_%d" % (prefix,exptidx) slicename = "%s_elab_%d" % (prefix,exptidx)
pass pass
elif slice_create_method == 'federate': elif slice_create_method == 'federate':
if debug:
print "Using 'federate' slice create method!"
pass
# use the prefix of the site for the pid containing # use the prefix of the site for the pid containing
# this eid. # this eid.
translator = EmulabPlcObjTranslator(plc) translator = EmulabPlcObjTranslator(plc)
if debug:
print "Synch'ing project %s" % str(pid)
pass
# ensure that project (site) is created and up to date # ensure that project (site) is created and up to date
translator.syncObject('project',pid) translator.syncObject('project',pid)
...@@ -506,6 +517,9 @@ class Plab: ...@@ -506,6 +517,9 @@ class Plab:
" where pid=%s",(pid,)) " where pid=%s",(pid,))
for row in res: for row in res:
(p_uid,) = row (p_uid,) = row
if debug:
print "Synch'ing user %s" % str(p_uid)
pass
translator.syncObject('user',p_uid) translator.syncObject('user',p_uid)
pass pass
...@@ -994,6 +1008,9 @@ class Plab: ...@@ -994,6 +1008,9 @@ class Plab:
if len(toupdate): if len(toupdate):
print "There are %d plab node updates." % len(toupdate) print "There are %d plab node updates." % len(toupdate)
for (nodeent,(nodeid,diffattrs)) in toupdate: for (nodeent,(nodeid,diffattrs)) in toupdate:
if debug:
print "About to update %s; new info %s; diff %s" \
% (str(nodeid),str(nodeent),str(diffattrs))
try: try:
self.__updateNodeMapping(nodeid, diffattrs) self.__updateNodeMapping(nodeid, diffattrs)
pass pass
...@@ -1128,7 +1145,7 @@ class Plab: ...@@ -1128,7 +1145,7 @@ class Plab:
pass pass
return () return ()
def __getKnownPnodes(self,plc): def __getKnownPnodes(self,plc,deleted=0):
""" """
getFree helper function. Returns a dict of IP:node_id pairs getFree helper function. Returns a dict of IP:node_id pairs
for the Plab nodes that currently exist in the DB. for the Plab nodes that currently exist in the DB.
...@@ -1139,7 +1156,8 @@ class Plab: ...@@ -1139,7 +1156,8 @@ class Plab:
" from plab_mapping as pm" " from plab_mapping as pm"
" left join widearea_nodeinfo as wni on" " left join widearea_nodeinfo as wni on"
" pm.node_id = wni.node_id" " pm.node_id = wni.node_id"
" where pm.plc_idx=%s",(plc.idx,)) " where pm.plc_idx=%s and deleted=%s",
(plc.idx,int(deleted)))
ret = {} ret = {}
for (nodeid, plabid, hostname, ip, mac, site, for (nodeid, plabid, hostname, ip, mac, site,
...@@ -3090,6 +3108,16 @@ class Node: ...@@ -3090,6 +3108,16 @@ class Node:
time.strftime("%Y-%m-%d %H:%M:%S", time.strftime("%Y-%m-%d %H:%M:%S",
time.gmtime(self.leaseend)))) time.gmtime(self.leaseend))))
pass pass
# grab which nodegroups we're in:
qres = DBQueryFatal("select nodegroup_idx"
" from plab_nodegroup_members"
" where node_id=%s",(self.phys_nodeid,))
for (ngid,) in qres:
if not ngid in self.nodegroups:
self.nodegroups.append(ngid)
pass
pass
if self.pollNode: if self.pollNode:
TIMESTAMP("Waiting for %s to respond" % self.nodeid) TIMESTAMP("Waiting for %s to respond" % self.nodeid)
...@@ -3143,7 +3171,9 @@ class Node: ...@@ -3143,7 +3171,9 @@ class Node:
" from plab_nodegroup_members" " from plab_nodegroup_members"
" where node_id=%s",(self.phys_nodeid,)) " where node_id=%s",(self.phys_nodeid,))
for (ngid,) in qres: for (ngid,) in qres:
self.nodegroups.append(ngid) if not ngid in self.nodegroups:
self.nodegroups.append(ngid)
pass
pass pass
return return
......
...@@ -58,8 +58,10 @@ def main(args): ...@@ -58,8 +58,10 @@ def main(args):
# parse command line options # parse command line options
opts, args = parser.parse_args(args[1:]) opts, args = parser.parse_args(args[1:])
libplab.debug = opts.debug if not libplab.debug:
libplab.verbose = opts.verbose libplab.debug = opts.debug
if not libplab.verbose:
libplab.verbose = opts.verbose
slicename = None slicename = None
# make sure we were told what to do on the command line. # make sure we were told what to do on the command line.
......
...@@ -41,8 +41,10 @@ def main(args): ...@@ -41,8 +41,10 @@ def main(args):
(opts, args) = parser.parse_args() (opts, args) = parser.parse_args()
libplab.debug = opts.debug if not libplab.debug:
libplab.verbose = opts.verbose libplab.debug = opts.debug
if not libplab.verbose:
libplab.verbose = opts.verbose
if len(args) == 2: if len(args) == 2:
command,slicename = args command,slicename = args
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment