forked from bn222/cluster-deployment-automation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add preconfig step ExtraConfigMevFwUp
Provide a pre-config to put the MeV firmware into a good state. Reflashing the firmware takes a very long time. By default, it will not do this if the firmware is already on the desired version. However, if we specify to force, we will reflash regardless of the current state. Signed-off-by: Salvatore Daniele <[email protected]>
- Loading branch information
1 parent
9a8167e
commit 91775cf
Showing
4 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from clustersConfig import ClustersConfig | ||
import host | ||
from logger import logger | ||
from clustersConfig import ExtraConfigArgs | ||
from bmc import BMC | ||
from concurrent.futures import Future | ||
from typing import Optional | ||
import time | ||
|
||
LATEST_MEV_FW = "1.8.0.10052" | ||
|
||
|
||
def ExtraConfigMevFwUp(cc: ClustersConfig, cfg: ExtraConfigArgs, futures: dict[str, Future[Optional[host.Result]]]) -> None: | ||
logger.info("Running pre config step to flash MeV firmware on IPU IMC") | ||
|
||
# This preconfig step is expected to run on an IMC only | ||
assert cc.kind == "iso" | ||
master = cc.masters[0] | ||
assert master.kind == "ipu" | ||
assert master.host_side_bmc is not None | ||
imc = host.Host(master.bmc) | ||
|
||
# Check if a particular firmware version is being requested or if we will use default | ||
if cfg.mev_version == "": | ||
logger.info("Desired MeV fw release not specified, will install the latest by default") | ||
cfg.mev_version = LATEST_MEV_FW | ||
logger.info(f"Will ensure {master.bmc} is on firmware version: {cfg.mev_version}") | ||
|
||
# We should only perform an update if it is required, or if the user insists we do so | ||
if not cfg.force_mev_fw_up: | ||
logger.info("Checking if firmware update is required") | ||
if imc.ping(): | ||
imc.ssh_connect(master.bmc_user, master.bmc_password) | ||
ret = imc.run("cat /etc/issue.net") | ||
if cfg.mev_version in ret.out: | ||
logger.info(f"Current MeV fw version is {ret.out.strip()}, no need to update") | ||
return | ||
|
||
# Perform upgrade | ||
lh = host.LocalHost() | ||
|
||
fw_up_cmd = f"--dpu-type ipu --imc-address {master.bmc} firmware up --version {cfg.mev_version}" | ||
|
||
ret = lh.run_in_container(fw_up_cmd, interactive=True) | ||
|
||
if not ret.success(): | ||
logger.error_and_exit(f"Failed to flash new firmware. Error: {ret.err}") | ||
|
||
# Perform coldboot to apply the change | ||
ipu_host_bmc = BMC.from_bmc(master.host_side_bmc) | ||
ipu_host_bmc.cold_boot() | ||
# Cold boot should also reboot IMC, give time to settle before trying to ping IMC | ||
time.sleep(20) | ||
|
||
# Access the IMC to validate the flash was successful | ||
imc.ssh_connect(master.bmc_user, master.bmc_password) | ||
ret = imc.run("cat /etc/issue.net") | ||
if cfg.mev_version not in ret.out or ret.returncode != 0: | ||
logger.error_and_exit(f"Mev firmware release is not the expected version: {ret.out}") | ||
|
||
logger.info("MeV firmware flash complete") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters