Skip to content

Update fast-reboot script to boot next selected image#112

Merged
lguohan merged 3 commits intosonic-net:masterfrom
andriymoroz-mlnx:fast_reboot_next
Oct 7, 2017
Merged

Update fast-reboot script to boot next selected image#112
lguohan merged 3 commits intosonic-net:masterfrom
andriymoroz-mlnx:fast_reboot_next

Conversation

@andriymoroz-mlnx
Copy link
Collaborator

- 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

Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>
pavel-shirshov
pavel-shirshov previously approved these changes Oct 5, 2017
Copy link
Contributor

@pavel-shirshov pavel-shirshov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve with the comment

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it worked... but you're right need to fix this

@pavel-shirshov pavel-shirshov dismissed their stale review October 5, 2017 00:12

I see some regression. Let me double check.

Copy link
Contributor

@pavel-shirshov pavel-shirshov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current version increase fast-reboot time by 11 seconds on my test switch.

KERNEL_IMAGE="/host$(echo $BOOT_OPTIONS | cut -d ' ' -f 2)"
INITRD=$(echo $KERNEL_IMAGE | sed 's/vmlinuz/initrd.img/g')

case "$BOOT_OPTIONS" in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this block and append fast-reboot option unconditionally. You read the command line from the file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@lguohan
Copy link
Contributor

lguohan commented Oct 5, 2017

we also need aboot version of it, but let's do that in a separate pr.

@pavel-shirshov
Copy link
Contributor

The last change looks ok, except reusing of BOOT_OPTIONS twice.
I'll recheck everything and let you know (currently my testbed is not available)

Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>
@lguohan lguohan closed this Oct 7, 2017
@lguohan lguohan reopened this Oct 7, 2017
@lguohan
Copy link
Contributor

lguohan commented Oct 7, 2017

retest this please

@lguohan lguohan merged commit 6103ce8 into sonic-net:master Oct 7, 2017
@andriymoroz-mlnx andriymoroz-mlnx deleted the fast_reboot_next branch October 9, 2017 06:54
vdahiya12 pushed a commit to vdahiya12/sonic-utilities that referenced this pull request Jul 23, 2021
…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.
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 28, 2022
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)
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 28, 2022
  Parse 'Extended Specification compliance' as independent field (sonic-net#112)
mihirpat1 pushed a commit to mihirpat1/sonic-utilities that referenced this pull request Sep 15, 2023
…-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.
Junchao-Mellanox pushed a commit to Junchao-Mellanox/sonic-utilities that referenced this pull request Mar 20, 2025
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>```
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