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

[fwutil.md] Fwutil Auto-update support #648

Merged
merged 28 commits into from
Jan 26, 2021
Merged

[fwutil.md] Fwutil Auto-update support #648

merged 28 commits into from
Jan 26, 2021

Conversation

sujinmkang
Copy link
Collaborator

@sujinmkang sujinmkang commented Jul 14, 2020

Update fwutil to support for the automatic fw update with boot/action option based on platform_components.json

@sujinmkang sujinmkang changed the title initial version of platform-fw-update hld Update fwutil to support for the automatic fw update with boot/action option Jul 26, 2020
@sujinmkang sujinmkang requested a review from nazariig July 27, 2020 21:31
"script": "/usr/share/sonic/<platform_name>/<onie_platform>/fw_update/bios_fw_update",
"version": "0ACLH003_02.02.010"
"required_reboot": "None"
"immediate_action": "No"
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang IMHO, this should be fetched automatically by Platform API if needed.
The config file should be simple and clear.

Use case: the same firmware package may have a different behaviour based on device vendor/model.
Example: SSD with/without on-the-fly update mode

@@ -340,7 +340,7 @@ The purpose of the update commands group is to provide an interface
for automatic FW installation of various platform components.

Automatic FW installation requires platform_components.json to be created and placed at:
_sonic-buildimage/device/<platform_name>/<onie_platform>/platform_components.json_
_sonic-buildimage/device/<platform_name>/<onie_platform>/platform_fw_updatecomponents.json_
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang Typo? Maybe it's better to have something like platform_fw_updates?

"version": "10"
},
"FPGA": {
"firmware": "/etc/<platform_name>/fw/<onie_platform>/chassis1/fpga.bin",
"firmware": "/usr/share/sonic/<platform_name>/<onie_platform>/fw_update/fpga.bin",
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang Not sure whether this is the right place for fw binaries. Also this may overlap with the sonic_device_data package contents.

...
FW update in progress ...
...
root@sonic:~# fwutil --yes --image=next --boot=any --immediate=yes --component=ssd
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang What about modular platforms? AFAIK, there is no clear restrictions on component names, which means that different modules can share the same component name. And what should be the expected behaviour in that case?

@@ -454,6 +486,24 @@ Warning: <firmware_update_notification>
New FW will be installed, continue? [y/N]: N
Aborted!
```
3. Non modular chassis platform
```bash
root@sonic:~# fwutil --yes --image=next --boot=cold --immediate=yes
Copy link
Collaborator

@nazariig nazariig Aug 2, 2020

Choose a reason for hiding this comment

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

@sujinmkang I suggest to use something like:
fwutil update components fw --yes --image=next --boot=fast

1. Find the available firmware based on boot type and immediate action type from platform specific fw update configuration file.
Exit if no configuration file exists.
2. Update the firmware using the script if it's specified in the configuration. Otherwise, fwutil will use the platform api to update the firmware.
Exit if the update fails in any step.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang I would like to propose a new CLI tree:

fwutil
|--- show
|    |--- version
|    |--- status
|    |--- updates -i|--image=<current|next> -c|--config=<path_to_platform_fw_updates>
|
|--- install
|    |--- chassis
|    |    |--- component <component_name>
|    |         |--- fw -y|--yes <fw_path>
|    |
|    |--- module <module_name>
|         |--- component <component_name>
|              |--- fw -y|--yes <fw_path>
|
|--- update
     |--- chassis
     |    |--- component <component_name>
     |         |--- fw -y|--yes -f|--force -i|--image=<current|next> -c|--config=<path_to_platform_fw_updates>
     |
     |--- module <module_name>
     |    |--- component <component_name>
     |         |--- fw -y|--yes -f|--force -i|--image=<current|next> -c|--config=<path_to_platform_fw_updates>
     |
     |--- components
          |--- fw -y|--yes -f|--force -i|--image=<current|next> -b|--boot=<cold|fast|warm> -c|--config=<path_to_platform_fw_updates>

Copy link
Collaborator

@nazariig nazariig Aug 2, 2020

Choose a reason for hiding this comment

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

@sujinmkang Some thoughts:

  1. In case platform API is not implemented (plugin mode) the fwutil CLI won't be fully available - only automatic installation mode. That's something which need to be highlighted in this design
  2. Platform API should be extended with the new boot argument
  3. How to handle version and script fields in case Platform API is not implemented
  4. Need to extend the design with some output examples for automatic installation mode

@sujinmkang sujinmkang changed the title Update fwutil to support for the automatic fw update with boot/action option FwUtil Auto-update support Aug 12, 2020
@sujinmkang sujinmkang marked this pull request as ready for review August 12, 2020 06:01
...
if [[ -x ${PLATFORM_FW_UPDATE} ]]; then
    debug "updating platform fw for ${REBOOT_TYPE}"
    ${PLATFORM_FW_UPDATE} auto-update --yes --image={NEXT_BOOT_IMAGE} --boot=${REBOOT_TYPE}

Choose a reason for hiding this comment

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

Hi Sujin,

In what scenarios the fwutil command will include a reboot/powercycle? only in cases of immediate_(fast/warm/cold/powercycle)?

Also in few cases the upgrade may require unmount of filesystems and better to include them in the flow of reboot after unmounting filesystems. In that case fwutil can do just the placing of files in correct location and the actual upgrade will be done only as part of the reboot script. In those scenarios if this command just places the file, in what ways the actual upgrade can be included in these scripts?

Copy link

Choose a reason for hiding this comment

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

Do you know the answer about your first question? I also have this question.
####In what scenarios the fwutil command will include a reboot/powercycle? only in cases of immediate_(fast/warm/cold/powercycle)?####

"component": {
"BIOS": {
"firmware": "bios.bin",
"version": "0ACLH003_02.02.010",
Copy link
Contributor

Choose a reason for hiding this comment

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

boot option needs to be added

...
CPLD firmware update is in progress with version 5 (current version 4)
...
CPLD firmware update is completed with version 5 (current version 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

So, in the CPLD example above, the fwutil auto-update will be functionally equivalent to the existing "fwutil install" command, please mention this in the description.

1. Firmware
2. Boot action following after the firmware auto-update process
3. Fwutil action : -a(--autoupdate)
**Utility can be supported for other platform api substitues like `compoenent_update` and `compoenent_install` with |-u(--update)|-i(--install)**
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

"True" : "completed"
"True" : "scheduled"
"False" : Error
```

Choose a reason for hiding this comment

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

The "fwutil show auto-update" command has status as "updated but need a power-cycle". Please explain how these status will be derived from these utility return strings described above.

|
|--- auto_update
|--- fw -i|--image=<current|next> --b|--boot=<any|none|fast|warm|cold|powercycle>
|--- fw -z|--fw-image=<fw_package.tar.gz> --b|--boot=<any|none|fast|warm|cold|powercycle>
Copy link
Collaborator

@nazariig nazariig Nov 18, 2020

Choose a reason for hiding this comment

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

@sujinmkang How do you expect to handle power cycle scenario? SONiC can only distinguish between cold/fast/warm reboots in scope of firmware upgrade framework.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that is good question. I think we should limit this boot option to non/fast/warm/cold.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang Looks good. Please update the design

@@ -184,6 +201,8 @@ fwutil
| |--- version
| |--- status
| |--- updates -i|--image=<current|next>
| |--- updates -z|--fw-image=<fw_package.tar.gz>
Copy link
Collaborator

@nazariig nazariig Nov 18, 2020

Choose a reason for hiding this comment

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

@sujinmkang what is the expected behaviour when --image=next and --fw-image=<fw_package.tar.gz> are provided simultaneously?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should take only one option. my current implementation takes the --fw-image option over --image option. Should we return error when user gives both option for one fwutil call?

From the above `platform_components.json` example, if the platform needs the SSD firmware update, then the auto-update can be triggered with following command.
`$PWD/ssd_fw_update -a $PWD/SSD.bin fast`

##### 2.2.2.4.3.2 Platform Firmware Update Reboot Handle Plugin
Copy link
Collaborator

@nazariig nazariig Nov 18, 2020

Choose a reason for hiding this comment

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

@sujinmkang please elaborate a bit more for a different flows (cold/warm/fast): at which point do you expect to call this plugin?

@@ -462,6 +519,321 @@ Aborted!

**Note:** the default option is _--image=current_

#### 2.2.2.4 Auto-update commands

##### 2.2.2.4.1 Overview
Copy link
Collaborator

@nazariig nazariig Nov 18, 2020

Choose a reason for hiding this comment

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

@sujinmkang in case of boot_action=any what should be the expected behaviour if platform component supports both cold and fast reboot? Do we expect platform API will add this item to both cold_* and fast_* task lists?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As I replied in your previous question, we need to limit the boot action by none/fast/warm/cold. And in the previous comments, we don't support multiple firmware auto update for the same or other boot type.

The Utility should support the minimum requirements to perform the fwutil auto-update interface.
The minimum requirement is that the component api's get_frimware_version, get_firmware_update_notification(), and auto_update_firmware() needs to be supported by the utility.
Here are the interface requirements to support them.
1. {utility} -s(--status) : able to retrieve the current firmware version:
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang how do we expect to use this info in FW tools when we don't have a way to read the original (before the update) firmware version?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This api should retrieve the original version from the platform device. not the update firmware version.

2. {utility} -n(--notification) : able to provide the update complete action :
- equivalent to the component api's get_firmware_update_notification(image_path)
- response : the required action to complete the component installation
3. {utility} -a(--autoupdate) : able to perform the auto-update action :
Copy link
Collaborator

@nazariig nazariig Nov 18, 2020

Choose a reason for hiding this comment

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

@sujinmkang why not to use a set of separate options: e.g. --fw and --boot

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this utility will replace the platform api so I was expecting to pass the firmware path and boot type without any separate option. I will clarify this part.

Copy link

Choose a reason for hiding this comment

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

@sujinmkang From the code changes, the utility -a interface alone has been used. So is it required for the utility to have the other interfaces implemented?



if [[ -x ${PLATFORM_FW_UPDATE} ]]; then
${PLATFORM_FW_UPDATE} auto-update fw --yes --image=next --boot=${REBOOT_TYPE}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang is it ok for you that firmware update may not happen if there is no platform components which support this boot action?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. if there is no platform component firmware update available for the boot action, no firmware update is expected. The fwutil will return a message saying "no update is available for the specific boot type"


SONiC device can have a component firmware updated without interrupting the data plan if the component firmware update doesn't need any boot action.
```bash
root@sonic:~# fwutil auto-update fw --fw-image=aboot-fw-update.tar.gz --boot=none
Copy link
Collaborator

@nazariig nazariig Nov 18, 2020

Choose a reason for hiding this comment

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

@sujinmkang What if the cold/fast/warm boot was specified as the desired action but some of the platform components do support firmware upgrade without dataplane interruption? Do we expect the update will take place implicitly or we still do want to do only with --boot=none?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is good question. Without boot option, the update which can be done without data plane interruption, should be performed implicitly. I will add the default setting for boot type.

@sujinmkang
Copy link
Collaborator Author

@nazariig Can you please review this again?

|
|--- auto_update
|--- fw -i|--image=<current|next> --b|--boot=<any|none|fast|warm|cold|powercycle>
|--- fw -z|--fw-image=<fw_package.tar.gz> --b|--boot=<any|none|fast|warm|cold|powercycle>
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang Looks good. Please update the design

@@ -257,6 +280,7 @@ Chassis Module Component Firmware Version (current/available
Chassis1 N/A BIOS <image_path>/bios.bin 0ACLH004_02.02.007 / 0ACLH004_02.02.010 update is required
CPLD <image_path>/cpld.bin 5 / 10 update is required
FPGA <image_path>/fpga.bin 5 / 5 up-to-date
SSD <image_path>/ssd.bin 4 / 5 update is required
Copy link
Collaborator

@nazariig nazariig Nov 29, 2020

Choose a reason for hiding this comment

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

@sujinmkang We need a way to inform user about what components do support automatic firmware upgrade (e.g, if i do auto-update, the framework will definitely try to upgrade firmware of that components). Without this the behaviour will be non deterministic, since the decision will be taken at field by platform API/plugin. Taken this into consideration, i would expect to see some Auto Update column here with values Yes/No

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nazariig All components need to support the automatic firmware update but only any component firmware update won't happen during this boot time if the auto-update cannot be done for the boot type. And user will notify the components firmware update cannot be done for the boot-type. I don't think it's necessary.

#### 2.2.2.4 Auto-update commands

##### 2.2.2.4.1 Overview
The purpose of the auto-update commands group is to provide and interface for automatic fw updates of various platform components based on the boot option and the platform firmwareupdate configuration file - "platform_components.json".
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang please fix a typo firmware update

{
"<boot_type>": [
{
"status": <true/false>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang please update the design with status codes

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nazariig This is how fwutil save the status of auto-update in the fw_au_status file. I'm proposing that fwutil needs to process the return code of platform component api and save the process data as this format.

_sonic-buildimage/device/<platform_name>/<onie_platform>/platform_components.json_
Recommended image path is "/lib/firmware/<vendor>".

Auto-update command can support the standalone custom firmware image package with --fw-image option.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang can we have a schema of this custom firmware package and some examples in design document?


Auto-update command can support the standalone custom firmware image package with --fw-image option.
The package can be any format between ".tar" or ".tar.gz" and should have the "platform_components.json", the firmware image(s).
The package can have the auto-update plugin if the platform doesn't support platform api or if plugin needs to be updatedplugin.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang IMHO, the original idea of FW package was to provide an ability to do the upgrades on platforms which don't support platform API. Do we really want to use it for upgrades which involves platform API, when fwutil is already provides an infrastructure for that (e.g, this can be achived with FW deb packages)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nazariig I think it's good point. I understand we use the FW deb package to installed firmware which is missing from the current package. We can support both for the new firmware update based on the current image. But when we use a deb package to perform auto-update, we need 3 steps, push the firmware deb package, install the deb package and fwutil auto-update while this FW package approach needs 2 steps for auto update, push the FW package and fwutil aut-update with the FW package.

@sujinmkang
Copy link
Collaborator Author

@padmanarayana @nazariig @rkdevi27 can you please review this again? I want to close this by tomorrow. Thanks!

| |--- component <component_name>
| |--- fw -y|--yes -f|--force -i|--image=<current|next>
|
|--- auto-update
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang Please update CLI tree to use new update all format

```
fwutil
|--- show
| |--- version
| |--- status
| |--- updates -i|--image=<current|next>
| |--- updates -z|--fw-image=<fw_package.tar.gz>
| |--- auto_update_status
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang we need to refactor this part too since moving from auto-update to update all

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this can be changed to update_status but I hope this doesn't mislead people to think that they could check the each component update done by fwutil update {chassis|module <module_name>} component <component_name> fw ....
But I agree to change the command.

@nazariig
Copy link
Collaborator

@sujinmkang Can we also have original documents (visio) as part of this PR? Just in case of further modification will be needed?

@sujinmkang sujinmkang changed the title FwUtil Auto-update support [fwutil.md] Fwutil Auto-update support Jan 26, 2021
@sujinmkang sujinmkang merged commit b72d76b into sonic-net:master Jan 26, 2021
sujinmkang added a commit to sonic-net/sonic-platform-common that referenced this pull request Jan 26, 2021
)

To support the component firmware automatic update, add auto_update_firmware() to platform component api
This is to support fwutil auto_update command to update the platform component firmware automatically.
Fwutil HLD to support auto_update interfaces/commands.
sonic-net/SONiC#648
sujinmkang added a commit to sonic-net/sonic-utilities that referenced this pull request Oct 27, 2021
…mponent fw updates (#1242)

- What I did
Add the support for the automatic platform component fw updates
- How I did it
Add fwutil auto_update interfaces
- How to verify it
Work with dell to verify the auto_update interfaces with ssd firmware update.
- 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)
New added command outputs are available in the following HLD:
sonic-net/SONiC#648
malletvapid23 added a commit to malletvapid23/Sonic-Utility that referenced this pull request Aug 3, 2023
…mponent fw updates (#1242)

- What I did
Add the support for the automatic platform component fw updates
- How I did it
Add fwutil auto_update interfaces
- How to verify it
Work with dell to verify the auto_update interfaces with ssd firmware update.
- 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)
New added command outputs are available in the following HLD:
sonic-net/SONiC#648
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.

5 participants