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

[install.sh] install different platform image should be blocked #13153

Closed
wants to merge 1 commit into from
Closed

[install.sh] install different platform image should be blocked #13153

wants to merge 1 commit into from

Conversation

inspurSDN
Copy link

@inspurSDN inspurSDN commented Dec 23, 2022

How I did it

  1. Check platform and asic before install the image, if the platform and asic version is different with running image, the install action should be blocked.

  2. This commit can block wrong installation in ONIE and CLI env.

Why I did it

  • Install different platform-asic image will make kernel can't be reload correctly.

Steps to reproduce Bug

  1. Install x86 image in CLI
  2. Install arm64 image in CLI
  3. Install x86 image in CLI
  4. reboot
  5. the kernel can't be loaded, user need to insatll image by ONIE to recover it

How to verify it

EX: Install build arm64 image in x86 platform, the install operation will execute fail.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211

Description for the changelog

Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

- What I did
1. Check platform and asic before install the image,
if the platform and asic version is different with running image, the install action should be blocked.

2. This commit can block wrong installation in ONIE and CLI env.

- Why I did it
Install different platform-asic image will make kernel can't be reload correctly.

Steps to reproduce Bug

1. Install x86 image in CLI
2. Install arm64 image in CLI
3. Install x86 image in CLI
4. reboot
5. the kernel can't be loaded, user need to insatll image by ONIE to recover it

- How to verify it
EX: Install build arm64 image in x86 platform, the install operation will execute fail.
@lguohan
Copy link
Collaborator

lguohan commented Jan 3, 2023

@qiluo-msft , can you help and assign someone review this?

@qiluo-msft qiluo-msft requested a review from wen587 January 3, 2023 18:54
onie_running_arch=`cat $machine_conf_path | grep onie_arch | sed -n "s/^onie_arch=\(.*\)$/\1/p"`
onie_running_switch_asic=`cat $machine_conf_path | grep onie_switch_asic | sed -n "s/^onie_switch_asic=\(.*\)$/\1/p"`

# bcm aisc is broadcom
Copy link
Collaborator

Choose a reason for hiding this comment

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

aisc

typo?

@qiluo-msft
Copy link
Collaborator

There is a similar feature #8814. Could you check if this is duplicated or partially overlapped?

elif [ "$install_env" != "build" ]; then
echo "cannot find machine.conf"
exit 1
fi

onie_running_arch=`cat $machine_conf_path | grep onie_arch | sed -n "s/^onie_arch=\(.*\)$/\1/p"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

onie_running_arch

read_conf_file function is a general parsing function for etc/machine.conf. So you do not need to parse these variables manually.

elif [ "$install_env" != "build" ]; then
echo "cannot find machine.conf"
exit 1
fi

onie_running_arch=`cat $machine_conf_path | grep onie_arch | sed -n "s/^onie_arch=\(.*\)$/\1/p"`
onie_running_switch_asic=`cat $machine_conf_path | grep onie_switch_asic | sed -n "s/^onie_switch_asic=\(.*\)$/\1/p"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

onie_running_switch_asic

I am not sure if the code is working for old version of ONIE. Suggest you test the scenarios that these variables are not existing.

onie_running_switch_asic=`cat $machine_conf_path | grep onie_switch_asic | sed -n "s/^onie_switch_asic=\(.*\)$/\1/p"`

# bcm aisc is broadcom
if [ "$onie_running_switch_asic" = "bcm" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

for kvm image, its onie_switch_asic is 'qemu'.

@wen587
Copy link
Contributor

wen587 commented Jan 5, 2023

I prefer to keep the original design.
We have some internal usages. We want to avoid the installation of the public image on internal usage though they are sharing the same ASIC.

@inspurSDN inspurSDN closed this by deleting the head repository Mar 22, 2023
@qiluo-msft
Copy link
Collaborator

@inspurSDN I see you closed this issue. Is your original issue still open? You may create a Github issue.

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