Merge "Dell SC: Add secondary DSM support"
[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   RoleName:
31     default: ''
32     description: Role name on which the service is applied
33     type: string
34   RoleParameters:
35     default: {}
36     description: Parameters specific to the role
37     type: json
38   EndpointMap:
39     default: {}
40     description: Mapping of service endpoint -> protocol. Typically set
41                  via parameter_defaults in the resource registry.
42     type: json
43
44 resources:
45
46   ContainersCommon:
47     type: ./containers-common.yaml
48
49   NovaLibvirtBase:
50     type: ../../puppet/services/nova-libvirt.yaml
51     properties:
52       EndpointMap: {get_param: EndpointMap}
53       ServiceNetMap: {get_param: ServiceNetMap}
54       DefaultPasswords: {get_param: DefaultPasswords}
55       RoleName: {get_param: RoleName}
56       RoleParameters: {get_param: RoleParameters}
57
58 outputs:
59   role_data:
60     description: Role data for the Libvirt service.
61     value:
62       service_name: {get_attr: [NovaLibvirtBase, role_data, service_name]}
63       config_settings:
64         map_merge:
65           - get_attr: [NovaLibvirtBase, role_data, config_settings]
66           # FIXME: we need to disable migration for now as the
67           # hieradata is common for all services, and this means nova
68           # and nova_placement puppet runs also try to configure
69           # libvirt, and they fail. We can remove this override when
70           # we have hieradata separation between containers.
71           - tripleo::profile::base::nova::manage_migration: false
72       step_config: &step_config
73         get_attr: [NovaLibvirtBase, role_data, step_config]
74       puppet_config:
75         config_volume: nova_libvirt
76         puppet_tags: nova_config
77         step_config: *step_config
78         config_image:
79           list_join:
80           - '/'
81           - [ {get_param: DockerNamespace}, {get_param: DockerNovaConfigImage} ]
82       kolla_config:
83         /var/lib/kolla/config_files/nova-libvirt.json:
84           command: /usr/sbin/libvirtd --config /etc/libvirt/libvirtd.conf
85           permissions:
86             - path: /var/log/nova
87               owner: nova:nova
88               recurse: true
89       docker_config:
90         step_3:
91           nova_libvirt:
92             image:
93               list_join:
94               - '/'
95               - [ {get_param: DockerNamespace}, {get_param: DockerLibvirtImage} ]
96             net: host
97             pid: host
98             privileged: true
99             restart: always
100             volumes:
101               list_concat:
102                 - {get_attr: [ContainersCommon, volumes]}
103                 -
104                   - /var/lib/kolla/config_files/nova-libvirt.json:/var/lib/kolla/config_files/config.json:ro
105                   - /var/lib/config-data/nova_libvirt/etc/libvirt/:/etc/libvirt/:ro
106                   - /lib/modules:/lib/modules:ro
107                   - /dev:/dev
108                   - /run:/run
109                   - /sys/fs/cgroup:/sys/fs/cgroup
110                   - /var/lib/nova:/var/lib/nova
111                   # Needed to use host's virtlogd
112                   - /var/run/libvirt:/var/run/libvirt
113                   - /var/lib/libvirt:/var/lib/libvirt
114                   - /etc/libvirt/qemu:/etc/libvirt/qemu
115                   - /var/log/containers/nova:/var/log/nova
116             environment:
117               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
118       host_prep_tasks:
119         - name: create libvirt persistent data directories
120           file:
121             path: "{{ item }}"
122             state: directory
123           with_items:
124             - /etc/libvirt/qemu
125             - /var/lib/libvirt
126             - /var/log/containers/nova
127       upgrade_tasks:
128         - name: Stop and disable libvirtd service
129           tags: step2
130           service: name=libvirtd state=stopped enabled=no