775a9daaf1334b7fe1d5d49083eb7141edc6e963
[apex-tripleo-heat-templates.git] / docker / services / nova-libvirt.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack Libvirt Service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerLibvirtImage:
12     description: image
13     default: 'centos-binary-nova-libvirt:latest'
14     type: string
15   # we configure libvirt via the nova-compute container due to coupling
16   # in the puppet modules
17   DockerNovaConfigImage:
18     description: image
19     default: 'centos-binary-nova-compute:latest'
20     type: string
21   ServiceNetMap:
22     default: {}
23     description: Mapping of service_name -> network name. Typically set
24                  via parameter_defaults in the resource registry.  This
25                  mapping overrides those in ServiceNetMapDefaults.
26     type: json
27   DefaultPasswords:
28     default: {}
29     type: json
30   EndpointMap:
31     default: {}
32     description: Mapping of service endpoint -> protocol. Typically set
33                  via parameter_defaults in the resource registry.
34     type: json
35
36 resources:
37
38   ContainersCommon:
39     type: ./containers-common.yaml
40
41   NovaLibvirtBase:
42     type: ../../puppet/services/nova-libvirt.yaml
43     properties:
44       EndpointMap: {get_param: EndpointMap}
45       ServiceNetMap: {get_param: ServiceNetMap}
46       DefaultPasswords: {get_param: DefaultPasswords}
47
48 outputs:
49   role_data:
50     description: Role data for the Libvirt service.
51     value:
52       service_name: {get_attr: [NovaLibvirtBase, role_data, service_name]}
53       config_settings:
54         map_merge:
55           - get_attr: [NovaLibvirtBase, role_data, config_settings]
56           # FIXME: we need to disable migration for now as the
57           # hieradata is common for all services, and this means nova
58           # and nova_placement puppet runs also try to configure
59           # libvirt, and they fail. We can remove this override when
60           # we have hieradata separation between containers.
61           - tripleo::profile::base::nova::manage_migration: false
62       step_config: &step_config
63         get_attr: [NovaLibvirtBase, role_data, step_config]
64       puppet_config:
65         config_volume: nova_libvirt
66         puppet_tags: nova_config
67         step_config: *step_config
68         config_image:
69           list_join:
70           - '/'
71           - [ {get_param: DockerNamespace}, {get_param: DockerNovaConfigImage} ]
72       kolla_config:
73         /var/lib/kolla/config_files/nova-libvirt.json:
74           command: /usr/sbin/libvirtd --config /etc/libvirt/libvirtd.conf
75           permissions:
76             - path: /var/log/nova
77               owner: nova:nova
78               recurse: true
79       docker_config:
80         step_3:
81           nova_libvirt:
82             image:
83               list_join:
84               - '/'
85               - [ {get_param: DockerNamespace}, {get_param: DockerLibvirtImage} ]
86             net: host
87             pid: host
88             privileged: true
89             restart: always
90             volumes:
91               list_concat:
92                 - {get_attr: [ContainersCommon, volumes]}
93                 -
94                   - /var/lib/kolla/config_files/nova-libvirt.json:/var/lib/kolla/config_files/config.json:ro
95                   - /var/lib/config-data/nova_libvirt/etc/libvirt/:/etc/libvirt/:ro
96                   - /lib/modules:/lib/modules:ro
97                   - /dev:/dev
98                   - /run:/run
99                   - /sys/fs/cgroup:/sys/fs/cgroup
100                   - /var/lib/nova:/var/lib/nova
101                   # Needed to use host's virtlogd
102                   - /var/run/libvirt:/var/run/libvirt
103                   - /var/lib/libvirt:/var/lib/libvirt
104                   - /etc/libvirt/qemu:/etc/libvirt/qemu
105                   - /var/log/containers/nova:/var/log/nova
106             environment:
107               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
108       host_prep_tasks:
109         - name: create libvirt persistent data directories
110           file:
111             path: "{{ item }}"
112             state: directory
113           with_items:
114             - /etc/libvirt/qemu
115             - /var/lib/libvirt
116             - /var/log/containers/nova
117       upgrade_tasks:
118         - name: Stop and disable libvirtd service
119           tags: step2
120           service: name=libvirtd state=stopped enabled=no