Set --ipc option to "host" for kolla_docker
This change will enable to lvm commands running in a container communicate with udev process running on a host. Partially-Implements: blueprint iscsi-lvm2-docker Change-Id: If780710bb81adaee44ce0d291e22ce91ec6436aa
This commit is contained in:
parent
1c0082169c
commit
f97fecd736
@ -90,6 +90,14 @@ options:
|
|||||||
- Name of the docker image
|
- Name of the docker image
|
||||||
required: False
|
required: False
|
||||||
type: str
|
type: str
|
||||||
|
ipc_mode:
|
||||||
|
description:
|
||||||
|
- Set docker ipc namespace
|
||||||
|
required: False
|
||||||
|
type: str
|
||||||
|
default: None
|
||||||
|
choices:
|
||||||
|
- host
|
||||||
labels:
|
labels:
|
||||||
description:
|
description:
|
||||||
- List of labels to apply to container
|
- List of labels to apply to container
|
||||||
@ -245,6 +253,7 @@ class DockerWorker(object):
|
|||||||
container_info = self.get_container_info()
|
container_info = self.get_container_info()
|
||||||
return (
|
return (
|
||||||
self.compare_image(container_info) or
|
self.compare_image(container_info) or
|
||||||
|
self.compare_ipc_mode(container_info) or
|
||||||
self.compare_labels(container_info) or
|
self.compare_labels(container_info) or
|
||||||
self.compare_privileged(container_info) or
|
self.compare_privileged(container_info) or
|
||||||
self.compare_pid_mode(container_info) or
|
self.compare_pid_mode(container_info) or
|
||||||
@ -253,6 +262,15 @@ class DockerWorker(object):
|
|||||||
self.compare_environment(container_info)
|
self.compare_environment(container_info)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def compare_ipc_mode(self, container_info):
|
||||||
|
new_ipc_mode = self.params.get('ipc_mode')
|
||||||
|
current_ipc_mode = container_info['HostConfig'].get('IpcMode')
|
||||||
|
if not current_ipc_mode:
|
||||||
|
current_ipc_mode = None
|
||||||
|
|
||||||
|
if new_ipc_mode != current_ipc_mode:
|
||||||
|
return True
|
||||||
|
|
||||||
def compare_pid_mode(self, container_info):
|
def compare_pid_mode(self, container_info):
|
||||||
new_pid_mode = self.params.get('pid_mode')
|
new_pid_mode = self.params.get('pid_mode')
|
||||||
current_pid_mode = container_info['HostConfig'].get('PidMode')
|
current_pid_mode = container_info['HostConfig'].get('PidMode')
|
||||||
@ -442,6 +460,7 @@ class DockerWorker(object):
|
|||||||
def build_host_config(self, binds):
|
def build_host_config(self, binds):
|
||||||
options = {
|
options = {
|
||||||
'network_mode': 'host',
|
'network_mode': 'host',
|
||||||
|
'ipc_mode': self.params.get('ipc_mode'),
|
||||||
'pid_mode': self.params.get('pid_mode'),
|
'pid_mode': self.params.get('pid_mode'),
|
||||||
'privileged': self.params.get('privileged'),
|
'privileged': self.params.get('privileged'),
|
||||||
'volumes_from': self.params.get('volumes_from')
|
'volumes_from': self.params.get('volumes_from')
|
||||||
@ -594,6 +613,7 @@ def generate_module():
|
|||||||
name=dict(required=False, type='str'),
|
name=dict(required=False, type='str'),
|
||||||
environment=dict(required=False, type='dict'),
|
environment=dict(required=False, type='dict'),
|
||||||
image=dict(required=False, type='str'),
|
image=dict(required=False, type='str'),
|
||||||
|
ipc_mode=dict(required=False, type='str', choices=['host']),
|
||||||
pid_mode=dict(required=False, type='str', choices=['host']),
|
pid_mode=dict(required=False, type='str', choices=['host']),
|
||||||
privileged=dict(required=False, type='bool', default=False),
|
privileged=dict(required=False, type='bool', default=False),
|
||||||
remove_on_exit=dict(required=False, type='bool', default=True),
|
remove_on_exit=dict(required=False, type='bool', default=True),
|
||||||
|
Loading…
Reference in New Issue
Block a user