Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aligning OS application names #294

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions cou/apps/auxiliary.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


@AppFactory.register_application(["vault", "ceph-fs", "ceph-radosgw"])
class OpenStackAuxiliaryApplication(OpenStackApplication):
class AuxiliaryApplication(OpenStackApplication):
"""Application for charms that can have multiple OpenStack releases for a workload."""

def is_valid_track(self, charm_channel: str) -> bool:
Expand Down Expand Up @@ -122,7 +122,7 @@ def channel_codename(self) -> OpenStackRelease:


@AppFactory.register_application(["rabbitmq-server"])
class RabbitMQServer(OpenStackAuxiliaryApplication):
class RabbitMQServer(AuxiliaryApplication):
"""RabbitMQ application.

RabbitMQ must wait for the entire model to be idle before declaring the upgrade complete.
Expand All @@ -133,7 +133,7 @@ class RabbitMQServer(OpenStackAuxiliaryApplication):


@AppFactory.register_application(["ceph-mon"])
class CephMonApplication(OpenStackAuxiliaryApplication):
class CephMon(AuxiliaryApplication):
"""Application for Ceph Monitor charm."""

wait_timeout = LONG_IDLE_TIMEOUT
Expand Down Expand Up @@ -166,7 +166,7 @@ def _get_change_require_osd_release_step(self) -> PreUpgradeStep:


@AppFactory.register_application(["ovn-central", "ovn-dedicated-chassis"])
class OvnPrincipalApplication(OpenStackAuxiliaryApplication):
class OvnPrincipal(AuxiliaryApplication):
"""Ovn principal application class."""

def pre_upgrade_steps(self, target: OpenStackRelease) -> list[PreUpgradeStep]:
Expand All @@ -183,7 +183,7 @@ def pre_upgrade_steps(self, target: OpenStackRelease) -> list[PreUpgradeStep]:


@AppFactory.register_application(["mysql-innodb-cluster"])
class MysqlInnodbClusterApplication(OpenStackAuxiliaryApplication):
class MysqlInnodbCluster(AuxiliaryApplication):
"""Application for mysql-innodb-cluster charm."""

# NOTE(agileshaw): holding 'mysql-server-core-8.0' package prevents undesired
Expand All @@ -194,8 +194,8 @@ class MysqlInnodbClusterApplication(OpenStackAuxiliaryApplication):

# NOTE (gabrielcocenza): Although CephOSD class is empty now, it will be
# necessary to add post upgrade plan to set require-osd-release. Registering on
# OpenStackAuxiliaryApplication can be easily forgot and ceph-osd can't be instantiated
# AuxiliaryApplication can be easily forgot and ceph-osd can't be instantiated
# as a normal OpenStackApplication.
@AppFactory.register_application(["ceph-osd"])
class CephOSD(OpenStackAuxiliaryApplication):
class CephOSD(AuxiliaryApplication):
"""Application for ceph-osd."""
10 changes: 4 additions & 6 deletions cou/apps/auxiliary_subordinate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Auxiliary subordinate application class."""
from cou.apps.auxiliary import OpenStackAuxiliaryApplication
from cou.apps.auxiliary import AuxiliaryApplication
from cou.apps.factory import AppFactory
from cou.apps.subordinate import SubordinateBaseClass
from cou.apps.subordinate import SubordinateBase
from cou.steps import PreUpgradeStep
from cou.utils.app_utils import validate_ovn_support
from cou.utils.openstack import AUXILIARY_SUBORDINATES, OpenStackRelease


@AppFactory.register_application(AUXILIARY_SUBORDINATES)
class OpenStackAuxiliarySubordinateApplication(
SubordinateBaseClass, OpenStackAuxiliaryApplication
):
class AuxiliarySubordinateApplication(SubordinateBase, AuxiliaryApplication):
"""Auxiliary subordinate application class."""

@property
Expand All @@ -39,7 +37,7 @@ def current_os_release(self) -> OpenStackRelease:


@AppFactory.register_application(["ovn-chassis"])
class OvnSubordinateApplication(OpenStackAuxiliarySubordinateApplication):
class OvnSubordinate(AuxiliarySubordinateApplication):
"""Ovn subordinate application class."""

def pre_upgrade_steps(self, target: OpenStackRelease) -> list[PreUpgradeStep]:
Expand Down
2 changes: 1 addition & 1 deletion cou/apps/channel_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


@AppFactory.register_application(CHANNEL_BASED_CHARMS)
class OpenStackChannelBasedApplication(OpenStackApplication):
class ChannelBasedApplication(OpenStackApplication):
"""Application for charms that are channel based."""

def _get_latest_os_version(self, unit: UnitStatus) -> OpenStackRelease:
Expand Down
4 changes: 2 additions & 2 deletions cou/apps/subordinate.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
logger = logging.getLogger(__name__)


class SubordinateBaseClass(OpenStackApplication):
class SubordinateBase(OpenStackApplication):
"""Subordinate base class."""

def pre_upgrade_steps(self, target: OpenStackRelease) -> list[PreUpgradeStep]:
Expand Down Expand Up @@ -57,7 +57,7 @@ def post_upgrade_steps(self, target: OpenStackRelease) -> list[PostUpgradeStep]:


@AppFactory.register_application(SUBORDINATES)
class OpenStackSubordinateApplication(SubordinateBaseClass):
class SubordinateApplication(SubordinateBase):
"""Subordinate application class."""

@property
Expand Down
21 changes: 9 additions & 12 deletions cou/steps/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,19 @@
# decorator
# pylint: disable=unused-import
from cou.apps.auxiliary import ( # noqa: F401
CephMonApplication,
OpenStackAuxiliaryApplication,
OvnPrincipalApplication,
AuxiliaryApplication,
CephMon,
OvnPrincipal,
RabbitMQServer,
)
from cou.apps.auxiliary_subordinate import ( # noqa: F401
OpenStackAuxiliarySubordinateApplication,
OvnSubordinateApplication,
AuxiliarySubordinateApplication,
OvnSubordinate,
)
from cou.apps.base import OpenStackApplication
from cou.apps.channel_based import OpenStackChannelBasedApplication # noqa: F401
from cou.apps.channel_based import ChannelBasedApplication # noqa: F401
from cou.apps.core import Keystone, Octavia # noqa: F401
from cou.apps.subordinate import ( # noqa: F401
OpenStackSubordinateApplication,
SubordinateBaseClass,
)
from cou.apps.subordinate import SubordinateApplication, SubordinateBase # noqa: F401
from cou.exceptions import (
HaltUpgradePlanGeneration,
HighestReleaseAchieved,
Expand Down Expand Up @@ -102,15 +99,15 @@ async def generate_plan(analysis_result: Analysis, backup_database: bool) -> Upg
apps=analysis_result.apps_control_plane,
description="Control Plane principal(s) upgrade plan",
target=target,
filter_function=lambda app: not isinstance(app, SubordinateBaseClass),
filter_function=lambda app: not isinstance(app, SubordinateBase),
)
plan.add_step(control_plane_principal_upgrade_plan)

control_plane_subordinate_upgrade_plan = await create_upgrade_group(
apps=analysis_result.apps_control_plane,
description="Control Plane subordinate(s) upgrade plan",
target=target,
filter_function=lambda app: isinstance(app, SubordinateBaseClass),
filter_function=lambda app: isinstance(app, SubordinateBase),
)
plan.add_step(control_plane_subordinate_upgrade_plan)

Expand Down
25 changes: 10 additions & 15 deletions tests/unit/apps/test_auxiliary.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@
"""Auxiliary application class."""
import pytest

from cou.apps.auxiliary import (
CephMonApplication,
MysqlInnodbClusterApplication,
OvnPrincipalApplication,
RabbitMQServer,
)
from cou.apps.auxiliary import CephMon, MysqlInnodbCluster, OvnPrincipal, RabbitMQServer
from cou.apps.base import ApplicationUnit
from cou.exceptions import ApplicationError, HaltUpgradePlanGeneration
from cou.steps import (
Expand Down Expand Up @@ -376,8 +371,8 @@ def test_auxiliary_no_suitable_channel(status, config, model):


def test_ceph_mon_app(status, config, model):
"""Test the correctness of instantiating CephMonApplication."""
app = CephMonApplication(
"""Test the correctness of instantiating CephMon."""
app = CephMon(
"ceph-mon",
status["ceph-mon_xena"],
config["auxiliary_xena"],
Expand Down Expand Up @@ -406,7 +401,7 @@ def test_ceph_mon_upgrade_plan_xena_to_yoga(
):
"""Test when ceph version changes between os releases."""
target = OpenStackRelease("yoga")
app = CephMonApplication(
app = CephMon(
"ceph-mon",
status["ceph-mon_xena"],
config["auxiliary_xena"],
Expand Down Expand Up @@ -481,7 +476,7 @@ def test_ceph_mon_upgrade_plan_ussuri_to_victoria(
):
"""Test when ceph version remains the same between os releases."""
target = OpenStackRelease("victoria")
app = CephMonApplication(
app = CephMon(
"ceph-mon",
status["ceph-mon_ussuri"],
config["auxiliary_ussuri"],
Expand Down Expand Up @@ -544,7 +539,7 @@ def test_ceph_mon_upgrade_plan_ussuri_to_victoria(


def test_ovn_principal(status, config, model):
app = OvnPrincipalApplication(
app = OvnPrincipal(
"ovn-central",
status["ovn_central_ussuri_22"],
config["auxiliary_ussuri"],
Expand All @@ -569,7 +564,7 @@ def test_ovn_workload_ver_lower_than_22_principal(status, config, model):
"ovn-upgrade-2203.html"
)

app_ovn_central = OvnPrincipalApplication(
app_ovn_central = OvnPrincipal(
"ovn-central",
status["ovn_central_ussuri_20"],
config["auxiliary_ussuri"],
Expand All @@ -586,7 +581,7 @@ def test_ovn_no_compatible_os_release(status, config, model, channel):
ovn_central_status = status["ovn_central_ussuri_22"]
ovn_central_status.charm_channel = channel
with pytest.raises(ApplicationError):
OvnPrincipalApplication(
OvnPrincipal(
"ovn-central",
ovn_central_status,
config["auxiliary_ussuri"],
Expand All @@ -597,7 +592,7 @@ def test_ovn_no_compatible_os_release(status, config, model, channel):

def test_ovn_principal_upgrade_plan(status, config, model):
target = OpenStackRelease("victoria")
app = OvnPrincipalApplication(
app = OvnPrincipal(
"ovn-central",
status["ovn_central_ussuri_22"],
config["auxiliary_ussuri"],
Expand Down Expand Up @@ -659,7 +654,7 @@ def test_ovn_principal_upgrade_plan(status, config, model):
def test_mysql_innodb_cluster_upgrade(status, config, model):
target = OpenStackRelease("victoria")
# source is already configured to wallaby, so the plan halt with target victoria
app = MysqlInnodbClusterApplication(
app = MysqlInnodbCluster(
"mysql-innodb-cluster",
status["mysql-innodb-cluster"],
config["auxiliary_ussuri"],
Expand Down
16 changes: 8 additions & 8 deletions tests/unit/apps/test_auxiliary_subordinate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import pytest

from cou.apps.auxiliary_subordinate import (
OpenStackAuxiliarySubordinateApplication,
OvnSubordinateApplication,
AuxiliarySubordinateApplication,
OvnSubordinate,
)
from cou.exceptions import ApplicationError
from cou.steps import ApplicationUpgradePlan, PreUpgradeStep, UpgradeStep
Expand Down Expand Up @@ -56,7 +56,7 @@ def test_auxiliary_subordinate_upgrade_plan_to_victoria(apps, model):


def test_ovn_subordinate(status, model):
app = OvnSubordinateApplication(
app = OvnSubordinate(
"ovn-chassis",
status["ovn_chassis_ussuri_22"],
{},
Expand All @@ -81,7 +81,7 @@ def test_ovn_workload_ver_lower_than_22_subordinate(status, model):
"ovn-upgrade-2203.html"
)

app_ovn_chassis = OvnSubordinateApplication(
app_ovn_chassis = OvnSubordinate(
"ovn-chassis",
status["ovn_chassis_ussuri_20"],
{},
Expand All @@ -95,7 +95,7 @@ def test_ovn_workload_ver_lower_than_22_subordinate(status, model):

def test_ovn_subordinate_upgrade_plan(status, model):
target = OpenStackRelease("victoria")
app = OvnSubordinateApplication(
app = OvnSubordinate(
"ovn-chassis",
status["ovn_chassis_ussuri_22"],
{},
Expand Down Expand Up @@ -127,7 +127,7 @@ def test_ovn_subordinate_upgrade_plan_cant_upgrade_charm(status, model):
target = OpenStackRelease("victoria")
app_status = status["ovn_chassis_ussuri_22"]
app_status.can_upgrade_to = ""
app = OvnSubordinateApplication(
app = OvnSubordinate(
"ovn-chassis",
app_status,
{},
Expand All @@ -147,7 +147,7 @@ def test_ovn_subordinate_upgrade_plan_cant_upgrade_charm(status, model):
def test_ceph_dashboard_upgrade_plan_ussuri_to_victoria(status, config, model):
"""Test when ceph version remains the same between os releases."""
target = OpenStackRelease("victoria")
app = OpenStackAuxiliarySubordinateApplication(
app = AuxiliarySubordinateApplication(
"ceph-dashboard",
status["ceph_dashboard_ussuri"],
config["auxiliary_ussuri"],
Expand Down Expand Up @@ -176,7 +176,7 @@ def test_ceph_dashboard_upgrade_plan_ussuri_to_victoria(status, config, model):
def test_ceph_dashboard_upgrade_plan_xena_to_yoga(status, config, model):
"""Test when ceph version changes between os releases."""
target = OpenStackRelease("yoga")
app = OpenStackAuxiliarySubordinateApplication(
app = AuxiliarySubordinateApplication(
"ceph-dashboard",
status["ceph_dashboard_xena"],
config["auxiliary_xena"],
Expand Down
17 changes: 8 additions & 9 deletions tests/unit/apps/test_channel_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from cou.apps.channel_based import OpenStackChannelBasedApplication
from cou.apps.channel_based import ChannelBasedApplication
from cou.steps import (
ApplicationUpgradePlan,
PostUpgradeStep,
Expand All @@ -24,7 +23,7 @@


def test_application_versionless(status, config, model):
app = OpenStackChannelBasedApplication(
app = ChannelBasedApplication(
"glance-simplestreams-sync",
status["glance_simplestreams_sync_ussuri"],
config["openstack_ussuri"],
Expand All @@ -36,7 +35,7 @@ def test_application_versionless(status, config, model):


def test_application_gnocchi_ussuri(status, config, model):
app = OpenStackChannelBasedApplication(
app = ChannelBasedApplication(
"gnocchi",
status["gnocchi_ussuri"],
config["openstack_ussuri"],
Expand All @@ -50,7 +49,7 @@ def test_application_gnocchi_ussuri(status, config, model):
def test_application_gnocchi_xena(status, config, model):
# workload version is the same for xena and yoga, but current_os_release
# is based on the channel.
app = OpenStackChannelBasedApplication(
app = ChannelBasedApplication(
"gnocchi",
status["gnocchi_xena"],
config["openstack_xena"],
Expand All @@ -66,7 +65,7 @@ def test_application_designate_bind_ussuri(status, config, model):
# is based on the channel.
app_config = config["openstack_ussuri"]
app_config["action-managed-upgrade"] = {"value": False}
app = OpenStackChannelBasedApplication(
app = ChannelBasedApplication(
"designate-bind",
status["designate_bind_ussuri"],
app_config,
Expand All @@ -82,7 +81,7 @@ def test_application_versionless_upgrade_plan_ussuri_to_victoria(status, config,
app_config = config["openstack_ussuri"]
# Does not have action-managed-upgrade
app_config.pop("action-managed-upgrade")
app = OpenStackChannelBasedApplication(
app = ChannelBasedApplication(
"glance-simplestreams-sync",
status["glance_simplestreams_sync_ussuri"],
app_config,
Expand Down Expand Up @@ -143,7 +142,7 @@ def test_application_gnocchi_upgrade_plan_ussuri_to_victoria(status, config, mod
target = OpenStackRelease("victoria")
app_config = config["openstack_ussuri"]
app_config["action-managed-upgrade"] = {"value": False}
app = OpenStackChannelBasedApplication(
app = ChannelBasedApplication(
"gnocchi",
status["gnocchi_ussuri"],
app_config,
Expand Down Expand Up @@ -213,7 +212,7 @@ def test_application_designate_bind_upgrade_plan_ussuri_to_victoria(status, conf
target = OpenStackRelease("victoria")
app_config = config["openstack_ussuri"]
app_config["action-managed-upgrade"] = {"value": False}
app = OpenStackChannelBasedApplication(
app = ChannelBasedApplication(
"designate-bind",
status["designate_bind_ussuri"],
app_config,
Expand Down
Loading
Loading