Skip to content

Commit

Permalink
Merge branch 'main' into dev/data-plane
Browse files Browse the repository at this point in the history
  • Loading branch information
rgildein committed Feb 8, 2024
2 parents 2c8fa9f + b3df76a commit ab8bc73
Show file tree
Hide file tree
Showing 12 changed files with 297 additions and 146 deletions.
13 changes: 11 additions & 2 deletions cou/apps/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,21 @@ def _get_upgrade_current_release_packages_step(self) -> PreUpgradeStep:
:return: Step for upgrading software packages to the latest of the current release.
:rtype: PreUpgradeStep
"""
return PreUpgradeStep(
step = PreUpgradeStep(
description=(
f"Upgrade software packages of '{self.name}' from the current APT repositories"
),
coro=upgrade_packages(self.status.units.keys(), self.model, self.packages_to_hold),
parallel=True,
)
for unit in self.units:
step.add_step(
UnitUpgradeStep(
description=f"Upgrade software packages on unit {unit.name}",
coro=upgrade_packages(unit.name, self.model, self.packages_to_hold),
)
)

return step

def _get_refresh_charm_step(self, target: OpenStackRelease) -> PreUpgradeStep:
"""Get step for refreshing the current channel.
Expand Down
12 changes: 4 additions & 8 deletions cou/utils/app_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"""Application utilities."""
import json
import logging
from collections.abc import Iterable
from typing import Optional

from packaging.version import Version
Expand All @@ -27,13 +26,11 @@
logger = logging.getLogger(__name__)


async def upgrade_packages(
units: Iterable[str], model: COUModel, packages_to_hold: Optional[list]
) -> None:
async def upgrade_packages(unit: str, model: COUModel, packages_to_hold: Optional[list]) -> None:
"""Run package updates and upgrades on each unit of an Application.
:param units: The list of unit names where the package upgrade runs on.
:type units: Iterable[str]
:param unit: Unit name where the package upgrade runs on.
:type unit: str
:param model: COUModel object
:type model: COUModel
:param packages_to_hold: A list of packages to put on hold during package upgrade.
Expand All @@ -46,8 +43,7 @@ async def upgrade_packages(
packages = " ".join(packages_to_hold)
command = f"apt-mark hold {packages} && {command} ; apt-mark unhold {packages}"

for unit in units:
await model.run_on_unit(unit_name=unit, command=command, timeout=600)
await model.run_on_unit(unit_name=unit, command=command, timeout=600)


async def set_require_osd_release_option(unit: str, model: COUModel) -> None:
Expand Down
13 changes: 8 additions & 5 deletions docs/how-to/interruption.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ the process at any prompt.

Usage example:

.. terminal::
.. terminal::
:input: cou upgrade

Full execution log: '/home/ubuntu/.local/share/cou/log/cou-20231215211717.log'
Expand All @@ -28,6 +28,9 @@ Usage example:
Backup mysql databases ✔
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/1
Upgrade software packages on unit keystone/2
Upgrade 'keystone' to the new channel: 'victoria/stable'
Change charm config of 'keystone' 'openstack-origin' to 'cloud:focal-victoria'
Wait 1800s for model test-model to reach the idle state.
Expand All @@ -49,7 +52,7 @@ the cloud may be left in an inconsistent state.

Exiting before running upgrade plan:

.. terminal::
.. terminal::
:input: cou upgrade - # ctrl+c is pressed while connecting to the controller

Full execution log: '/home/ubuntu/.local/share/cou/log/cou-20231215211717.log'
Expand All @@ -63,7 +66,7 @@ Exiting before running upgrade plan:

Safe cancel:

.. terminal::
.. terminal::
:input: cou upgrade # ctrl+c is pressed once during the upgrade

Full execution log: '/home/ubuntu/.local/share/cou/log/cou-20231215211717.log'
Expand All @@ -73,11 +76,11 @@ Safe cancel:
...
Running cloud upgrade...
Canceling upgrade... (Press ctrl+c again to stop immediately) ✔
charmed-openstack-upgrader has been stopped safely
charmed-openstack-upgrader has been stopped safely

Unsafe cancel:

.. terminal::
.. terminal::
:input: cou upgrade # ctrl+c is pressed twice during the upgrade

Full execution log: '/home/ubuntu/.local/share/cou/log/cou-20231215211717.log'
Expand Down
12 changes: 9 additions & 3 deletions docs/how-to/no-backup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Usage examples

Plan:

.. terminal::
.. terminal::
:input: cou plan --no-backup

Full execution log: '/home/ubuntu/.local/share/cou/log/cou-20231215211717.log'
Expand All @@ -23,11 +23,14 @@ Plan:
Control Plane principal(s) upgrade plan
Upgrade plan for 'rabbitmq-server' to victoria
Upgrade software packages of 'rabbitmq-server' from the current APT repositories
Upgrade software packages on unit rabbitmq-server/0
Upgrade software packages on unit rabbitmq-server/1
Upgrade software packages on unit rabbitmq-server/2
...

Upgrade:

.. terminal::
.. terminal::
:input: cou upgrade --no-backup

Full execution log: '/home/ubuntu/.local/share/cou/log/cou-20231215211717.log'
Expand All @@ -41,13 +44,16 @@ Upgrade:

Upgrade plan for 'rabbitmq-server' to victoria
Upgrade software packages of 'rabbitmq-server' from the current APT repositories
Upgrade software packages on unit rabbitmq-server/0
Upgrade software packages on unit rabbitmq-server/1
Upgrade software packages on unit rabbitmq-server/2
Upgrade 'rabbitmq-server' to the new channel: '3.9/stable'
Change charm config of 'rabbitmq-server' 'source' to 'cloud:focal-victoria'
Wait 1800s for model test-model to reach the idle state.
Check if the workload of 'rabbitmq-server' has been upgraded

Continue (y/n): y
Upgrade plan for 'rabbitmq-server' to victoria ✔

... # apply steps
Upgrade completed.
17 changes: 15 additions & 2 deletions docs/how-to/plan-upgrade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ printed on STDOUT.
Usage example
-------------

.. terminal::
.. terminal::
:input: cou plan

Full execution log: '/home/ubuntu/.local/share/cou/log/cou-20231215211717.log'
Connected to 'test-model' ✔
Analyzing cloud... ✔
Expand All @@ -25,54 +25,67 @@ Usage example
Control Plane principal(s) upgrade plan
Upgrade plan for 'rabbitmq-server' to victoria
Upgrade software packages of 'rabbitmq-server' from the current APT repositories
Upgrade software packages on unit rabbitmq-server/0
Upgrade software packages on unit rabbitmq-server/1
Upgrade software packages on unit rabbitmq-server/2
Upgrade 'rabbitmq-server' to the new channel: '3.9/stable'
Change charm config of 'rabbitmq-server' 'source' to 'cloud:focal-victoria'
Wait 1800s for model test-model to reach the idle state.
Check if the workload of 'rabbitmq-server' has been upgraded
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/1
Upgrade software packages on unit keystone/2
Upgrade 'keystone' to the new channel: 'victoria/stable'
Change charm config of 'keystone' 'openstack-origin' to 'cloud:focal-victoria'
Wait 1800s for model test-model to reach the idle state.
Check if the workload of 'keystone' has been upgraded
Upgrade plan for 'cinder' to victoria
Upgrade software packages of 'cinder' from the current APT repositories
Upgrade software packages on unit cinder/0
Upgrade 'cinder' to the new channel: 'victoria/stable'
Change charm config of 'cinder' 'openstack-origin' to 'cloud:focal-victoria'
Wait 300s for app cinder to reach the idle state.
Check if the workload of 'cinder' has been upgraded
Upgrade plan for 'glance' to victoria
Upgrade software packages of 'glance' from the current APT repositories
Upgrade software packages on unit glance/0
Upgrade 'glance' to the new channel: 'victoria/stable'
Change charm config of 'glance' 'openstack-origin' to 'cloud:focal-victoria'
Wait 300s for app glance to reach the idle state.
Check if the workload of 'glance' has been upgraded
Upgrade plan for 'neutron-api' to victoria
Upgrade software packages of 'neutron-api' from the current APT repositories
Upgrade software packages on unit neutron-api/0
Upgrade 'neutron-api' to the new channel: 'victoria/stable'
Change charm config of 'neutron-api' 'openstack-origin' to 'cloud:focal-victoria'
Wait 300s for app neutron-api to reach the idle state.
Check if the workload of 'neutron-api' has been upgraded
Upgrade plan for 'neutron-gateway' to victoria
Upgrade software packages of 'neutron-gateway' from the current APT repositories
Upgrade software packages on unit neutron-gateway/0
Upgrade 'neutron-gateway' to the new channel: 'victoria/stable'
Change charm config of 'neutron-gateway' 'openstack-origin' to 'cloud:focal-victoria'
Wait 300s for app neutron-gateway to reach the idle state.
Check if the workload of 'neutron-gateway' has been upgraded
Upgrade plan for 'placement' to victoria
Upgrade software packages of 'placement' from the current APT repositories
Upgrade software packages on unit placement/0
Upgrade 'placement' to the new channel: 'victoria/stable'
Change charm config of 'placement' 'openstack-origin' to 'cloud:focal-victoria'
Wait 300s for app placement to reach the idle state.
Check if the workload of 'placement' has been upgraded
Upgrade plan for 'nova-cloud-controller' to victoria
Upgrade software packages of 'nova-cloud-controller' from the current APT repositories
Upgrade software packages on unit nova-cloud-controller/0
Upgrade 'nova-cloud-controller' to the new channel: 'victoria/stable'
Change charm config of 'nova-cloud-controller' 'openstack-origin' to 'cloud:focal-victoria'
Wait 300s for app nova-cloud-controller to reach the idle state.
Check if the workload of 'nova-cloud-controller' has been upgraded
Upgrade plan for 'mysql' to victoria
Upgrade software packages of 'mysql' from the current APT repositories
Upgrade software packages on unit mysql/0
Change charm config of 'mysql' 'source' to 'cloud:focal-victoria'
Wait 1800s for app mysql to reach the idle state.
Check if the workload of 'mysql' has been upgraded
Expand Down
31 changes: 25 additions & 6 deletions docs/how-to/upgrade-cloud.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ cloud. This command runs upgrade in interactive mode by default, requiring the u
to confirm each step.

.. code:: bash
cou upgrade
Usage example
~~~~~~~~~~~~~

.. terminal::
.. terminal::
:input: cou upgrade

Full execution log: '/home/ubuntu/.local/share/cou/log/cou-20231215211917.log'
Expand All @@ -29,56 +29,69 @@ Usage example
Control Plane principal(s) upgrade plan
Upgrade plan for 'rabbitmq-server' to victoria
Upgrade software packages of 'rabbitmq-server' from the current APT repositories
Upgrade software packages on unit rabbitmq-server/0
Upgrade software packages on unit rabbitmq-server/1
Upgrade software packages on unit rabbitmq-server/2
Upgrade 'rabbitmq-server' to the new channel: '3.9/stable'
Change charm config of 'rabbitmq-server' 'source' to 'cloud:focal-victoria'
Wait 1800s for model test-model to reach the idle state.
Check if the workload of 'rabbitmq-server' has been upgraded
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/1
Upgrade software packages on unit keystone/2
Upgrade 'keystone' to the new channel: 'victoria/stable'
Change charm config of 'keystone' 'openstack-origin' to 'cloud:focal-victoria'
Wait 1800s for model test-model to reach the idle state.
Check if the workload of 'keystone' has been upgraded
Upgrade plan for 'cinder' to victoria
Upgrade software packages of 'cinder' from the current APT repositories
Upgrade software packages on unit cinder/0
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'
Wait 300s for app cinder to reach the idle state.
Check if the workload of 'cinder' has been upgraded
Upgrade plan for 'glance' to victoria
Upgrade software packages of 'glance' from the current APT repositories
Upgrade software packages on unit glance/0
Upgrade 'glance' to the new channel: 'victoria/stable'
Change charm config of 'glance' 'openstack-origin' to 'cloud:focal-victoria'
Wait 300s for app glance to reach the idle state.
Check if the workload of 'glance' has been upgraded
Upgrade plan for 'neutron-api' to victoria
Upgrade software packages of 'neutron-api' from the current APT repositories
Upgrade software packages on unit neutron-api/0
Upgrade 'neutron-api' to the new channel: 'victoria/stable'
Change charm config of 'neutron-api' 'openstack-origin' to 'cloud:focal-victoria'
Wait 300s for app neutron-api to reach the idle state.
Check if the workload of 'neutron-api' has been upgraded
Upgrade plan for 'neutron-gateway' to victoria
Upgrade software packages of 'neutron-gateway' from the current APT repositories
Upgrade software packages on unit neutron-gateway/0
Upgrade 'neutron-gateway' to the new channel: 'victoria/stable'
Change charm config of 'neutron-gateway' 'openstack-origin' to 'cloud:focal-victoria'
Wait 300s for app neutron-gateway to reach the idle state.
Check if the workload of 'neutron-gateway' has been upgraded
Upgrade plan for 'placement' to victoria
Upgrade software packages of 'placement' from the current APT repositories
Upgrade software packages on unit placement/0
Upgrade 'placement' to the new channel: 'victoria/stable'
Change charm config of 'placement' 'openstack-origin' to 'cloud:focal-victoria'
Wait 300s for app placement to reach the idle state.
Check if the workload of 'placement' has been upgraded
Upgrade plan for 'nova-cloud-controller' to victoria
Upgrade software packages of 'nova-cloud-controller' from the current APT repositories
Upgrade software packages on unit nova-cloud-controller/0
Refresh 'nova-cloud-controller' to the latest revision of 'ussuri/stable'
Upgrade 'nova-cloud-controller' to the new channel: 'victoria/stable'
Change charm config of 'nova-cloud-controller' 'openstack-origin' to 'cloud:focal-victoria'
Wait 300s for app nova-cloud-controller to reach the idle state.
Check if the workload of 'nova-cloud-controller' has been upgraded
Upgrade plan for 'mysql' to victoria
Upgrade software packages of 'mysql' from the current APT repositories
Upgrade software packages on unit mysql/0
Change charm config of 'mysql' 'source' to 'cloud:focal-victoria'
Wait 1800s for app mysql to reach the idle state.
Check if the workload of 'mysql' has been upgraded
Expand All @@ -92,6 +105,9 @@ Usage example

Upgrade plan for 'rabbitmq-server' to victoria
Upgrade software packages of 'rabbitmq-server' from the current APT repositories
Upgrade software packages on unit rabbitmq-server/0
Upgrade software packages on unit rabbitmq-server/1
Upgrade software packages on unit rabbitmq-server/2
Upgrade 'rabbitmq-server' to the new channel: '3.9/stable'
Change charm config of 'rabbitmq-server' 'source' to 'cloud:focal-victoria'
Wait 1800s for model test-model to reach the idle state.
Expand All @@ -102,6 +118,9 @@ Usage example

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/1
Upgrade software packages on unit keystone/2
Upgrade 'keystone' to the new channel: 'victoria/stable'
Change charm config of 'keystone' 'openstack-origin' to 'cloud:focal-victoria'
Wait 1800s for model test-model to reach the idle state.
Expand All @@ -127,7 +146,7 @@ Usage examples

Non-interactive mode:

.. terminal::
.. terminal::
:input: cou upgrade --auto-approve

Full execution log: '/home/ubuntu/.local/share/cou/log/cou-20231215211717.log'
Expand All @@ -146,7 +165,7 @@ Non-interactive mode:

Non-interactive and quiet mode:

.. terminal::
.. terminal::
:input: cou upgrade --auto-approve --quiet
Upgrade completed.

Upgrade completed.
4 changes: 4 additions & 0 deletions tests/functional/tests/smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,16 @@ def generate_expected_plan(self, backup: bool = True) -> str:
"\t\tUpgrade plan for 'designate-bind' to victoria\n"
"\t\t\tUpgrade software packages of 'designate-bind' "
"from the current APT repositories\n"
"\t\t\t\tUpgrade software packages on unit designate-bind/0\n"
"\t\t\tUpgrade 'designate-bind' to the new channel: 'victoria/stable'\n"
"\t\t\tWait 300s for app designate-bind to reach the idle state.\n"
"\t\t\tCheck if the workload of 'designate-bind' has been upgraded\n"
"\t\tUpgrade plan for 'mysql-innodb-cluster' to victoria\n"
"\t\t\tUpgrade software packages of 'mysql-innodb-cluster' "
"from the current APT repositories\n"
"\t\t\t\tUpgrade software packages on unit mysql-innodb-cluster/0\n"
"\t\t\t\tUpgrade software packages on unit mysql-innodb-cluster/1\n"
"\t\t\t\tUpgrade software packages on unit mysql-innodb-cluster/2\n"
"\t\t\tChange charm config of 'mysql-innodb-cluster' 'source' to "
"'cloud:focal-victoria'\n"
"\t\t\tWait 1800s for app mysql-innodb-cluster to reach the idle state.\n"
Expand Down
Loading

0 comments on commit ab8bc73

Please sign in to comment.