Skip to content
  • Iustin Pop's avatar
    Make utils.RunCmd() deal with interleaved stdout/stderr · 9c233417
    Iustin Pop authored
    Currently, RunCmd is written with the assumption that programs will have
    a small stderr output, therefore we read the child's stdout (which can
    be big, so we don't want to block the child) and then the stderr (which
    is small, so it shouldn't block).
    
    However, with the ‘gnt-cluster verify-disks’ command, we ourselves
    generate heavy stderr, therefore we break the ganeti-watcher which runs
    the verify-disks via utils.RunCmd.
    
    This patch turns the RunCmd command into an poll-based one, which means
    any kind of interleaved output by a child on stdout/stderr will be
    handled correctly. Of course, since the output is buffered in memory,
    there are other ways to break RunCmd(). But at least this should fix the
    common case.
    
    Reviewed-by: hansmi
    9c233417