1 heat_template_version: pike
4 OpenStack Libvirt Service
7 DockerNovaLibvirtImage:
10 # we configure libvirt via the nova-compute container due to coupling
11 # in the puppet modules
12 DockerNovaLibvirtConfigImage:
13 description: The container image to use for the nova_libvirt config_volume
17 description: Dictionary packing service data
21 description: Mapping of service_name -> network name. Typically set
22 via parameter_defaults in the resource registry. This
23 mapping overrides those in ServiceNetMapDefaults.
30 description: Role name on which the service is applied
34 description: Parameters specific to the role
38 description: Mapping of service endpoint -> protocol. Typically set
39 via parameter_defaults in the resource registry.
44 UseTLSTransportForLiveMigration:
47 description: If set to true and if EnableInternalTLS is enabled, it will
48 set the libvirt URI's transport to tls and configure the
49 relevant keys for libvirt.
50 DockerNovaMigrationSshdPort:
52 description: Port that dockerized nova migration target sshd service
57 description: Whether to enable or not the Rbd backend for Nova
59 CinderEnableRbdBackend:
61 description: Whether to enable or not the Rbd backend for Cinder
64 description: The Ceph client key. Can be created with ceph-authtool --gen-print-key.
69 description: The Ceph cluster FSID. Must be a UUID.
73 use_tls_for_live_migration:
76 - {get_param: EnableInternalTLS}
79 - {get_param: UseTLSTransportForLiveMigration}
85 - {get_param: NovaEnableRbdBackend}
88 - {get_param: CinderEnableRbdBackend}
94 type: ./containers-common.yaml
97 type: ../../puppet/services/database/mysql-client.yaml
100 type: ../../puppet/services/nova-libvirt.yaml
102 EndpointMap: {get_param: EndpointMap}
103 ServiceData: {get_param: ServiceData}
104 ServiceNetMap: {get_param: ServiceNetMap}
105 DefaultPasswords: {get_param: DefaultPasswords}
106 RoleName: {get_param: RoleName}
107 RoleParameters: {get_param: RoleParameters}
108 MigrationSshPort: {get_param: DockerNovaMigrationSshdPort}
112 description: Role data for the Libvirt service.
114 service_name: {get_attr: [NovaLibvirtBase, role_data, service_name]}
117 - get_attr: [NovaLibvirtBase, role_data, config_settings]
118 - tripleo::profile::base::certmonger_user::libvirt_postsave_cmd: "true" # TODO: restart the libvirt container here
120 step_config: &step_config
123 - - {get_attr: [NovaLibvirtBase, role_data, step_config]}
124 - {get_attr: [MySQLClient, role_data, step_config]}
126 config_volume: nova_libvirt
127 puppet_tags: libvirtd_config,nova_config,file
128 step_config: *step_config
129 config_image: {get_param: DockerNovaLibvirtConfigImage}
131 /var/lib/kolla/config_files/nova_libvirt.json:
134 - use_tls_for_live_migration
135 - /usr/sbin/libvirtd --listen --config /etc/libvirt/libvirtd.conf
136 - /usr/sbin/libvirtd --config /etc/libvirt/libvirtd.conf
138 - source: "/var/lib/kolla/config_files/src/*"
141 preserve_properties: true
142 - source: "/var/lib/kolla/config_files/src-ceph/"
145 preserve_properties: true
146 /var/lib/kolla/config_files/nova_virtlogd.json:
147 command: /usr/sbin/virtlogd --config /etc/libvirt/virtlogd.conf
149 - source: "/var/lib/kolla/config_files/src/*"
152 preserve_properties: true
154 - path: /var/log/nova
161 image: {get_param: DockerNovaLibvirtImage}
168 - {get_attr: [ContainersCommon, volumes]}
170 - /var/lib/kolla/config_files/nova_virtlogd.json:/var/lib/kolla/config_files/config.json:ro
171 - /var/lib/config-data/puppet-generated/nova_libvirt/:/var/lib/kolla/config_files/src:ro
172 - /lib/modules:/lib/modules:ro
175 - /sys/fs/cgroup:/sys/fs/cgroup
176 - /var/lib/nova:/var/lib/nova
177 - /var/run/libvirt:/var/run/libvirt
178 - /var/lib/libvirt:/var/lib/libvirt
179 - /etc/libvirt/qemu:/etc/libvirt/qemu:ro
180 - /var/log/libvirt/qemu:/var/log/libvirt/qemu
182 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
185 image: {get_param: DockerNovaLibvirtImage}
192 - {get_attr: [ContainersCommon, volumes]}
194 - /var/lib/kolla/config_files/nova_libvirt.json:/var/lib/kolla/config_files/config.json:ro
195 - /var/lib/config-data/puppet-generated/nova_libvirt/:/var/lib/kolla/config_files/src:ro
196 - /etc/ceph:/var/lib/kolla/config_files/src-ceph:ro
197 - /lib/modules:/lib/modules:ro
200 - /sys/fs/cgroup:/sys/fs/cgroup
201 - /var/lib/nova:/var/lib/nova
202 - /etc/libvirt:/etc/libvirt
203 - /var/run/libvirt:/var/run/libvirt
204 - /var/lib/libvirt:/var/lib/libvirt
205 - /var/log/libvirt/qemu:/var/log/libvirt/qemu:ro
206 - /var/log/containers/nova:/var/log/nova
207 - /var/lib/vhost_sockets:/var/lib/vhost_sockets
210 - use_tls_for_live_migration
212 - /etc/ipa/ca.crt:/etc/pki/CA/cacert.pem:ro
213 - /etc/pki/libvirt/servercert.pem:/etc/pki/libvirt/servercert.pem:ro
214 - /etc/pki/libvirt/private/serverkey.pem:/etc/pki/libvirt/private/serverkey.pem:ro
215 - /etc/pki/libvirt/clientcert.pem:/etc/pki/libvirt/clientcert.pem:ro
216 - /etc/pki/libvirt/private/clientkey.pem:/etc/pki/libvirt/private/clientkey.pem:ro
219 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
222 - need_libvirt_secret
223 - nova_libvirt_init_secret:
225 image: {get_param: DockerNovaLibvirtImage}
230 - {get_attr: [ContainersCommon, volumes]}
232 - /var/lib/config-data/puppet-generated/nova_libvirt/etc/nova:/etc/nova:ro
233 - /etc/libvirt:/etc/libvirt
234 - /var/run/libvirt:/var/run/libvirt
235 - /var/lib/libvirt:/var/lib/libvirt
240 template: /usr/bin/virsh secret-define --file /etc/nova/secret.xml && /usr/bin/virsh secret-set-value --secret 'SECRET_UUID' --base64 'SECRET_KEY'
242 SECRET_UUID: {get_param: CephClusterFSID}
243 SECRET_KEY: {get_param: CephClientKey}
246 - name: create libvirt persistent data directories
252 - /etc/libvirt/secrets
255 - /var/log/containers/nova
256 # qemu user on host will be cretaed by libvirt package install, ensure
257 # the qemu user created with same uid/gid as like libvirt package.
258 # These specific values are required since ovs is running on host.
259 # Once ovs with DPDK is containerized, we could modify this uid/gid
260 # to match with kolla config values.
261 - name: ensure qemu group is present on the host
266 - name: ensure qemu user is present on the host
274 - name: create directory for vhost-user sockets with qemu ownership
276 path: /var/lib/vhost_sockets
280 - name: ensure ceph configurations exist
284 - name: check if libvirt is installed
285 command: /usr/bin/rpm -q libvirt-daemon
287 register: libvirt_installed
288 - name: make sure libvirt services are disabled
296 when: libvirt_installed.rc == 0
298 get_attr: [NovaLibvirtBase, role_data, metadata_settings]
300 - name: Stop and disable libvirtd service
302 service: name=libvirtd state=stopped enabled=no