X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fomf_resctl.py;h=87629aaa2251b9c9e482e49cbe6e4167cfed6856;hb=d3a3b2d3ea98e72183d1cb5497c38badaa0c5863;hp=406be09a9decd1958d95d8e930daf4cb3a602d76;hpb=b62cfe5d151eef83681fb9b6b32f328cc87dccc1;p=nodemanager.git diff --git a/plugins/omf_resctl.py b/plugins/omf_resctl.py index 406be09..87629aa 100644 --- a/plugins/omf_resctl.py +++ b/plugins/omf_resctl.py @@ -5,7 +5,7 @@ # NodeManager plugin - first step of handling omf_controlled slices """ -Overwrites the 'resctl' tag of slivers controlled by OMF so sm.py does the right thing +Overwrites the 'resctl' tag of slivers controlled by OMF so slivermanager.py does the right thing """ import os @@ -21,7 +21,7 @@ def start(options, conf): logger.log("omf_resctl: plugin starting up...") def GetSlivers(data, conf = None, plc = None): - if 'accounts' not in data: + if 'accounts' not in data: logger.log_missing_data("omf_resctl.GetSlivers",'accounts') return @@ -32,6 +32,15 @@ def GetSlivers(data, conf = None, plc = None): # xxx might need to clean up more deeply.. return + # as hrn is set only at AddNode-time, upgraded myplcs might still miss this + # clue: just overwrite the hostname of all nodes + # for node in GetNodes(): UpdateNode(node['node_id'],{'hostname':node['hostname']}) + try: + node_hrn = data['hrn'] + if not hrn: raise Exception,"Empty hrn" + except: + node_hrn='default # Failed to read hrn from GetSlivers, please upgrade PLCAPI' + for sliver in data['slivers']: name=sliver['name'] for chunk in sliver['attributes']: @@ -53,7 +62,7 @@ def GetSlivers(data, conf = None, plc = None): template_contents=file(template).read() yaml_contents=template_contents\ .replace('@XMPP_SERVER@',xmpp_server)\ - .replace('@NODE_HRN@','default # xxx todo in omf-resctl nm plugin')\ + .replace('@NODE_HRN@',node_hrn)\ .replace('@SLICE_NAME@',name) changes=tools.replace_file_with_string(yaml,yaml_contents) if changes: