Updated on 2024-09-14 GMT+08:00

Version Upgrade and Rollback

This section describes how to upgrade or roll back HCE.

During an OS upgrade or rollback, RPM packages will be updated to the versions of the target OS. The blacklist and whitelist configured in osmt.conf will not be applied.

Upgrading the OS Version

  1. Confirm that the repository is configured correctly.

    Check whether the parameters in the /etc/yum.repos.d/hce.repo file are configured correctly. The correct configuration is as follows:

    [base]
    name=HCE $releasever base
    baseurl=https://repo.huaweicloud.com/hce/$releasever/os/$basearch/
    enabled=1
    gpgcheck=1
    gpgkey=https://repo.huaweicloud.com/hce/$releasever/os/RPM-GPG-KEY-HCE-2
    
    [updates]
    name=HCE $releasever updates
    baseurl=https://repo.huaweicloud.com/hce/$releasever/updates/$basearch/
    ......

    Incorrect configuration may result in OSMT upgrade failures or unexpected upgrades.

  2. Update the OSMT version.

    There is a mapping between OSMT versions and HCE versions. HCE installs by default the OSMT of the current OS. When upgrading HCE, you also need to update the OSMT to the matched version.

    Run dnf update osmt -y --releasever [Target OS version] to update the OSMT version. For example, to upgrade HCE from 2.0 to 2.1, run dnf update osmt -y --releasever 2.1 to update OSMT to the latest version.

    You can also run dnf install osmt -y --releasever [Target OS version] to install OSMT if it is deleted by mistake. For example, you can run dnf install osmt -y --releasever 2.1 to install the latest OSMT.

  3. Upgrade the HCE version.

    osmt update --releasever [Target version] --reboot_config [Restart configuration]

    Choose an appropriate upgrade method. For more upgrade options, see osmt update -h.
    • To upgrade HCE from 2.0 to 2.1, run the following command:

      osmt update --releasever 2.1

      The upgrade is only applied after a reboot.

    • Upgrade HCE from 2.0 to 2.1 and restart the OS immediately.

      osmt update --releasever 2.1 --reboot_config always

    • Upgrade HCE from 2.0 to 2.1 and restart the OS at 2022-12-30 23:00:00.

      osmt update --releasever 2.1 --reboot_config "2022-12-30 23:00:00"

  4. Check whether the upgrade was successful.

    Run cat /etc/hce-latest and view the hceversion field. If the --releasever value is the version you specified, the upgrade was successful.

  5. (Optional) Delete backup files.

    After verifying the OS functions, run osmt remove to delete the backup files.

    The operation of deleting backup files cannot be undone. Ensure that no exception occurs after the upgrade before you run osmt remove.

Rolling Back the OS Version

  1. Choose an appropriate rollback method.
    • To roll back and not restart the OS, run the following command:

      osmt rollback

    • To roll back and restart the OS immediately, run the following command: (Then skip step 2.)

      osmt rollback --reboot_config always

  2. Run reboot to restart the OS.

    The rollback is only applied after a restart.

  3. Check whether the rollback was successful.

    Run cat /etc/hce-latest and view the hceversion field. If the hceversion value is the source version, the rollback was successful.