Bug 1049759

Summary: [RHS-C] rhsc-log-collector garbles the tty when multiple hosts are gathered and ssh is called with the "-t" flag
Product: [Red Hat Storage] Red Hat Gluster Storage Reporter: Prasanth <pprakash>
Component: rhsc-log-collectorAssignee: Darshan <dnarayan>
Status: CLOSED CURRENTRELEASE QA Contact: RHS-C QE <rhsc-qe-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 2.1CC: asriram, avishwan, dpati, knarra, mmahoney, mmccune, nsathyan, pprakash, rhs-bugs, sabose, sdharane, ssampat
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Known Issue
Doc Text:
When rhsc-log-collector command is run, after collecting logs from different servers, the Terminal becomes garbled and unusable. Workaround: Run 'reset' command.
Story Points: ---
Clone Of: 1041749 Environment:
Last Closed: 2015-08-27 07:12:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1035040    

Description Prasanth 2014-01-08 07:09:25 UTC
Cloning this bug for RHSC as the same issue is present in rhsc-log-collector as well.


+++ This bug was initially created as a clone of Bug #1041749 +++


Description of problem:

When rhsc-log-collector is run for multiple hypervisor hosts and invokes ssh with the "-t" flag, it results in a garbled TTY requiring "stty sane" to be run to get it back.

Version-Release number of selected component (if applicable):

rhsc-log-collector-2.1.2.0-0.3.el6rhs.noarch


How reproducible:

I was able to reproduce this 100% of the time if gathering more than one host.  A single host does not exhibit this problem.

Steps to Reproduce:
1.  This problem depends on bug 1010472, which adds the "-t" flag to ssh.  The patch looks like this:

--- rhevm-log-collector.orig    2013-10-07 10:40:57.000000000 -0400
+++ rhevm-log-collector 2013-12-12 12:59:03.552000942 -0500
@@ -503,6 +503,10 @@
         def format_ssh_command(self, cmd="ssh"):
             cmd = "/usr/bin/%s " % cmd

+       # add a controlling tty
+       if cmd.startswith("/usr/bin/ssh"):
+           cmd += "-t "
+
             if "ssh_port" in self.configuration:
                 port_flag = "-p" if cmd.startswith("/usr/bin/ssh") else "-P"
                 cmd += port_flag + " %(ssh_port)s " % self.configuration

2.  With that patch in place, run 'rhsc-log-collector collect' in an environment with more than one host

Actual results:

The command will succeed, but the TTY will become garbled during or just after the collection of data from the hosts

The only recovery is to run 'stty sane' or 'reset' on the TTY where the 'rhevm-log-collector' was invoked.

Expected results:

The command succeeds and the TTY is sane.

Additional info:

This appears to be something to be a combination of the "-t" flag and specifying multiple hosts.  If you remove the "-t" flag the behavior goes away, and if you only specify one host the behavior goes away.  It might have something to do with the logging module being used in multiple threads simultaneously.

I was able to completely alleviate the problem with this patch:

--- rhevm-log-collector.orig    2013-10-07 10:40:57.000000000 -0400
+++ rhevm-log-collector 2013-12-12 12:59:03.552000942 -0500
@@ -626,6 +630,7 @@
             )
             stdout = self.sosreport()
             self.parse_sosreport_stdout(stdout)
+            self.caller.call('stty sane')
             self.configuration["hypervisor_dir"] = os.path.join(
                 self.configuration.get("local_scratch_dir"),
                 self.configuration.get("hostname")

--- Additional comment from Sandro Bonazzola on 2013-12-18 03:07:34 EST ---

Moving to RHEVM since there are Red Hat Customer Portal references.

Comment 1 Shalaka 2014-01-13 08:57:55 UTC
As this bug has been identified as known issue, please add the DocText.

Comment 2 Shalaka 2014-01-23 09:38:26 UTC
Please review the edited Doc Text and signoff.

Comment 3 Aravinda VK 2014-01-24 11:16:33 UTC
Minor change in doc text. (Red Hat Storage Console => Terminal)

Comment 4 Sahina Bose 2015-08-27 07:12:07 UTC
This issue has been fixed post rebase to upstream ovirt 3.5 in RHGS release 3.1.

Closing this bug. Please reopen a bug against version 3.1 if you encounter the issue again