py3: deal with subordinate dependencies
Switch to marking non-leaf python-* packages as automatically installed so that they will be purged once the last remaining package that depends on them that was manually installed is removed. Force install of python3-nova-lxd for Rocky and above to ensure that py versions are matched with python3-nova. Change-Id: I79d528bfb7732490aa42da2158244350c03dfa59 Closes-Bug: 1797879
This commit is contained in:
parent
35ba6b37ca
commit
7f15c2f5ce
|
@ -34,6 +34,7 @@ from charmhelpers.fetch import (
|
|||
apt_install,
|
||||
apt_purge,
|
||||
apt_autoremove,
|
||||
apt_mark,
|
||||
filter_missing_packages,
|
||||
)
|
||||
|
||||
|
@ -136,7 +137,12 @@ PY3_PACKAGES = [
|
|||
|
||||
PURGE_PACKAGES = [
|
||||
'python-nova',
|
||||
]
|
||||
|
||||
HELD_PACKAGES = [
|
||||
'python-memcache',
|
||||
'python-six',
|
||||
'python-psutil',
|
||||
]
|
||||
|
||||
VERSION_PACKAGE = 'nova-common'
|
||||
|
@ -252,6 +258,7 @@ VIRT_TYPES = {
|
|||
'lxd': ['nova-compute-lxd'],
|
||||
}
|
||||
|
||||
|
||||
# Maps virt-type config to a libvirt URI.
|
||||
LIBVIRT_URIS = {
|
||||
'kvm': 'qemu:///system',
|
||||
|
@ -412,6 +419,8 @@ def determine_packages():
|
|||
if cmp_release >= 'rocky':
|
||||
packages = [p for p in packages if not p.startswith('python-')]
|
||||
packages.extend(PY3_PACKAGES)
|
||||
if virt_type == 'lxd':
|
||||
packages.append('python3-nova-lxd')
|
||||
|
||||
return packages
|
||||
|
||||
|
@ -424,6 +433,15 @@ def determine_purge_packages():
|
|||
return []
|
||||
|
||||
|
||||
def determine_held_packages():
|
||||
'''Return a list of packages to mark as candidates for removal
|
||||
for the current OS release'''
|
||||
cmp_os_source = CompareOpenStackReleases(os_release('nova-common'))
|
||||
if cmp_os_source >= 'rocky':
|
||||
return HELD_PACKAGES
|
||||
return []
|
||||
|
||||
|
||||
def migration_enabled():
|
||||
# XXX: confirm juju-core bool behavior is the same.
|
||||
return config('enable-live-migration')
|
||||
|
@ -600,6 +618,8 @@ def do_openstack_upgrade(configs):
|
|||
determine_purge_packages()
|
||||
)
|
||||
if installed_packages:
|
||||
apt_mark(filter_missing_packages(determine_held_packages()),
|
||||
'auto')
|
||||
apt_purge(installed_packages, fatal=True)
|
||||
apt_autoremove(purge=True, fatal=True)
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ TO_PATCH = [
|
|||
'apt_update',
|
||||
'apt_purge',
|
||||
'apt_autoremove',
|
||||
'apt_mark',
|
||||
'filter_missing_packages',
|
||||
'config',
|
||||
'os_release',
|
||||
|
|
Loading…
Reference in New Issue