X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fomf_resctl.py;h=4f6d5b17f60d113033b0a30ffb5d41a685632f31;hb=ecee05390277f57b02d21ffca0195292bde1defa;hp=fb32834a7269b56d59e50b20626ef369d1ff54bd;hpb=5fe3db92ad8c5aba4002a14542e915177430243b;p=nodemanager.git diff --git a/plugins/omf_resctl.py b/plugins/omf_resctl.py index fb32834..4f6d5b1 100644 --- a/plugins/omf_resctl.py +++ b/plugins/omf_resctl.py @@ -49,6 +49,7 @@ yaml_slice_path="/etc/omf_rc/config.yml" # given that we're now responsible for fetching this one, I have to # decide on an actual path - not jsut a name to search for in PATH omf_rc_trigger_script="/usr/bin/plc_trigger_omf_rc" +omf_rc_trigger_log="/var/log/plc_trigger_omf_rc.log" # hopefully temporary: when trigger script is missing, fetch it at the url here omf_rc_trigger_url="http://git.mytestbed.net/?p=omf.git;a=blob_plain;f=omf_rc/bin/plc_trigger_omf_rc;hb=HEAD" @@ -113,17 +114,20 @@ def GetSlivers(data, conf = None, plc = None): try: fetch_trigger_script_if_missing (slicename) # the trigger script actually needs to be run in the slice context of course + # in addition there is a requirement to pretend we run as a login shell + # hence sudo -i slice_command = [ "sudo", "-i", omf_rc_trigger_script ] to_run = tools.command_in_slice (slicename, slice_command) - logger.log("command_in_slice: %s"%to_run) - sp=subprocess.Popen(to_run, stdout=subprocess.PIPE,stderr=subprocess.STDOUT) - (out,err)=sp.communicate() - retcod=sp.returncode - # we don't wait for that, try to display a retcod for info purpose only - # might be None if that config script lasts or hangs whatever - logger.log("omf_resctl: %s: called OMF rc control script (imm. retcod=%r)"%(slicename,retcod)) - logger.log("omf_resctl: got stdout\n%s"%out) - logger.log("omf_resctl: got stderr\n%s"%err) + log_filename = "/vservers/%s/%s"%(slicename,omf_rc_trigger_log) + logger.log("omf_resctl: starting %s"%to_run) + logger.log("redirected into %s"%log_filename) + logger.log("*not* waiting for completion..") + with open(log_filename,"a") as log_file: + subprocess.Popen(to_run, stdout=log_file,stderr=subprocess.STDOUT) + # a first version tried to 'communicate' on that subprocess instance + # but that tended to create deadlocks in some cases + # causing nodemanager to stall... + # we're only losing the child's retcod, no big deal except: import traceback traceback.print_exc()