#!/usr/bin/python -tt
# vim:set ts=4 sw=4 expandtab:
+#
+# $Id$
+# $URL$
+#
# NodeManager plugin to empower slivers to make API calls
"""
node_id = tools.node_id()
slivertags=plc.GetSliceTags({"name":slice,"node_id":node_id,"tagname":tagname})
if len(slivertags)==0:
- slivertag_id=plc.AddSliceTag(slice,tagname,value,node_id)
+ # looks like GetSlivers reports about delegated/nm-controller slices that do *not* belong to this node
+ # and this is something that AddSliceTag does not like
+ try:
+ slivertag_id=plc.AddSliceTag(slice,tagname,value,node_id)
+ except:
+ logger.log ("SetSliverTag - CAUGHT exception for (probably delegated) slice=%(slice)s tag=%(tagname)s node_id=%(node_id)d"%locals())
+ pass
else:
slivertag_id=slivertags[0]['slice_tag_id']
plc.UpdateSliceTag(slivertag_id,value)
return
if 'slivers' not in data:
- logger.log("sliverauth: getslivers data lack's sliver information. IGNORING!")
+ logger.log_missing_data("sliverauth.GetSlivers", 'slivers')
return
for sliver in data['slivers']:
+ path = '/vservers/%s' % sliver['name']
+ if not os.path.exists(path):
+ # ignore all non-plc-instantiated slivers
+ instantiation = sliver.get('instantiation','')
+ if instantiation == 'plc-instantiated':
+ logger.log("sliverauth: plc-instantiated slice %s does not yet exist. IGNORING!" % sliver['name'])
+ continue
+
found_hmac = False
for attribute in sliver['attributes']:
name = attribute.get('tagname',attribute.get('name',''))