Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

orchestra/console: log output from pexpect commands #1869

Merged
merged 1 commit into from
Jul 22, 2023

Conversation

dmick
Copy link
Member

@dmick dmick commented Jul 20, 2023

in case anything weird is being noticed and communicated by ipmitool, try to display anything it says

@dmick
Copy link
Member Author

dmick commented Jul 20, 2023

@zmc, please have a look and let's discuss the approach. I'm not fully comfortable with it but it might be the best we can really do

@dmick
Copy link
Member Author

dmick commented Jul 20, 2023

example output (new log lines have 'output:' in them):

2023-07-19 19:44:25,364.364 DEBUG:teuthology.orchestra.console:pexpect command: ipmitool -H smithi008.ipmi.sepia.ceph.com -I lanplus -U inktank -P ApGNXcA7 power off
2023-07-19 19:44:25,380.380 DEBUG:teuthology.orchestra.console:power off output: Chassis Power Control: Down/Off
2023-07-19 19:44:25,381.381 DEBUG:teuthology.orchestra.console:pexpect command: ipmitool -H smithi008.ipmi.sepia.ceph.com -I lanplus -U inktank -P ApGNXcA7 power status
2023-07-19 19:44:25,397.397 DEBUG:teuthology.orchestra.console:check power output: Chassis Power is off
2023-07-19 19:44:25,497.497 INFO:teuthology.orchestra.console:Power off for smithi008 completed```

Copy link
Member

@zmc zmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmick I think using the self.logfile instance variable like this could introduce races in concurrent execution. What I'd change about this approach would be to drop self.logfile entirely from PhysicalConsole , and logfile from its __init__ method. Since you're already setting the logfile_read on the pexpect.spawn object, the method calls that produce one can just access that same attr from the returned object. Calling seek(0) will still be necessary, but we'd be guaranteed that each pexpect session has its own buffer to use.

@dmick
Copy link
Member Author

dmick commented Jul 20, 2023

probably a good idea. I don't think we currently have overlapping spawns, but I did ponder that as a potential problem. I couldn't figure out any good way to "tie" the pexpect logfile option directly to a logger; I looked into subclassing files to add in a call to log.debug but I just couldn't puzzle it out.

@zmc
Copy link
Member

zmc commented Jul 20, 2023

Ah, look at teuthology.task.ansible.LoggerFile. If that does what you want, we can move it to its own module in teuthology.util

@dmick dmick marked this pull request as ready for review July 21, 2023 02:48
@dmick
Copy link
Member Author

dmick commented Jul 21, 2023

Repushed with suggested changes.

@dmick
Copy link
Member Author

dmick commented Jul 21, 2023

jenkins retest please

@zmc
Copy link
Member

zmc commented Jul 21, 2023

#1870 aims to fix the CI

in case anything weird is being noticed and communicated by
ipmitool, try to display anything it says

Signed-off-by: Dan Mick <[email protected]>
@dmick
Copy link
Member Author

dmick commented Jul 22, 2023

rebased on main after merging #1870, tests pass now

@dmick dmick merged commit 1426592 into ceph:main Jul 22, 2023
9 checks passed
@dmick dmick deleted the wip-pexpect branch July 22, 2023 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants