Skip to content

Commit

Permalink
Fix Hypervisor Upgrade
Browse files Browse the repository at this point in the history
- HypervisorUpgradePlan was wrongly running steps on parallel which
  caused to change openstack-origin or source at the same time of
  action-managed-upgrade. This could wrongly trigger the upgrade
  on all units.
- added the Psi (Ψ) to user vizualize which steps are going to run
  on parallel
- updated docs
  • Loading branch information
gabrielcocenza committed Apr 18, 2024
1 parent 8f1300c commit ac3f674
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 68 deletions.
22 changes: 15 additions & 7 deletions cou/steps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,19 @@ def __str__(self) -> str:
"""
result = ""
tab = "\t"
steps_to_visit = [(self, 0)]
parallel_char = "Ψ "
steps_to_visit = [(self, 0, 0)]
while steps_to_visit:
step, indent = steps_to_visit.pop()
result += f"{tab * indent}{step.description}{os.linesep}" if step else ""
steps_to_visit.extend([(s, indent + 1) for s in reversed(step.sub_steps)])
step, indent, parallel = steps_to_visit.pop()
result += (
f"{tab * indent}{parallel_char if parallel else ''}{step.description}{os.linesep}"
if step
else ""
)
steps_to_visit.extend(
[(s, indent + 1, step.parallel) for s in reversed(step.sub_steps)]
)
# breakpoint()

return result

Expand Down Expand Up @@ -337,8 +345,8 @@ class ApplicationUpgradePlan(UpgradePlan):
class HypervisorUpgradePlan(BaseStep):
"""Represents the plan for hypervisor upgrade.
This class is intended to be used as a group for unit-level upgrade steps, which are
grouped by a single hypervisor. It doesn't accept coroutine or parallel as inputs.
This class is intended to be used as a group by AZs. It doesn't accept coroutine or parallel
as inputs.
All sub-steps will run in parallel.
"""
Expand All @@ -351,7 +359,7 @@ def __init__(self, description: str):
:param description: Description of the step.
:type description: str
"""
super().__init__(description=description, parallel=True, coro=None)
super().__init__(description=description, parallel=False, coro=None)


class UpgradeStep(BaseStep):
Expand Down
20 changes: 14 additions & 6 deletions docs/explanation/planning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ The plan has a tree structure with six main sections:
availability zone 1
pre-upgrade steps
upgrade steps
unit 1
unit upgrade steps
Ψ unit 1
unit upgrade step A
...
unit upgrade step Z
...
unit K
unit upgrade steps
Ψ unit K
unit upgrade step A
...
unit upgrade step Z
post-upgrade steps
...
availability zone N
Expand All @@ -55,7 +59,7 @@ The plan has a tree structure with six main sections:
The above demonstrates a complete cloud upgrade plan. However, it's also possible to
target a specific subset of the cloud. For more information, please refer to
:doc:`Upgrade Groups <./upgrade-groups>`.
:doc:`Upgrade Groups <./upgrade-groups>`.

The **pre-upgrade** steps prepare COU for the upgrade process, which includes
verifying the states or configurations of the applications, units, or of the
Expand All @@ -69,5 +73,9 @@ successfully.
The plan can also be obtained without the need to perform a cloud upgrade using
the **plan** command. See :doc:`Plan an upgrade <../how-to/plan-upgrade>`.

The Greek letter Psi `Ψ` means that the step will run in parallel compared with other steps in the
same level. In the example above on the `data-plane hypervisors upgrade`, `unit 1` will run on
parallel compared with `unit K`, but their `upgrade steps A to Z` will run sequentially.

Different upgrade strategies are chosen for control-plane and data-plane applications
when preparing the plan. For details, please refer to :doc:`Upgrade <./upgrade>`.
when preparing the plan. For details, please refer to :doc:`Upgrade <./upgrade>`.
4 changes: 2 additions & 2 deletions docs/reference/known-issues.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Known issues
Potential known upgrade bugs and non-standard procedures are listed in the OpenStack Charm Guide:

- `Issues, charm procedures, and OpenStack upgrade notes`_

.. LINKS:
.. _Issues, charm procedures, and OpenStack upgrade notes: https://docs.openstack.org/charm-guide/latest/project/issues-and-procedures.html
.. _Issues, charm procedures, and OpenStack upgrade notes: https://docs.openstack.org/charm-guide/latest/project/issues-and-procedures.html
8 changes: 4 additions & 4 deletions tests/mocked_plans/sample_plans/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plan: |
Control Plane principal(s) upgrade plan
Upgrade plan for 'keystone' to 'victoria'
Upgrade software packages of 'keystone' from the current APT repositories
Upgrade software packages on unit 'keystone/0'
Ψ Upgrade software packages on unit 'keystone/0'
Refresh 'keystone' to the latest revision of 'ussuri/stable'
Change charm config of 'keystone' 'action-managed-upgrade' to 'False'
Upgrade 'keystone' to the new channel: 'victoria/stable'
Expand All @@ -20,13 +20,13 @@ plan: |
Upgrade plan for 'az-0' to 'victoria'
Disable nova-compute scheduler from unit: 'nova-compute/0'
Upgrade software packages of 'nova-compute' from the current APT repositories
Upgrade software packages on unit 'nova-compute/0'
Ψ Upgrade software packages on unit 'nova-compute/0'
Refresh 'nova-compute' to the latest revision of 'ussuri/stable'
Change charm config of 'nova-compute' 'action-managed-upgrade' to 'True'
Upgrade 'nova-compute' to the new channel: 'victoria/stable'
Change charm config of 'nova-compute' 'source' to 'cloud:focal-victoria'
Upgrade plan for units: nova-compute/0
Upgrade plan for unit 'nova-compute/0'
Ψ Upgrade plan for unit 'nova-compute/0'
Verify that unit 'nova-compute/0' has no VMs running
├── Pause the unit: 'nova-compute/0'
├── Upgrade the unit: 'nova-compute/0'
Expand All @@ -38,7 +38,7 @@ plan: |
Upgrade plan for 'ceph-osd' to 'victoria'
Verify that all 'nova-compute' units has been upgraded
Upgrade software packages of 'ceph-osd' from the current APT repositories
Upgrade software packages on unit 'ceph-osd/0'
Ψ Upgrade software packages on unit 'ceph-osd/0'
Refresh 'ceph-osd' to the latest revision of 'octopus/stable'
Change charm config of 'ceph-osd' 'source' to 'cloud:focal-victoria'
Wait for up to 300s for app 'ceph-osd' to reach the idle state
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/apps/test_auxiliary.py
Original file line number Diff line number Diff line change
Expand Up @@ -1340,9 +1340,9 @@ def test_ceph_osd_upgrade_plan(model):
Upgrade plan for 'ceph-osd' to 'victoria'
Verify that all 'nova-compute' units has been upgraded
Upgrade software packages of 'ceph-osd' from the current APT repositories
Upgrade software packages on unit 'ceph-osd/0'
Upgrade software packages on unit 'ceph-osd/1'
Upgrade software packages on unit 'ceph-osd/2'
Ψ Upgrade software packages on unit 'ceph-osd/0'
Ψ Upgrade software packages on unit 'ceph-osd/1'
Ψ Upgrade software packages on unit 'ceph-osd/2'
Refresh 'ceph-osd' to the latest revision of 'octopus/stable'
Change charm config of 'ceph-osd' 'source' to 'cloud:focal-victoria'
Wait for up to 300s for app 'ceph-osd' to reach the idle state
Expand Down
26 changes: 13 additions & 13 deletions tests/unit/apps/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,25 +783,25 @@ def test_nova_compute_upgrade_plan(model):
Disable nova-compute scheduler from unit: 'nova-compute/1'
Disable nova-compute scheduler from unit: 'nova-compute/2'
Upgrade software packages of 'nova-compute' from the current APT repositories
Upgrade software packages on unit 'nova-compute/0'
Upgrade software packages on unit 'nova-compute/1'
Upgrade software packages on unit 'nova-compute/2'
Ψ Upgrade software packages on unit 'nova-compute/0'
Ψ Upgrade software packages on unit 'nova-compute/1'
Ψ Upgrade software packages on unit 'nova-compute/2'
Refresh 'nova-compute' to the latest revision of 'ussuri/stable'
Change charm config of 'nova-compute' 'action-managed-upgrade' to 'True'
Upgrade 'nova-compute' to the new channel: 'victoria/stable'
Change charm config of 'nova-compute' 'source' to 'cloud:focal-victoria'
Upgrade plan for units: nova-compute/0, nova-compute/1, nova-compute/2
Upgrade plan for unit 'nova-compute/0'
Ψ Upgrade plan for unit 'nova-compute/0'
Verify that unit 'nova-compute/0' has no VMs running
├── Pause the unit: 'nova-compute/0'
├── Upgrade the unit: 'nova-compute/0'
├── Resume the unit: 'nova-compute/0'
Upgrade plan for unit 'nova-compute/1'
Ψ Upgrade plan for unit 'nova-compute/1'
Verify that unit 'nova-compute/1' has no VMs running
├── Pause the unit: 'nova-compute/1'
├── Upgrade the unit: 'nova-compute/1'
├── Resume the unit: 'nova-compute/1'
Upgrade plan for unit 'nova-compute/2'
Ψ Upgrade plan for unit 'nova-compute/2'
Verify that unit 'nova-compute/2' has no VMs running
├── Pause the unit: 'nova-compute/2'
├── Upgrade the unit: 'nova-compute/2'
Expand Down Expand Up @@ -850,13 +850,13 @@ def test_nova_compute_upgrade_plan_single_unit(model):
Upgrade plan for 'nova-compute' to 'victoria'
Disable nova-compute scheduler from unit: 'nova-compute/0'
Upgrade software packages of 'nova-compute' from the current APT repositories
Upgrade software packages on unit 'nova-compute/0'
Ψ Upgrade software packages on unit 'nova-compute/0'
Refresh 'nova-compute' to the latest revision of 'ussuri/stable'
Change charm config of 'nova-compute' 'action-managed-upgrade' to 'True'
Upgrade 'nova-compute' to the new channel: 'victoria/stable'
Change charm config of 'nova-compute' 'source' to 'cloud:focal-victoria'
Upgrade plan for units: nova-compute/0
Upgrade plan for unit 'nova-compute/0'
Ψ Upgrade plan for unit 'nova-compute/0'
Verify that unit 'nova-compute/0' has no VMs running
├── Pause the unit: 'nova-compute/0'
├── Upgrade the unit: 'nova-compute/0'
Expand Down Expand Up @@ -902,9 +902,9 @@ def test_cinder_upgrade_plan(model):
"""\
Upgrade plan for 'cinder' to 'victoria'
Upgrade software packages of 'cinder' from the current APT repositories
Upgrade software packages on unit 'cinder/0'
Upgrade software packages on unit 'cinder/1'
Upgrade software packages on unit 'cinder/2'
Ψ Upgrade software packages on unit 'cinder/0'
Ψ Upgrade software packages on unit 'cinder/1'
Ψ Upgrade software packages on unit 'cinder/2'
Refresh 'cinder' to the latest revision of 'ussuri/stable'
Upgrade 'cinder' to the new channel: 'victoria/stable'
Change charm config of 'cinder' 'openstack-origin' to 'cloud:focal-victoria'
Expand Down Expand Up @@ -952,13 +952,13 @@ def test_cinder_upgrade_plan_single_unit(model):
"""\
Upgrade plan for 'cinder' to 'victoria'
Upgrade software packages of 'cinder' from the current APT repositories
Upgrade software packages on unit 'cinder/0'
Ψ Upgrade software packages on unit 'cinder/0'
Refresh 'cinder' to the latest revision of 'ussuri/stable'
Change charm config of 'cinder' 'action-managed-upgrade' to 'True'
Upgrade 'cinder' to the new channel: 'victoria/stable'
Change charm config of 'cinder' 'openstack-origin' to 'cloud:focal-victoria'
Upgrade plan for units: cinder/0
Upgrade plan for unit 'cinder/0'
Ψ Upgrade plan for unit 'cinder/0'
Pause the unit: 'cinder/0'
Upgrade the unit: 'cinder/0'
Resume the unit: 'cinder/0'
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/steps/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,23 +449,23 @@ async def test_plan_structure(self):
"""
test plan
parallel
parallel.0
Ψ parallel.0
parallel.0.0
parallel.0.1
parallel.0.2
parallel.1
Ψ parallel.1
parallel.1.0
parallel.1.1
parallel.1.2
parallel.2
Ψ parallel.2
parallel.2.0
parallel.2.1
parallel.2.2
parallel.3
Ψ parallel.3
parallel.3.0
parallel.3.1
parallel.3.2
parallel.4
Ψ parallel.4
parallel.4.0
parallel.4.1
parallel.4.2
Expand Down
Loading

0 comments on commit ac3f674

Please sign in to comment.