Skip to content
Snippets Groups Projects
  1. Jan 18, 2011
  2. Jan 14, 2011
  3. Jan 13, 2011
  4. Jan 12, 2011
  5. Jan 11, 2011
    • Apollon Oikonomopoulos's avatar
      Add ability to retain specified fds open in RunCmd · 7b0bf9cd
      Apollon Oikonomopoulos authored
      
      Passing tap devices to KVM as file descriptors requires that the respective
      file decriptors remain open during utils.RunCmd execution. To this direction,
      we add a “noclose_fds” keyword argument to utils.RunCmd, accepting a list of
      file descriptors to keep open. The actual fd handling is implemented in
      _RunCmdPipe and _RunCmdFile using subprocess.Popen's “preexec_fn”[1],
      since subprocess.Popen provides no other way to selectively handle fds.
      
      A small modification is also made to test/ganeti.utils_unittest.py to comply
      with _RunCmdPipe's new API and a new unit test is added to test the selective
      fd retention functionality.
      
      [1] “If preexec_fn is set to a callable object, this object will be called in
           the child process just before the child is executed. (Unix only)”
          Subprocess documentation
      
      Signed-off-by: default avatarApollon Oikonomopoulos <apollon@noc.grnet.gr>
      Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      7b0bf9cd
Loading