Sync/rebuild for Dalmatian/Epoxy updates

Refresh and rebuild charm for awareness of Dalmatian and Epoxy
Cloud Archive releases.

Change-Id: I290ac45bfd84b95d7301c391b8ca88c4bd152bd5
This commit is contained in:
James Page 2024-11-15 12:09:41 +00:00
parent 3a427cd72c
commit 1991eb7815
No known key found for this signature in database
GPG Key ID: BFECAECBA0E7D8C3
5 changed files with 52 additions and 21 deletions

View File

@ -162,6 +162,8 @@ OPENSTACK_CODENAMES = OrderedDict([
('2023.1', 'antelope'), ('2023.1', 'antelope'),
('2023.2', 'bobcat'), ('2023.2', 'bobcat'),
('2024.1', 'caracal'), ('2024.1', 'caracal'),
('2024.2', 'dalmatian'),
('2025.1', 'epoxy'),
]) ])
# The ugly duckling - must list releases oldest to newest # The ugly duckling - must list releases oldest to newest

View File

@ -18,7 +18,10 @@
# Charm Helpers Developers <juju@lists.ubuntu.com> # Charm Helpers Developers <juju@lists.ubuntu.com>
import copy import copy
from distutils.version import LooseVersion try:
from distutils.version import LooseVersion
except ImportError:
from looseversion import LooseVersion
from enum import Enum from enum import Enum
from functools import wraps from functools import wraps
from collections import namedtuple, UserDict from collections import namedtuple, UserDict

View File

@ -254,6 +254,22 @@ CLOUD_ARCHIVE_POCKETS = {
'caracal/proposed': 'jammy-proposed/caracal', 'caracal/proposed': 'jammy-proposed/caracal',
'jammy-caracal/proposed': 'jammy-proposed/caracal', 'jammy-caracal/proposed': 'jammy-proposed/caracal',
'jammy-proposed/caracal': 'jammy-proposed/caracal', 'jammy-proposed/caracal': 'jammy-proposed/caracal',
# dalmatian
'dalmatian': 'noble-updates/dalmatian',
'noble-dalmatian': 'noble-updates/dalmatian',
'noble-dalmatian/updates': 'noble-updates/dalmatian',
'noble-updates/dalmatian': 'noble-updates/dalmatian',
'dalmatian/proposed': 'noble-proposed/dalmatian',
'noble-dalmatian/proposed': 'noble-proposed/dalmatian',
'noble-proposed/dalmatian': 'noble-proposed/dalmatian',
# epoxy
'epoxy': 'noble-updates/epoxy',
'noble-epoxy': 'noble-updates/epoxy',
'noble-epoxy/updates': 'noble-updates/epoxy',
'noble-updates/epoxy': 'noble-updates/epoxy',
'epoxy/proposed': 'noble-proposed/epoxy',
'noble-epoxy/proposed': 'noble-proposed/epoxy',
'noble-proposed/epoxy': 'noble-proposed/epoxy',
# OVN # OVN
'focal-ovn-22.03': 'focal-updates/ovn-22.03', 'focal-ovn-22.03': 'focal-updates/ovn-22.03',
@ -288,6 +304,8 @@ OPENSTACK_RELEASES = (
'antelope', 'antelope',
'bobcat', 'bobcat',
'caracal', 'caracal',
'dalmatian',
'epoxy',
) )
@ -318,6 +336,8 @@ UBUNTU_OPENSTACK_RELEASE = OrderedDict([
('lunar', 'antelope'), ('lunar', 'antelope'),
('mantic', 'bobcat'), ('mantic', 'bobcat'),
('noble', 'caracal'), ('noble', 'caracal'),
('oracular', 'dalmatian'),
('plucky', 'epoxy'),
]) ])

View File

@ -769,7 +769,7 @@ def handle_create_cephfs(request, service):
log(msg, level=ERROR) log(msg, level=ERROR)
return {'exit-code': 1, 'stderr': msg} return {'exit-code': 1, 'stderr': msg}
if get_cephfs(service=service): if cephfs_name in get_cephfs(service=service):
# CephFS new has already been called # CephFS new has already been called
log("CephFS already created") log("CephFS already created")
return return
@ -853,15 +853,10 @@ def handle_create_cephfs_client(request, service):
log(msg, level=ERROR) log(msg, level=ERROR)
return {'exit-code': 1, 'stderr': msg} return {'exit-code': 1, 'stderr': msg}
# Check that the provided fs_name exists # Skip creation if the request has already been called
if fs_name not in get_cephfs(service=service): # This makes it a bit more compatible with older Ceph versions
msg = ("Ceph filesystem {} does not exist." # that throw when trying to authorize a user with the same
+ "Cannot authorize client").format( # capabilites that it currently has.
fs_name)
log(msg, level=ERROR)
return {'exit-code': 1, 'stderr': msg}
# Check that the provided client does NOT exist.
try: try:
cmd = ["ceph", "--id", service, "auth", "ls", "-f", "json"] cmd = ["ceph", "--id", service, "auth", "ls", "-f", "json"]
auth_ls = json.loads(check_output(cmd, encoding="utf-8")) auth_ls = json.loads(check_output(cmd, encoding="utf-8"))
@ -873,12 +868,14 @@ def handle_create_cephfs_client(request, service):
return {'exit-code': 1, 'stderr': str(err)} return {'exit-code': 1, 'stderr': str(err)}
client = "client.{}".format(client_id) client = "client.{}".format(client_id)
if client in (elem["entity"] for elem in auth_ls["auth_dump"]): for elem in auth_ls["auth_dump"]:
msg = "Client {} already exists".format(client) if client == elem["entity"]:
log(msg, level=ERROR) log("Client {} has already been created".format(client))
return {'exit-code': 1, 'stderr': msg} return {'exit-code': 0, 'key': elem["key"]}
# Try to authorize the client # Try to authorize the client
# `ceph fs authorize` already returns the correct error
# message if the filesystem doesn't exist.
try: try:
cmd = [ cmd = [
"ceph", "ceph",

View File

@ -1541,11 +1541,11 @@ def get_devices(name):
def osdize(dev, osd_format, osd_journal, ignore_errors=False, encrypt=False, def osdize(dev, osd_format, osd_journal, ignore_errors=False, encrypt=False,
key_manager=CEPH_KEY_MANAGER, osd_id=None): key_manager=CEPH_KEY_MANAGER, osd_id=None, bluestore_skip=None):
if dev.startswith('/dev'): if dev.startswith('/dev'):
osdize_dev(dev, osd_format, osd_journal, osdize_dev(dev, osd_format, osd_journal,
ignore_errors, encrypt, ignore_errors, encrypt,
key_manager, osd_id) key_manager, osd_id, bluestore_skip)
else: else:
if cmp_pkgrevno('ceph', '14.0.0') >= 0: if cmp_pkgrevno('ceph', '14.0.0') >= 0:
log("Directory backed OSDs can not be created on Nautilus", log("Directory backed OSDs can not be created on Nautilus",
@ -1556,7 +1556,7 @@ def osdize(dev, osd_format, osd_journal, ignore_errors=False, encrypt=False,
def osdize_dev(dev, osd_format, osd_journal, ignore_errors=False, def osdize_dev(dev, osd_format, osd_journal, ignore_errors=False,
encrypt=False, key_manager=CEPH_KEY_MANAGER, encrypt=False, key_manager=CEPH_KEY_MANAGER,
osd_id=None): osd_id=None, bluestore_skip=None):
""" """
Prepare a block device for use as a Ceph OSD Prepare a block device for use as a Ceph OSD
@ -1570,6 +1570,8 @@ def osdize_dev(dev, osd_format, osd_journal, ignore_errors=False,
processing processing
:param: encrypt: Encrypt block devices using 'key_manager' :param: encrypt: Encrypt block devices using 'key_manager'
:param: key_manager: Key management approach for encryption keys :param: key_manager: Key management approach for encryption keys
:param: osd_id: The ID for the newly created OSD
:param: bluestore_skip: Bluestore parameters to skip ('wal' and/or 'db')
:raises subprocess.CalledProcessError: in the event that any supporting :raises subprocess.CalledProcessError: in the event that any supporting
subprocess operation failed subprocess operation failed
:raises ValueError: if an invalid key_manager is provided :raises ValueError: if an invalid key_manager is provided
@ -1620,7 +1622,8 @@ def osdize_dev(dev, osd_format, osd_journal, ignore_errors=False,
osd_journal, osd_journal,
encrypt, encrypt,
key_manager, key_manager,
osd_id) osd_id,
bluestore_skip)
else: else:
cmd = _ceph_disk(dev, cmd = _ceph_disk(dev,
osd_format, osd_format,
@ -1694,7 +1697,7 @@ def _ceph_disk(dev, osd_format, osd_journal, encrypt=False):
def _ceph_volume(dev, osd_journal, encrypt=False, key_manager=CEPH_KEY_MANAGER, def _ceph_volume(dev, osd_journal, encrypt=False, key_manager=CEPH_KEY_MANAGER,
osd_id=None): osd_id=None, bluestore_skip=None):
""" """
Prepare and activate a device for usage as a Ceph OSD using ceph-volume. Prepare and activate a device for usage as a Ceph OSD using ceph-volume.
@ -1706,6 +1709,7 @@ def _ceph_volume(dev, osd_journal, encrypt=False, key_manager=CEPH_KEY_MANAGER,
:param: encrypt: Use block device encryption :param: encrypt: Use block device encryption
:param: key_manager: dm-crypt Key Manager to use :param: key_manager: dm-crypt Key Manager to use
:param: osd_id: The OSD-id to recycle, or None to create a new one :param: osd_id: The OSD-id to recycle, or None to create a new one
:param: bluestore_skip: Bluestore parameters to skip ('wal' and/or 'db')
:raises subprocess.CalledProcessError: in the event that any supporting :raises subprocess.CalledProcessError: in the event that any supporting
LVM operation failed. LVM operation failed.
:returns: list. 'ceph-volume' command and required parameters for :returns: list. 'ceph-volume' command and required parameters for
@ -1732,7 +1736,11 @@ def _ceph_volume(dev, osd_journal, encrypt=False, key_manager=CEPH_KEY_MANAGER,
encrypt=encrypt, encrypt=encrypt,
key_manager=key_manager)) key_manager=key_manager))
for extra_volume in ('wal', 'db'): extras = ('wal', 'db')
if bluestore_skip:
extras = tuple(set(extras) - set(bluestore_skip))
for extra_volume in extras:
devices = get_devices('bluestore-{}'.format(extra_volume)) devices = get_devices('bluestore-{}'.format(extra_volume))
if devices: if devices:
cmd.append('--block.{}'.format(extra_volume)) cmd.append('--block.{}'.format(extra_volume))
@ -2075,6 +2083,7 @@ def get_cephfs(service):
for part in parts: for part in parts:
if "name" in part: if "name" in part:
filesystems.append(part.split(' ')[1]) filesystems.append(part.split(' ')[1])
return filesystems
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
return [] return []