sonic-utilities icon indicating copy to clipboard operation
sonic-utilities copied to clipboard

Added a script to sync FS I/O reads/writes just before OS-level reboot

Open ashwnsri opened this issue 1 year ago • 2 comments

Added a script to sync FS I/O reads/writes just before reboot Also renamed ssdutil import to match corresponding change in sonic-platform-common

What I did

This PR adds the following:

  1. A script fsio-sync that is called just before OS-level reboot. This script syncs the Filesystem I/O reads and writes to a location on the disk, and would be picked up by the newly implemented storagemon daemon upon reboot.

  2. Changed the import to match the sister PR on sonic-platform-common that renames sonic_ssd --> sonic_storage.

How I did it

Created a script that does the following:

  • It calls get_storage_disks() to populate the devices list with storage device names.
  • For each device in the devices list, it iterates through the lines of the /proc/diskstats file to find the line corresponding to the current device.
  • If found, it extracts the total number of reads (fs_reads) and writes (fs_writes) for the device.
  • It constructs the filename for the file where the read and write counts will be stored, based on the device name and FSSTATS_PREFIX.
  • It writes the read and write counts to the file.

How to verify it

  1. Flash image with this change (and storagemon daemon addition) on the switch.
  2. Navigate to /host/pmon/storagemon and cat the fs-stats-<<DISK>> file
  3. Stop the pmon container
  4. Run /usr/local/bin/fsio-sync
  5. Cat the above file again -- you would see updated read and write values.

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

N/A

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

N/A

ashwnsri avatar Feb 20 '24 02:02 ashwnsri

/azp run Azure.sonic-utilities

xumia avatar Feb 22 '24 04:02 xumia

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Feb 22 '24 04:02 azure-pipelines[bot]