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

Improve SONiC disk checker to handle disk full case and mount overlay fs to allow remote user login. #3700

Merged
merged 22 commits into from
Feb 10, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix formatting and add missing newline
liuh-80 authored Jan 14, 2025
commit c6416c7da970fa4f2d77623243bb6cd8afe24846
6 changes: 4 additions & 2 deletions scripts/disk_check.py
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ def event_pub(event):
event_publish(events_handle, EVENTS_PUBLISHER_TAG, param_dict)


def test_disk_full(dirs):
def test_disk_full(dirs):
for d in dirs:
space = os.statvfs(d)
if space.f_bavail < FREE_SPACE_THRESHOLD:
@@ -141,7 +141,7 @@ def do_mnt(dirs, overlay_prefix):
os.mkdir(d_upper)
os.mkdir(d_work)

ret = run_cmd(["mount", "-t", "overlay", "{}_{}".format(overlay_prefix, d_name),\
ret = run_cmd(["mount", "-t", "overlay", "{}_{}".format(overlay_prefix, d_name),
"-o", "lowerdir={},upperdir={},workdir={}".format(d, d_upper, d_work), d])
if ret:
break
@@ -152,9 +152,11 @@ def do_mnt(dirs, overlay_prefix):
log_info("{} are mounted as Read-Write".format(dirs))
return ret


def do_unmnt(dirs, overlay_prefix):
for d in dirs:
d_name = get_dname(d)

ret = run_cmd(["umount", "-l", "{}_{}".format(overlay_prefix, d_name)])
if ret:
break