From 9c5e708fe247234459d153b77893b172e45760de Mon Sep 17 00:00:00 2001 From: Steven Dake <stdake@cisco.com> Date: Wed, 15 Jul 2015 13:15:10 -0700 Subject: [PATCH] Add pid_mode to libvirt Libvirt requires pid_mode to Host to operate on Fedora Hosts. Further we will need this for libvirt upgrade. I am not entirely sure why libvirt running with pid=host gets things working, but it definately has something to do with CentOS's libvirt's integration with systemd. Nailing down the problem, the interface to the Docker module accepts only None or "host". There is no way to generate a None type except with !!null in yml, but this does not work in the jinja2 parser. As a result, one solution is this conditional. A better long term solution would be for the Docker module to take some other argument to indicate None that can be expressed in a string. Change-Id: I54eb87e8ce8679bbf12f671527280c73e195b2e4 Closes-Bug: #1473270 --- ansible/roles/nova/tasks/start.yml | 1 + ansible/roles/start.yml | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/ansible/roles/nova/tasks/start.yml b/ansible/roles/nova/tasks/start.yml index 18b2f0e8cf..1d1c92356f 100644 --- a/ansible/roles/nova/tasks/start.yml +++ b/ansible/roles/nova/tasks/start.yml @@ -6,6 +6,7 @@ container_image: "{{ docker_nova_libvirt_image_full }}" container_name: "nova_libvirt" container_privileged: "True" + container_pid: "True" container_volumes: - "/run:/run" - "/lib/modules:/lib/modules:ro" diff --git a/ansible/roles/start.yml b/ansible/roles/start.yml index 4e202da3ec..26262bd3d1 100644 --- a/ansible/roles/start.yml +++ b/ansible/roles/start.yml @@ -30,3 +30,28 @@ volumes: "{{ container_volumes }}" volumes_from: "{{ container_volumes_from | default([]) }}" run_once: "{{ run_once | default('False') }}" + when: not container_pid|default(False) + +- name: Starting container(s) + docker: + command: "{{ container_command | default(None) }}" + detach: "{{ container_detach | default('True') }}" + env: "{{ container_environment | default({}) }}" + docker_api_version: "{{ docker_api_version }}" + image: "{{ container_image }}" + insecure_registry: "{{ docker_insecure_registry }}" + name: "{{ container_name }}" + net: "host" + pid: "host" + password: "{{ docker_registry_password }}" + privileged: "{{ container_privileged | default('False') }}" + pull: "{{ docker_pull_policy }}" + registry: "{{ docker_registry }}" + restart_policy: "{{ container_restart_policy | default(docker_restart_policy) }}" + restart_policy_retry: "{{ docker_restart_policy_retry }}" + state: "reloaded" + username: "{{ docker_registry_username }}" + volumes: "{{ container_volumes }}" + volumes_from: "{{ container_volumes_from | default([]) }}" + run_once: "{{ run_once | default('False') }}" + when: container_pid|default(False) -- GitLab