Skip to content

Commit

Permalink
[fwutil]: Fix next image mount (sonic-net#1533)
Browse files Browse the repository at this point in the history
- What I did
Fixed next image mount

- How I did it
Removed lstrip

- How to verify it
root@sonic:/home/admin# fwutil update chassis component <component_name> fw -i next

Signed-off-by: Nazarii Hnydyn <nazariig@nvidia.com>
  • Loading branch information
nazariig authored Apr 6, 2021
1 parent 305a3e4 commit b1097b2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fwutil/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,10 @@ class SquashFs(object):
OVERLAY_MOUNTPOINT_TEMPLATE = "/tmp/image-{}-overlay"

def __init__(self):
image_stem = self.next_image.lstrip(self.OS_PREFIX)
image_stem = self.next_image

if image_stem.startswith(self.OS_PREFIX):
image_stem = image_stem[len(self.OS_PREFIX):]

self.fs_path = self.FS_PATH_TEMPLATE.format(image_stem)
self.fs_rw = self.FS_RW_TEMPLATE.format(image_stem)
Expand Down Expand Up @@ -245,6 +248,9 @@ def mount_next_image_fs(self):
)
subprocess.check_call(cmd, shell=True)

if not (os.path.exists(self.fs_rw) and os.path.exists(self.fs_work)):
return self.fs_mountpoint

os.mkdir(self.overlay_mountpoint)
cmd = "mount -n -r -t overlay -o lowerdir={},upperdir={},workdir={} overlay {}".format(
self.fs_mountpoint,
Expand Down

0 comments on commit b1097b2

Please sign in to comment.