Remove chrony if inside a container
When running ceph-mon in containers, best practice is to have chrony/ntp configured and installed on the bare metal and then have the container trust the system clock, as the container should not manage the system clock. The chrony package get installed automatically as part of the dependencies of other packages, which gets removed in this change. Also contains related changes for charms.ceph. Change-Id: If8beb28ea5b5e6317180e52c3e32463e472276f4 Closes-Bug: #1852441 Depends-On: Ie3c9c5899c1d46edd21c32868938d3290db321e7
This commit is contained in:
parent
b0408a101d
commit
60a9a4f27a
|
@ -58,6 +58,7 @@ from charmhelpers.core.host import (
|
|||
from charmhelpers.fetch import (
|
||||
apt_install,
|
||||
apt_update,
|
||||
apt_purge,
|
||||
filter_installed_packages,
|
||||
add_source,
|
||||
get_upstream_version,
|
||||
|
@ -160,6 +161,9 @@ def install():
|
|||
add_source(config('source'), config('key'))
|
||||
apt_update(fatal=True)
|
||||
apt_install(packages=ceph.determine_packages(), fatal=True)
|
||||
rm_packages = ceph.determine_packages_to_remove()
|
||||
if rm_packages:
|
||||
apt_purge(packages=rm_packages, fatal=True)
|
||||
try:
|
||||
# we defer and explicitly run `ceph-create-keys` from
|
||||
# add_keyring_to_ceph() as part of bootstrap process
|
||||
|
|
|
@ -41,6 +41,7 @@ from charmhelpers.core.host import (
|
|||
service_stop,
|
||||
CompareHostReleases,
|
||||
write_file,
|
||||
is_container,
|
||||
)
|
||||
from charmhelpers.core.hookenv import (
|
||||
cached,
|
||||
|
@ -54,8 +55,12 @@ from charmhelpers.core.hookenv import (
|
|||
storage_list,
|
||||
)
|
||||
from charmhelpers.fetch import (
|
||||
add_source,
|
||||
apt_cache,
|
||||
add_source, apt_install, apt_update
|
||||
apt_install,
|
||||
apt_purge,
|
||||
apt_update,
|
||||
filter_missing_packages
|
||||
)
|
||||
from charmhelpers.contrib.storage.linux.ceph import (
|
||||
get_mon_map,
|
||||
|
@ -85,6 +90,9 @@ PACKAGES = ['ceph', 'gdisk',
|
|||
'radosgw', 'xfsprogs',
|
||||
'lvm2', 'parted', 'smartmontools']
|
||||
|
||||
REMOVE_PACKAGES = []
|
||||
CHRONY_PACKAGE = 'chrony'
|
||||
|
||||
CEPH_KEY_MANAGER = 'ceph'
|
||||
VAULT_KEY_MANAGER = 'vault'
|
||||
KEY_MANAGERS = [
|
||||
|
@ -2209,8 +2217,11 @@ def upgrade_monitor(new_version, kick_function=None):
|
|||
else:
|
||||
service_stop('ceph-mon-all')
|
||||
apt_install(packages=determine_packages(), fatal=True)
|
||||
kick_function()
|
||||
rm_packages = determine_packages_to_remove()
|
||||
if rm_packages:
|
||||
apt_purge(packages=rm_packages, fatal=True)
|
||||
|
||||
kick_function()
|
||||
owner = ceph_user()
|
||||
|
||||
# Ensure the files and directories under /var/lib/ceph is chowned
|
||||
|
@ -3252,6 +3263,19 @@ def determine_packages():
|
|||
return packages
|
||||
|
||||
|
||||
def determine_packages_to_remove():
|
||||
"""Determines packages for removal
|
||||
|
||||
:returns: list of packages to be removed
|
||||
"""
|
||||
rm_packages = REMOVE_PACKAGES.copy()
|
||||
if is_container():
|
||||
install_list = filter_missing_packages(CHRONY_PACKAGE)
|
||||
if not install_list:
|
||||
rm_packages.append(CHRONY_PACKAGE)
|
||||
return rm_packages
|
||||
|
||||
|
||||
def bootstrap_manager():
|
||||
hostname = socket.gethostname()
|
||||
path = '/var/lib/ceph/mgr/ceph-{}'.format(hostname)
|
||||
|
|
Loading…
Reference in New Issue