Merge "Fix the constraints for THT params NeutronDpdkCoreList and HostCpusList"
[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   EnablePackageInstall:
22     default: 'false'
23     description: Set to true to enable package installation
24     type: boolean
25   ServiceNetMap:
26     default: {}
27     description: Mapping of service_name -> network name. Typically set
28                  via parameter_defaults in the resource registry.  This
29                  mapping overrides those in ServiceNetMapDefaults.
30     type: json
31   DefaultPasswords:
32     default: {}
33     type: json
34   RoleName:
35     default: ''
36     description: Role name on which the service is applied
37     type: string
38   RoleParameters:
39     default: {}
40     description: Parameters specific to the role
41     type: json
42   EndpointMap:
43     default: {}
44     description: Mapping of service endpoint -> protocol. Typically set
45                  via parameter_defaults in the resource registry.
46     type: json
47
48 resources:
49
50   ContainersCommon:
51     type: ./containers-common.yaml
52
53   NovaLibvirtBase:
54     type: ../../puppet/services/nova-libvirt.yaml
55     properties:
56       EndpointMap: {get_param: EndpointMap}
57       ServiceNetMap: {get_param: ServiceNetMap}
58       DefaultPasswords: {get_param: DefaultPasswords}
59       RoleName: {get_param: RoleName}
60       RoleParameters: {get_param: RoleParameters}
61
62 outputs:
63   role_data:
64     description: Role data for the Libvirt service.
65     value:
66       service_name: {get_attr: [NovaLibvirtBase, role_data, service_name]}
67       config_settings:
68         map_merge:
69           - get_attr: [NovaLibvirtBase, role_data, config_settings]
70           # FIXME: we need to disable migration for now as the
71           # hieradata is common for all services, and this means nova
72           # and nova_placement puppet runs also try to configure
73           # libvirt, and they fail. We can remove this override when
74           # we have hieradata separation between containers.
75           - tripleo::profile::base::nova::manage_migration: false
76       step_config: &step_config
77         get_attr: [NovaLibvirtBase, role_data, step_config]
78       puppet_config:
79         config_volume: nova_libvirt
80         puppet_tags: nova_config
81         step_config: *step_config
82         config_image:
83           list_join:
84           - '/'
85           - [ {get_param: DockerNamespace}, {get_param: DockerNovaConfigImage} ]
86       kolla_config:
87         /var/lib/kolla/config_files/nova-libvirt.json:
88           command: /usr/sbin/libvirtd --config /etc/libvirt/libvirtd.conf
89           permissions:
90             - path: /var/log/nova
91               owner: nova:nova
92               recurse: true
93       docker_config:
94         step_3:
95           nova_libvirt:
96             image:
97               list_join:
98               - '/'
99               - [ {get_param: DockerNamespace}, {get_param: DockerLibvirtImage} ]
100             net: host
101             pid: host
102             privileged: true
103             restart: always
104             volumes:
105               list_concat:
106                 - {get_attr: [ContainersCommon, volumes]}
107                 -
108                   - /var/lib/kolla/config_files/nova-libvirt.json:/var/lib/kolla/config_files/config.json:ro
109                   - /var/lib/config-data/nova_libvirt/etc/libvirt/:/etc/libvirt/:ro
110                   - /lib/modules:/lib/modules:ro
111                   - /dev:/dev
112                   - /run:/run
113                   - /sys/fs/cgroup:/sys/fs/cgroup
114                   - /var/lib/nova:/var/lib/nova
115                   # Needed to use host's virtlogd
116                   - /var/run/libvirt:/var/run/libvirt
117                   - /var/lib/libvirt:/var/lib/libvirt
118                   - /etc/libvirt/qemu:/etc/libvirt/qemu
119                   - /var/log/libvirt/qemu:/var/log/libvirt/qemu:ro
120                   - /var/log/containers/nova:/var/log/nova
121             environment:
122               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
123       host_prep_tasks:
124         - name: create libvirt persistent data directories
125           file:
126             path: "{{ item }}"
127             state: directory
128           with_items:
129             - /etc/libvirt/qemu
130             - /var/lib/libvirt
131             - /var/log/containers/nova
132         - name: set enable_package_install fact
133           set_fact:
134             enable_package_install: {get_param: EnablePackageInstall}
135         # We use virtlogd on host, so when using Deployed Server
136         # feature, we need to ensure libvirt is installed.
137         - name: install libvirt-daemon
138           package:
139             name: libvirt-daemon
140             state: present
141           when: enable_package_install
142         - name: start virtlogd socket
143           service:
144             name: virtlogd.socket
145             state: started
146             enabled: yes
147           when: enable_package_install
148       upgrade_tasks:
149         - name: Stop and disable libvirtd service
150           tags: step2
151           service: name=libvirtd state=stopped enabled=no