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

[armhf][sonic-installer] Fix the issue of sonic-installer list after set-default and cleanup #2479

Merged
merged 1 commit into from
Nov 9, 2022

Conversation

mlok-nokia
Copy link
Contributor

What I did

sonic-installer list will throw a exception when install images as the following step

(onie-nos-install ) Install first image A
(sonic-installer) Install Image B and not reboot it
(sonic-installer) set default to back to Image A
sudo sonic-installer cleanup
At this time, executing sonic-installer list will throw exception

How I did it

Modify the get_next_image() in uboot.py to check and return index 1 when the images list contains two elements.
This PR should work with sonic-net/sonic-buildimage#12609

This PR is needed by branch 202012 and 2022o5

How to verify it

Using the following test case to verify it
Case 1:

  1. (onie-nos-install ) Install first image A (SONiC-OS-202012.0-dirty-20221104.031351)
  2. (sonic-installer) Install Image B (SONiC-OS-202205.0-dirty-20221104.050857) and not reboot it
  3. (sonic-installer) set default to back to Image A
  4. sudo sonic-installer cleanup
  5. execute sonic-installer list, it should list image A as expected
admin@sonic:~$ sudo sonic-installer list
Current: SONiC-OS-202012.0-dirty-20221104.031351
Next: SONiC-OS-202012.0-dirty-20221104.031351
Available: 
SONiC-OS-202012.0-dirty-20221104.031351

Case 2:
6) sonic-installer install an image C (SONIC-OS-202205.0-dirty-20221104.050348)
7) sonic-installer list. It should lis image as expected

admin@sonic:~$ sudo sonic-installer list
Current: SONiC-OS-202012.0-dirty-20221104.031351
Next: SONIC-OS-202205.0-dirty-20221104.050348
Available: 
SONiC-OS-202012.0-dirty-20221104.031351
SONIC-OS-202205.0-dirty-20221104.050348

Case 3:
8) reboot the system.
9) sonic-installer list

admin@sonic:~$ sudo sonic-installer list
Current: SONIC-OS-202205.0-dirty-20221104.050348
Next: SONIC-OS-202205.0-dirty-20221104.050348
Available: 
SONiC-OS-202012.0-dirty-20221104.031351
SONIC-OS-202205.0-dirty-20221104.050348

Case 4
10) sonic-installer install the image A.
11) it should be indicated that the image has been installed and just set to default.

admin@ixs-7215-pizza9:~$ sudo sonic-installer install /tmp/sonic-marvell-armhf.bin
New image will be installed, continue? [y/N]: y
Image SONiC-OS-202012.0-dirty-20221104.031351 is already installed. Setting it as default...
Command: /usr/bin/fw_setenv boot_next "run sonic_image_2"

Command: sync;sync;sync

Command: sleep 3

Done

case 5:
12 execute sonic-installer list

Current: SONIC-OS-202205.0-dirty-20221104.050348
Next: SONiC-OS-202012.0-dirty-20221104.031351
Available: 
SONiC-OS-202012.0-dirty-20221104.031351
SONIC-OS-202205.0-dirty-20221104.050348

Case 6:
13) reboot the device
14) and sonic-installer list

admin@sonic:~$ sudo sonic-installer list
Current: SONiC-OS-202012.0-dirty-20221104.031351
Next: SONiC-OS-202012.0-dirty-20221104.031351
Available: 
SONiC-OS-202012.0-dirty-20221104.031351
SONIC-OS-202205.0-dirty-20221104.050348

Case 7:
15) sonic-installer set-default to image C (SONIC-OS-202205.0-dirty-20221104.050348)
16) sonic-installer list

Current: SONiC-OS-202012.0-dirty-20221104.031351
Next: SONIC-OS-202205.0-dirty-20221104.050348
Available: 
SONiC-OS-202012.0-dirty-20221104.031351
SONIC-OS-202205.0-dirty-20221104.050348

Case 8:
17) reboot the device
18) sonic-installer list

Current: SONIC-OS-202205.0-dirty-20221104.050348
Next: SONIC-OS-202205.0-dirty-20221104.050348
Available: 
SONiC-OS-202012.0-dirty-20221104.031351
SONIC-OS-202205.0-dirty-20221104.050348

Case 9:
19) install image B (SONiC-OS-202205.0-dirty-20221104.050857)
20) sonic-installer list

Current: SONIC-OS-202205.0-dirty-20221104.050348
Next:  SONiC-OS-202205.0-dirty-20221104.050857
Available: 
SONiC-OS-202205.0-dirty-20221104.050857
SONIC-OS-202205.0-dirty-20221104.050348

Case 10:
21) reboot the device
22) sonic-installer list

Current: SONiC-OS-202205.0-dirty-20221104.050857
Next:  SONiC-OS-202205.0-dirty-20221104.050857
Available: 
SONiC-OS-202205.0-dirty-20221104.050857
SONIC-OS-202205.0-dirty-20221104.050348

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

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

@mlok-nokia
Copy link
Contributor Author

@carl-nokia @jon-nokia Please review this PR for the sonic-installer list issue on armhf platform

…the set-default and cleanup

Signed-off-by: mlok <marty.lok@nokia.com>
@mlok-nokia mlok-nokia force-pushed the armhf-installer-list branch from 7f7a321 to 9f4a2da Compare November 7, 2022 23:32
@mlok-nokia
Copy link
Contributor Author

mlok-nokia commented Nov 8, 2022

@Blueve Hi Jing, this is the second PR which is needed for addressing the issue of sonic-installer list for the armhf platform. Please review it. The change of the installer_bootloader_uboot_test.py is not applicable to 202012 and 202205 branch since this file doesn't exist these two branches.

@Blueve
Copy link
Contributor

Blueve commented Nov 9, 2022

@mlok-nokia

The change of the installer_bootloader_uboot_test.py is not applicable to 202012 and 202205 branch since this file doesn't exist these two branches.

Will you submit PR to 202012 and 202205?

@Blueve Blueve merged commit d1ca2cd into sonic-net:master Nov 9, 2022
yxieca pushed a commit that referenced this pull request Nov 10, 2022
…set-default and cleanup (#2479)

What I did
sonic-installer list will throw a exception when install images as the following step

(onie-nos-install ) Install first image A
(sonic-installer) Install Image B and not reboot it
(sonic-installer) set default to back to Image A
sudo sonic-installer cleanup
At this time, executing sonic-installer list will throw exception

How I did it
Modify the get_next_image() in uboot.py to check and return index 1 when the images list contains two elements.
This PR should work with sonic-net/sonic-buildimage#12609

This PR is needed by branch 202012 and 2022o5

Signed-off-by: mlok <marty.lok@nokia.com>
@qiluo-msft
Copy link
Contributor

This commit could not be cleanly cherry-picked to 202012. Please submit another PR.

mlok-nokia added a commit to mlok-nokia/sonic-utilities that referenced this pull request Nov 14, 2022
…set-default and cleanup (sonic-net#2479)

What I did
sonic-installer list will throw a exception when install images as the following step

(onie-nos-install ) Install first image A
(sonic-installer) Install Image B and not reboot it
(sonic-installer) set default to back to Image A
sudo sonic-installer cleanup
At this time, executing sonic-installer list will throw exception

How I did it
Modify the get_next_image() in uboot.py to check and return index 1 when the images list contains two elements.
This PR should work with sonic-net/sonic-buildimage#12609

This PR is needed by branch 202012 and 2022o5

Signed-off-by: mlok <marty.lok@nokia.com>
(cherry picked from commit d1ca2cd)
@mlok-nokia
Copy link
Contributor Author

This commit could not be cleanly cherry-picked to 202012. Please submit another PR.

I have created the following PR to 202012. Please review it
#2497

Blueve pushed a commit that referenced this pull request Nov 16, 2022
… of sonic-installer list after set-default and cleanup (#2479) (#2497)

What I did
sonic-installer list will throw a exception when install images as the following step

(onie-nos-install ) Install first image A
(sonic-installer) Install Image B and not reboot it
(sonic-installer) set default to back to Image A
sudo sonic-installer cleanup
At this time, executing sonic-installer list will throw exception

How I did it
Modify the get_next_image() in uboot.py to check and return index 1 when the images list contains two elements.
This PR should work with sonic-net/sonic-buildimage#12609

This PR is needed by branch 202012 and 2022o5

Signed-off-by: mlok <marty.lok@nokia.com>
(cherry picked from commit d1ca2cd)
preetham-singh pushed a commit to preetham-singh/sonic-utilities that referenced this pull request Nov 21, 2022
…set-default and cleanup (sonic-net#2479)

What I did
sonic-installer list will throw a exception when install images as the following step

(onie-nos-install ) Install first image A
(sonic-installer) Install Image B and not reboot it
(sonic-installer) set default to back to Image A
sudo sonic-installer cleanup
At this time, executing sonic-installer list will throw exception

How I did it
Modify the get_next_image() in uboot.py to check and return index 1 when the images list contains two elements.
This PR should work with sonic-net/sonic-buildimage#12609

This PR is needed by branch 202012 and 2022o5

Signed-off-by: mlok <marty.lok@nokia.com>
mdanish-kh pushed a commit to mdanish-kh/sonic-utilities that referenced this pull request Nov 23, 2022
…set-default and cleanup (sonic-net#2479)

What I did
sonic-installer list will throw a exception when install images as the following step

(onie-nos-install ) Install first image A
(sonic-installer) Install Image B and not reboot it
(sonic-installer) set default to back to Image A
sudo sonic-installer cleanup
At this time, executing sonic-installer list will throw exception

How I did it
Modify the get_next_image() in uboot.py to check and return index 1 when the images list contains two elements.
This PR should work with sonic-net/sonic-buildimage#12609

This PR is needed by branch 202012 and 2022o5

Signed-off-by: mlok <marty.lok@nokia.com>
@liuh-80
Copy link
Contributor

liuh-80 commented Feb 2, 2023

202012 branch PR merged: #2497

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants