sonic-utilities
sonic-utilities copied to clipboard
Added a script to sync FS I/O reads/writes just before OS-level reboot
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:
-
A script
fsio-syncthat 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. -
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
- Flash image with this change (and storagemon daemon addition) on the switch.
- Navigate to
/host/pmon/storagemonand cat the fs-stats-<<DISK>> file - Stop the pmon container
- Run
/usr/local/bin/fsio-sync - 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
/azp run Azure.sonic-utilities
Azure Pipelines successfully started running 1 pipeline(s).