From 678b14c21ad8f0ac6da4f6311fa2646aab3f606d Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 23 Nov 2021 17:09:25 +0200 Subject: [PATCH] Do not upgrade packages without upgrades Package upgrade during normal operations might be risky since often involve service restarts. It's better to avoid that when possible and perform package upgrade only during major/minor upgrades. We change default value of package_state and adjust doc and upgrade script to reflect this change. Change-Id: I9971a259a207b263df48a77d5ac74752f044873a --- doc/source/admin/upgrades/major-upgrades.rst | 6 +++--- doc/source/admin/upgrades/minor-upgrades.rst | 4 ++-- inventory/group_vars/all/all.yml | 6 +----- scripts/run-upgrade.sh | 8 ++++---- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/doc/source/admin/upgrades/major-upgrades.rst b/doc/source/admin/upgrades/major-upgrades.rst index 98f6b74a26..36bc86d15b 100644 --- a/doc/source/admin/upgrades/major-upgrades.rst +++ b/doc/source/admin/upgrades/major-upgrades.rst @@ -179,7 +179,7 @@ Once CA is generated, we can proceed with standard OpenStack upgrade steps: .. code-block:: console - # openstack-ansible setup-hosts.yml --limit '!galera_all:!rabbitmq_all' + # openstack-ansible setup-hosts.yml --limit '!galera_all:!rabbitmq_all' -e package_state=latest This command is the same setting up hosts on a new installation. The ``galera_all`` and ``rabbitmq_all`` host groups are excluded to prevent @@ -201,7 +201,7 @@ ensure that rabbitmq and mariadb are upgraded, we pass the appropriate flags. .. code-block:: console - # openstack-ansible setup-infrastructure.yml -e 'galera_upgrade=true' -e 'rabbitmq_upgrade=true' + # openstack-ansible setup-infrastructure.yml -e 'galera_upgrade=true' -e 'rabbitmq_upgrade=true' -e package_state=latest With this complete, we can now restart the mariadb containers one at a time, ensuring that each is started, responding, and synchronized with the other @@ -220,4 +220,4 @@ We can now go ahead with the upgrade of all the OpenStack components. .. code-block:: console - # openstack-ansible setup-openstack.yml + # openstack-ansible setup-openstack.yml -e package_state=latest diff --git a/doc/source/admin/upgrades/minor-upgrades.rst b/doc/source/admin/upgrades/minor-upgrades.rst index ffc7200e0e..120ff8930b 100644 --- a/doc/source/admin/upgrades/minor-upgrades.rst +++ b/doc/source/admin/upgrades/minor-upgrades.rst @@ -49,7 +49,7 @@ A minor upgrade typically requires the following steps: .. code-block:: console - # openstack-ansible setup-hosts.yml + # openstack-ansible setup-hosts.yml -e package_state=latest #. Update the infrastructure: @@ -62,7 +62,7 @@ A minor upgrade typically requires the following steps: .. code-block:: console - # openstack-ansible setup-openstack.yml + # openstack-ansible setup-openstack.yml -e package_state=latest .. note:: diff --git a/inventory/group_vars/all/all.yml b/inventory/group_vars/all/all.yml index b20f865588..a10e4ac793 100644 --- a/inventory/group_vars/all/all.yml +++ b/inventory/group_vars/all/all.yml @@ -34,11 +34,7 @@ ssh_delay: 5 management_address: "{{ container_address }}" openstack_service_bind_address: "{{ management_address }}" -# Set the package install state for distribution packages -# Options are 'present' and 'latest'. -# NOTE(mhayden): Allowing CentOS and openSUSE to use package_state=present should give -# gate jobs a better chance to finish and expose more issues to fix. -package_state: "{{ (ansible_facts['pkg_mgr'] in ['dnf', 'zypper']) | ternary('present', 'latest') }}" +package_state: "present" # Set "/var/log" to be a bind mount to the physical host. default_bind_mount_logs: true diff --git a/scripts/run-upgrade.sh b/scripts/run-upgrade.sh index 67759dd96f..76c68845d0 100755 --- a/scripts/run-upgrade.sh +++ b/scripts/run-upgrade.sh @@ -173,15 +173,15 @@ function main { # we don't want to trigger container restarts for galera and rabbit # but as there will be no hosts available for metal deployments, # as a fallback option we just run setup-hosts.yml without any arguments - RUN_TASKS+=("setup-hosts.yml --limit '!galera_all:!rabbitmq_all' && \ + RUN_TASKS+=("setup-hosts.yml --limit '!galera_all:!rabbitmq_all' -e package_state=latest && \ openstack-ansible setup-hosts.yml -e 'lxc_container_allow_restarts=false' --limit 'galera_all:rabbitmq_all' || \ - openstack-ansible setup-hosts.yml") + openstack-ansible setup-hosts.yml -e package_state=latest") # upgrade infrastructure - RUN_TASKS+=("setup-infrastructure.yml -e 'galera_upgrade=true' -e 'rabbitmq_upgrade=true'") + RUN_TASKS+=("setup-infrastructure.yml -e 'galera_upgrade=true' -e 'rabbitmq_upgrade=true' -e package_state=latest") # explicitly perform controlled galera cluster restart with new lxc config RUN_TASKS+=("${SCRIPTS_PATH}/upgrade-utilities/galera-cluster-rolling-restart.yml") # upgrade openstack - RUN_TASKS+=("setup-openstack.yml") + RUN_TASKS+=("setup-openstack.yml -e package_state=latest") # Run the tasks in order for item in ${!RUN_TASKS[@]}; do echo "### NOW RUNNING: ${RUN_TASKS[$item]}"