Do not support dimensions:kernel_memory on Docker API 1.42
It is deprecated in 20.10 and removed in 23.0 (and 23.0 is out) [1], [2]. [1]: https://docs.docker.com/engine/deprecated/#kernel-memory-limit [2]: https://docs.docker.com/engine/api/version-history/#v142-api-changes Change-Id: Ia6fa85172aad7bcd5f958922d3c224ef79882e6c
This commit is contained in:
parent
66ec9cef55
commit
f253f99c12
@ -50,6 +50,8 @@ class DockerWorker(object):
|
||||
|
||||
self._cgroupns_mode_supported = (
|
||||
StrictVersion(self.dc._version) >= StrictVersion('1.41'))
|
||||
self._dimensions_kernel_memory_removed = (
|
||||
StrictVersion(self.dc._version) >= StrictVersion('1.42'))
|
||||
|
||||
self.systemd = SystemdWorker(self.params)
|
||||
|
||||
@ -310,8 +312,11 @@ class DockerWorker(object):
|
||||
'memswap_limit': 'MemorySwap', 'cpu_period': 'CpuPeriod',
|
||||
'cpu_quota': 'CpuQuota', 'cpu_shares': 'CpuShares',
|
||||
'cpuset_cpus': 'CpusetCpus', 'cpuset_mems': 'CpusetMems',
|
||||
'kernel_memory': 'KernelMemory', 'blkio_weight': 'BlkioWeight',
|
||||
'ulimits': 'Ulimits'}
|
||||
'blkio_weight': 'BlkioWeight', 'ulimits': 'Ulimits'}
|
||||
|
||||
if not self._dimensions_kernel_memory_removed:
|
||||
dimension_map['kernel_memory'] = 'KernelMemory'
|
||||
|
||||
unsupported = set(new_dimensions.keys()) - \
|
||||
set(dimension_map.keys())
|
||||
if unsupported:
|
||||
|
@ -49,6 +49,14 @@
|
||||
- python3-pip
|
||||
- python3-setuptools
|
||||
|
||||
# TODO(mnasiadka): Remove this once ansible-collection-kolla
|
||||
# installs apparmor
|
||||
- name: Install apparmor on Debian/Ubuntu
|
||||
become: true
|
||||
package:
|
||||
name: apparmor
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Ensure /tmp/logs/ dir
|
||||
file:
|
||||
path: "{{ logs_dir }}"
|
||||
|
@ -269,6 +269,15 @@ class TestMainModule(base.BaseTestCase):
|
||||
docker_api_version='1.41')
|
||||
self.assertTrue(self.dw._cgroupns_mode_supported)
|
||||
|
||||
def test_sets_dimensions_kernelmemory_supported_true(self):
|
||||
self.dw = get_DockerWorker(self.fake_data['params'])
|
||||
self.assertFalse(self.dw._dimensions_kernel_memory_removed)
|
||||
|
||||
def test_sets_dimensions_kernelmemory_supported_false(self):
|
||||
self.dw = get_DockerWorker(self.fake_data['params'],
|
||||
docker_api_version='1.42')
|
||||
self.assertTrue(self.dw._dimensions_kernel_memory_removed)
|
||||
|
||||
|
||||
class TestContainer(base.BaseTestCase):
|
||||
|
||||
@ -1396,6 +1405,22 @@ class TestAttrComp(base.BaseTestCase):
|
||||
self.dw = get_DockerWorker(self.fake_data['params'])
|
||||
self.assertFalse(self.dw.compare_dimensions(container_info))
|
||||
|
||||
def test_compare_dimensions_kernel_memory_1_42(self):
|
||||
self.fake_data['params']['dimensions'] = {
|
||||
'kernel_memory': '1024'}
|
||||
container_info = dict()
|
||||
container_info['HostConfig'] = {
|
||||
'CpuPeriod': 0, 'Memory': 0, 'CpuQuota': 0,
|
||||
'CpusetCpus': '', 'CpuShares': 0, 'BlkioWeight': 0,
|
||||
'CpusetMems': '', 'MemorySwap': 0, 'MemoryReservation': 0,
|
||||
'Ulimits': []}
|
||||
self.dw = get_DockerWorker(self.fake_data['params'],
|
||||
docker_api_version='1.42')
|
||||
self.dw.compare_dimensions(container_info)
|
||||
self.dw.module.exit_json.assert_called_once_with(
|
||||
failed=True, msg=repr("Unsupported dimensions"),
|
||||
unsupported_dimensions=set(['kernel_memory']))
|
||||
|
||||
def test_compare_container_state_pos(self):
|
||||
container_info = {'State': dict(Status='running')}
|
||||
self.dw = get_DockerWorker({'state': 'exited'})
|
||||
|
Loading…
Reference in New Issue
Block a user