Update fast-reboot script to boot next selected image#112
Update fast-reboot script to boot next selected image#112lguohan merged 3 commits intosonic-net:masterfrom
Conversation
Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>
pavel-shirshov
left a comment
There was a problem hiding this comment.
Approve with the comment
scripts/fast-reboot
Outdated
| INITRD="/initrd.img" | ||
| BOOT_OPTIONS=$(cat /proc/cmdline) | ||
| NEXT_SONIC_IMAGE=$(sonic_installer list | grep "Next: " | cut -d ' ' -f 2) | ||
| BOOT_OPTIONS=$(cat /host/grub/grub.cfg | sed "/$NEXT_SONIC_IMAGE'/,/}/"'!'"g" | grep linux) |
There was a problem hiding this comment.
On my test machine previous version of BOOT_OPTIONS was
BOOT_IMAGE=/image-HEAD.230-cce2a36/boot/vmlinuz-3.16.0-4-amd64 root=/dev/sda4 rw console=tty0 console=ttyS1,9600n8 quiet loop=image-HEAD.230-cce2a36/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor varlog_size=4096 fast-reboot
Your version of the same variable is
linux /image-HEAD.230-cce2a36/boot/vmlinuz-3.16.0-4-amd64 root=/dev/sda4 rw console=tty0 console=ttyS1,9600n8 quiet loop=image-HEAD.230-cce2a36/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor varlog_size=4096
So difference is s/BOOT_IMAGE=/linux /
I've checked your script with my fast-reboot test. The test passes.
So honestly, I don't know this "BOOT_IMAGE" is critical or not.
So I'll approve.
But it would be nice of you to convert BOOT_OPTIONS to "BOOT_IMAGE=" format.
There was a problem hiding this comment.
Please convert your BOOT_OPTIONS to "BOOT_IMAGE" format. You can do this by appending
| sed -e 's/\s*linux\s*/BOOT_IMAGE=/' into your BOOT_OPTIONS. (after grep linux).
Also you need to adjust your KERNEL_IMAGE option
There was a problem hiding this comment.
it worked... but you're right need to fix this
I see some regression. Let me double check.
pavel-shirshov
left a comment
There was a problem hiding this comment.
Current version increase fast-reboot time by 11 seconds on my test switch.
scripts/fast-reboot
Outdated
| KERNEL_IMAGE="/host$(echo $BOOT_OPTIONS | cut -d ' ' -f 2)" | ||
| INITRD=$(echo $KERNEL_IMAGE | sed 's/vmlinuz/initrd.img/g') | ||
|
|
||
| case "$BOOT_OPTIONS" in |
There was a problem hiding this comment.
You can remove this block and append fast-reboot option unconditionally. You read the command line from the file
scripts/fast-reboot
Outdated
| INITRD="/initrd.img" | ||
| BOOT_OPTIONS=$(cat /proc/cmdline) | ||
| NEXT_SONIC_IMAGE=$(sonic_installer list | grep "Next: " | cut -d ' ' -f 2) | ||
| BOOT_OPTIONS=$(cat /host/grub/grub.cfg | sed "/$NEXT_SONIC_IMAGE'/,/}/"'!'"g" | grep linux) |
There was a problem hiding this comment.
Please convert your BOOT_OPTIONS to "BOOT_IMAGE" format. You can do this by appending
| sed -e 's/\s*linux\s*/BOOT_IMAGE=/' into your BOOT_OPTIONS. (after grep linux).
Also you need to adjust your KERNEL_IMAGE option
Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>
|
we also need aboot version of it, but let's do that in a separate pr. |
|
The last change looks ok, except reusing of BOOT_OPTIONS twice. |
Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>
|
retest this please |
…riable (sonic-net#112) Previously, chassisd and thermalctld assumed that the swsscommon library would not be installed in the unit testing environment. This is not a valid assumption, and would cause unit tests to fail if swsscommon was available in the unit test environement, because it would get imported, but there would be no Redis DB to communicate with. This PR uses environment variables, which are set by the unit tests themselves, to determine whether to load the real or mock libraries. This solution is similar to what is done in sonic-utilities.
following PR's : Implement cbgpPeer2State in CiscoBgp4MIB (sonic-net#119) Fix index nodes in LLDP tables whose access right is not-accessible. (sonic-net#112) Fix quagga/FRR parser on IPv6 BGP sessions (sonic-net#122) [lint] Fix some syntax errors or warnings (sonic-net#127) Update README.md: Add lgtm badges (sonic-net#128) [Multi-asic]: Support multi-asic platform (sonic-net#126) Simplify test code (sonic-net#132) [Multi-asic]: Namespace support for LLDP and Sensor tables (sonic-net#131) Fix undefined variable and warning message (sonic-net#134) Fix SNMP AgentX socket connection timeout when using Namespace.get_all() (sonic-net#140) [Namespace] Fix interfaces counters in InterfacesMIB RFC 2863 (sonic-net#141) Fix LGTM reported alert of PR#141 (sonic-net#142)
Parse 'Extended Specification compliance' as independent field (sonic-net#112)
…-net#112) Previously 'Extended Specification compliance' was added as part of "sfp_info_bulk", this will request all the vendors to update the related platform API implementation due to the width change of "sfp_info_bulk". To avoid this, make it parsed separately, it will not impact vendors who haven't update the platform API implementation.
sonic-net#112) ```<br>* 8ece3030 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-utilities into 202412 (2025-02-10) [Sonic Automation] * 04b60e2 - (origin/202411) Fix call for spanning-tree commands in dump script (sonic-net#3752) (2025-02-07) [mssonicbld] * bbe29ae - [show][interface] Add changes for show interface errors command (sonic-net#3749) (2025-02-04) [mssonicbld]<br>```
- What I did
Updated fast-reboot script to boot image which would boot after regular reboot
- How I did it
When deciding which kernel to kexec script now checks what is actually scheduled to boot in GRUB
- How to verify it
Install new image using SONiC-to-SONiC method (not from ONIE) and execute fast-reboot.
Make sure newly installed version booted
- Description for the changelog