From f97fecd73690204aa981f355d3a5d1434515e1f3 Mon Sep 17 00:00:00 2001 From: Serguei Bezverkhi Date: Wed, 16 Mar 2016 08:21:14 -0400 Subject: [PATCH] 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 --- ansible/library/kolla_docker.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ansible/library/kolla_docker.py b/ansible/library/kolla_docker.py index d5bf658cf1..341d78bf68 100644 --- a/ansible/library/kolla_docker.py +++ b/ansible/library/kolla_docker.py @@ -90,6 +90,14 @@ options: - Name of the docker image required: False type: str + ipc_mode: + description: + - Set docker ipc namespace + required: False + type: str + default: None + choices: + - host labels: description: - List of labels to apply to container @@ -245,6 +253,7 @@ class DockerWorker(object): container_info = self.get_container_info() return ( self.compare_image(container_info) or + self.compare_ipc_mode(container_info) or self.compare_labels(container_info) or self.compare_privileged(container_info) or self.compare_pid_mode(container_info) or @@ -253,6 +262,15 @@ class DockerWorker(object): 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): new_pid_mode = self.params.get('pid_mode') current_pid_mode = container_info['HostConfig'].get('PidMode') @@ -442,6 +460,7 @@ class DockerWorker(object): def build_host_config(self, binds): options = { 'network_mode': 'host', + 'ipc_mode': self.params.get('ipc_mode'), 'pid_mode': self.params.get('pid_mode'), 'privileged': self.params.get('privileged'), 'volumes_from': self.params.get('volumes_from') @@ -594,6 +613,7 @@ def generate_module(): name=dict(required=False, type='str'), environment=dict(required=False, type='dict'), image=dict(required=False, type='str'), + ipc_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), remove_on_exit=dict(required=False, type='bool', default=True),