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

disk_check: Script updated #1747

Merged
merged 2 commits into from
Aug 24, 2021

Conversation

renukamanavalan
Copy link
Contributor

@renukamanavalan renukamanavalan commented Aug 7, 2021

What I did

Have independent subdirs for each mounted dir to avoid any collisions of files/dirs by same name.
Adopt for older version of python3

How I did it

Changes:

  1. Individual subdirs for each dir to be mounted
  2. subprocess args made compatible with older version of python3 (tested in version 3.5.3)

How to verify it

  1. Simulate read-only state
  2. Run this script
  3. Test ssh via new tacacs user (who had not logged in earlier)

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

Changes:
1) Individual subdirs for each dir to be mounted
2) subprocess args to be in sync with python3 version in 201811 & 201911
@lguohan
Copy link
Contributor

lguohan commented Aug 17, 2021

@qiluo-msft , can you take priority to review this one?

ret = proc.returncode
if ret:
log_err("failed: ret={} cmd={}".format(ret, cmd))
else:
log_info("ret={} cmd: {}".format(ret, cmd))

if proc.stdout:
log_info("stdout: {}".format(str(proc.stdout)))
log_info("stdout: {}".format(proc.stdout.decode("utf-8")))
Copy link
Contributor

@qiluo-msft qiluo-msft Aug 18, 2021

Choose a reason for hiding this comment

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

"utf-8"

You can use default parameter value. #WontFix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prefer to keep it explicit. Any issue with that.

@@ -26,7 +27,7 @@
"workdir": "/tmp/tmpy",
"mounts": "overlay_tmpx blahblah",
"err": "/tmpx is not read-write|READ-ONLY: Mounted ['/tmpx'] to make Read-Write",
"cmds": ['mount -t overlay overlay_tmpx -o lowerdir=/tmpx,upperdir=/tmp/tmpx,workdir=/tmp/tmpy /tmpx']
"cmds": ['mount -t overlay overlay_tmpx -o lowerdir=/tmpx,upperdir=/tmp/tmpx/tmpx,workdir=/tmp/tmpy/tmpx /tmpx']
Copy link
Contributor

@qiluo-msft qiluo-msft Aug 18, 2021

Choose a reason for hiding this comment

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

upperdir=/tmp/tmpx/tmpx

Could you explain why you need test code change when you change implementation details? Could you make test code not depends on the implementation? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a base change. We use explicit subdir under upper & work for each dir to mount.

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

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

Could you refine the PR title (and the title during squash merge)? It is not clear what you plan to adopt? Audience know nothing about 201811/201911 adoption requirement. I guess you mean adapt code to be compatible with python2?

@renukamanavalan renukamanavalan merged commit e12c1c8 into sonic-net:master Aug 24, 2021
@renukamanavalan renukamanavalan changed the title disk_check: Script updated to run good in 201811 & 201911 disk_check: Script updated Aug 24, 2021
renukamanavalan added a commit to renukamanavalan/sonic-utilities that referenced this pull request Oct 11, 2021
…1747)

What I did
Have independent subdirs for each mounted dir to avoid any collisions of files/dirs by same name.
Adopt for older version of python3

How I did it
Changes:
Individual subdirs for each dir to be mounted
subprocess args made compatible with older version of python3 (tested in version 3.5.3)

How to verify it
Simulate read-only state
Run this script
Test ssh via new tacacs user (who had not logged in earlier)
renukamanavalan added a commit to renukamanavalan/sonic-utilities that referenced this pull request Oct 11, 2021
…1747)

What I did
Have independent subdirs for each mounted dir to avoid any collisions of files/dirs by same name.
Adopt for older version of python3

How I did it
Changes:
Individual subdirs for each dir to be mounted
subprocess args made compatible with older version of python3 (tested in version 3.5.3)

How to verify it
Simulate read-only state
Run this script
Test ssh via new tacacs user (who had not logged in earlier)
yxieca pushed a commit that referenced this pull request Oct 15, 2021
…ly (#1873)

* disk_check: Check & mount RO as RW using tmpfs (#1569)

What I did
There is a bug that occasionally turn root-overlay as RO. This makes /etc & /home as RO. This blocks any new remote user login, as that needs to write into /etc & /home.

This tool scans /etc & /home (or given dirs) as in RW or RO state. If RO, it could create a writable overlay using tmpfs.
This is transient and stays until next reboot. Any write after the overlay will be lost upon reboot.

But this allows new remote users login.

How I did it
Create upper & work dirs in /run/mount (tmpfs). Mount /etc & /home as lowerdirs and use the same name for final merge. This allows anyone opening a file in /etc or /home to operate on the merged overlay, transparently.

How to verify it
Mount any dir on tmpfs ( mount -t tmpfs tmpfs test_dir)
remount as RO (mount -o remount,ro test_dir)
Pass that dir to this script. (disk_check.py -d ./test_dir)
Now it should be RW

* disk_check updates: (#1736)

1) Set default loglevel to SYSLOG_ERR
2) Make log level configurable via args

* disk_check: Script updated to run good in 201811 & 201911 (#1747)

What I did
Have independent subdirs for each mounted dir to avoid any collisions of files/dirs by same name.
Adopt for older version of python3

How I did it
Changes:
Individual subdirs for each dir to be mounted
subprocess args made compatible with older version of python3 (tested in version 3.5.3)

How to verify it
Simulate read-only state
Run this script
Test ssh via new tacacs user (who had not logged in earlier)
qiluo-msft pushed a commit that referenced this pull request Oct 27, 2021
What I did
Have independent subdirs for each mounted dir to avoid any collisions of files/dirs by same name.
Adopt for older version of python3

How I did it
Changes:
Individual subdirs for each dir to be mounted
subprocess args made compatible with older version of python3 (tested in version 3.5.3)

How to verify it
Simulate read-only state
Run this script
Test ssh via new tacacs user (who had not logged in earlier)
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 18, 2022
Submodule update for sonic-utilties

```
48035d7 [202012] [techsupport] Techsupport Error Reporting pending fixes (sonic-net#1854)
8b2ec09 Fix log_ssd_health hang issue (sonic-net#1904)
ac9c425 Fix the option missing in kernel config issue (sonic-net#1888)
5cc9417 disk_check: Script updated to run good in 201811 & 201911 (sonic-net#1747)
```
@renukamanavalan renukamanavalan deleted the disk_chk_log branch September 16, 2022 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants