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

Adds a bind mount from host to /usr/share/stormond/ directory on pmon container #18122

Merged
merged 11 commits into from
May 18, 2024

Conversation

assrinivasan
Copy link
Contributor

@assrinivasan assrinivasan commented Feb 17, 2024

Why I did it

This is a part of a larger commit that adds a storage monitoring daemon to SONiC. This commit is needed to that storagemon daemon can save FS stats JSON file to disk in the event of planned reboots and unintentional powercycles.

SONiC Storage Monitoring Daemon HLD

Also added psutil module to perform process and system monitoring operations pythonically.

Work item tracking
  • Microsoft ADO (number only): 17468992

How I did it

  • Added a rule to create the directory on the pmon container
  • Added a rule to create a bind-mount

How to verify it

Flash a switch with image containing the changes.
Run:

root@str2-7050cx3-acs-13:~# docker inspect pmon

and verify the following parameters in the "mounts" section:

        "Mounts": [
            .
            .
            .
            {
                "Type": "bind",
                "Source": "/host/pmon/stormond",
                "Destination": "/usr/share/stormond",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            },
            .
            .
            .
        ]

Additionally, you can run the following steps:

  1. Navigate to /host/pmon/stormond directory on the host and create an empty file
  2. Enter the pmon container and navigate to /usr/share/stormond
  3. Verify that the file created in the host is seen here
  4. Add text to this file
  5. Exit the docker container
  6. cat the file on the host and verify that the text you added is seen here
root@str2-7050cx3-acs-13:/host# cd pmon/
root@str2-7050cx3-acs-13:/host/pmon# ls
stormond
root@str2-7050cx3-acs-13:/host/pmon# cd stormond/
root@str2-7050cx3-acs-13:/host/pmon/stormond# touch ashwin.txt
root@str2-7050cx3-acs-13:/host/pmon/stormond# docker exec -it pmon bash
root@str2-7050cx3-acs-13:/# cd /usr/share/stormond/
root@str2-7050cx3-acs-13:/usr/share/stormond# ls
ashwin.txt
root@str2-7050cx3-acs-13:/usr/share/stormond# ls -al
total 8
drwxr-xr-x 2 root root 4096 Feb 19 04:06 .
drwxr-xr-x 3 root root 4096 Feb 19 02:04 ..
-rw-r--r-- 1 root root    0 Feb 19 04:06 ashwin.txt
root@str2-7050cx3-acs-13:/usr/share/stormond# echo "Bind mount successful?" > ashwin.txt
root@str2-7050cx3-acs-13:/usr/share/stormond# exit
exit
root@str2-7050cx3-acs-13:/host/pmon/stormond# cat ashwin.txt
Bind mount successful?
root@str2-7050cx3-acs-13:/host/pmon/stormond#

As a third test:

Run ls -alirth in both the /host/pmon/stormond dir on the host and /usr/share/stormond dir in the pmon container and verify that the inode numbers match.

root@str2-7050cx3-acs-13:/host/pmon/stormond# ls -alirth
total 12K
129546 drwxr-xr-x 3 root root 4.0K Feb 19 04:06 ..
129554 drwxr-xr-x 2 root root 4.0K Feb 19 04:06 .
129555 -rw-r--r-- 1 root root   23 Feb 19 04:07 ashwin.txt

root@str2-7050cx3-acs-13:/host/pmon/stormond# docker exec -it pmon bash
root@str2-7050cx3-acs-13:/# cd /usr/share/stormond/
root@str2-7050cx3-acs-13:/usr/share/stormond# ls -alirth
total 12K
 33618 drwxr-xr-x 3 root root 4.0K Feb 19 02:04 ..
129554 drwxr-xr-x 2 root root 4.0K Feb 19 04:06 .
129555 -rw-r--r-- 1 root root   23 Feb 19 04:07 ashwin.txt
root@str2-7050cx3-acs-13:/usr/share/stormond#

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

  • custom master image

Description for the changelog

adds bind mount from /host/pmon/stormond on the host to /usr/share/stormond on the pmon container as part of the larger stormon daemon feature.

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@assrinivasan assrinivasan marked this pull request as ready for review February 19, 2024 04:11
@assrinivasan assrinivasan changed the title Adds a bind mount from /host on the host to pmon container Adds a bind mount from host to /host/storagemon directory on pmon container Feb 19, 2024
@assrinivasan assrinivasan changed the title Adds a bind mount from host to /host/storagemon directory on pmon container Adds a bind mount from host to /usr/share/storagemon directory on pmon container Apr 2, 2024
@assrinivasan
Copy link
Contributor Author

/azp run

Copy link

Commenter does not have sufficient privileges for PR 18122 in repo sonic-net/sonic-buildimage

@assrinivasan assrinivasan changed the title Adds a bind mount from host to /usr/share/storagemon directory on pmon container Adds a bind mount from host to /usr/share/stormond/ directory on pmon container May 15, 2024
@prgeor
Copy link
Contributor

prgeor commented May 15, 2024

@assrinivasan please point to the HLD in the PR descripton

@assrinivasan
Copy link
Contributor Author

assrinivasan commented May 15, 2024

@assrinivasan please point to the HLD in the PR descripton

Done.

prgeor
prgeor previously approved these changes May 16, 2024
@prgeor
Copy link
Contributor

prgeor commented May 16, 2024

@lguohan please help merge

@assrinivasan
Copy link
Contributor Author

/azpw ms_conflict

1 similar comment
@assrinivasan
Copy link
Contributor Author

/azpw ms_conflict

@assrinivasan
Copy link
Contributor Author

@saiarcot895 @prgeor I'm not sure why we are seeing an ms_conflict issue. I have verified that the three files I am changing here do not have any conflicts with the corresponding internal repo files.

@assrinivasan
Copy link
Contributor Author

/azpw ms_conflict

@assrinivasan
Copy link
Contributor Author

@lguohan all checks have now passed. Could you please help merge?
cc @prgeor

@lguohan lguohan merged commit 2fb29d3 into sonic-net:master May 18, 2024
19 checks passed
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.

4 participants