Set bind mount propegatation to shared for /var/lib/nova.
[apex-tripleo-heat-templates.git] / docker / services / nova-migration-target.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Nova Migration Target service
5
6 parameters:
7   DockerNovaComputeImage:
8     description: image
9     type: string
10   DockerNovaLibvirtConfigImage:
11     description: The container image to use for the nova_libvirt config_volume
12     type: string
13   ServiceData:
14     default: {}
15     description: Dictionary packing service data
16     type: json
17   ServiceNetMap:
18     default: {}
19     description: Mapping of service_name -> network name. Typically set
20                  via parameter_defaults in the resource registry.  This
21                  mapping overrides those in ServiceNetMapDefaults.
22     type: json
23   DefaultPasswords:
24     default: {}
25     type: json
26   RoleName:
27     default: ''
28     description: Role name on which the service is applied
29     type: string
30   RoleParameters:
31     default: {}
32     description: Parameters specific to the role
33     type: json
34   EndpointMap:
35     default: {}
36     description: Mapping of service endpoint -> protocol. Typically set
37                  via parameter_defaults in the resource registry.
38     type: json
39   DockerNovaMigrationSshdPort:
40     default: 2022
41     description: Port that dockerized nova migration target sshd service
42                  binds to.
43     type: number
44   MigrationSshKey:
45     type: json
46     description: >
47       SSH key for migration.
48       Expects a dictionary with keys 'public_key' and 'private_key'.
49       Values should be identical to SSH public/private key files.
50     default:
51       public_key: ''
52       private_key: ''
53   MigrationSshPort:
54     default: 2022
55     description: Target port for migration over ssh
56     type: number
57
58 conditions:
59
60   # During Ocata->Pike upgrade initially configure the ssh service on port 22
61   # to proxy migration commands to the containerized sshd on port 2022.
62   # When the upgrade converges we can switch migrations over to port 2022.
63   enable_migration_proxy:
64     equals:
65       - {get_param: MigrationSshPort}
66       - 22
67
68 resources:
69
70   ContainersCommon:
71     type: ./containers-common.yaml
72
73   SshdBase:
74     type: ../../puppet/services/sshd.yaml
75     properties:
76       EndpointMap: {get_param: EndpointMap}
77       ServiceNetMap: {get_param: ServiceNetMap}
78       DefaultPasswords: {get_param: DefaultPasswords}
79       RoleName: {get_param: RoleName}
80       RoleParameters: {get_param: RoleParameters}
81
82   NovaMigrationTargetBase:
83     type: ../../puppet/services/nova-migration-target.yaml
84     properties:
85       EndpointMap: {get_param: EndpointMap}
86       ServiceNetMap: {get_param: ServiceNetMap}
87       DefaultPasswords: {get_param: DefaultPasswords}
88       RoleName: {get_param: RoleName}
89       RoleParameters: {get_param: RoleParameters}
90
91 outputs:
92   role_data:
93     description: Role data for the Nova Migration Target service.
94     value:
95       service_name: nova_migration_target
96       config_settings:
97         map_merge:
98           - get_attr: [SshdBase, role_data, config_settings]
99           - get_attr: [NovaMigrationTargetBase, role_data, config_settings]
100           # NB this prevents the baremetal ssh from listening on port 2022
101           # It doesn't affect the sshd port in the container as we override it below on the sshd cli
102           - tripleo::profile::base::sshd::port: 22
103           - if:
104             - enable_migration_proxy
105             - tripleo::profile::base::nova::migration::proxy::ssh_private_key: {get_param: [ MigrationSshKey, private_key ]}
106               tripleo::profile::base::nova::migration::proxy::target_port: {get_param: DockerNovaMigrationSshdPort}
107               tripleo::profile::base::nova::migration::proxy::target_host: "%{hiera('live_migration_ssh_inbound_addr')}"
108             - {}
109       logging_source: {get_attr: [NovaMigrationTargetBase, role_data, logging_source]}
110       logging_groups: {get_attr: [NovaMigrationTargetBase, role_data, logging_groups]}
111       step_config: &step_config
112         list_join:
113           - "\n"
114           - - get_attr: [SshdBase, role_data, step_config]
115             - get_attr: [NovaMigrationTargetBase, role_data, step_config]
116       puppet_config:
117         config_volume: nova_libvirt
118         step_config: *step_config
119         config_image: {get_param: DockerNovaLibvirtConfigImage}
120       kolla_config:
121         /var/lib/kolla/config_files/nova-migration-target.json:
122           command:
123             str_replace:
124               template: "/usr/sbin/sshd -D -p SSHDPORT"
125               params:
126                 SSHDPORT: {get_param: DockerNovaMigrationSshdPort}
127           config_files:
128             - source: "/var/lib/kolla/config_files/src/*"
129               dest: "/"
130               merge: true
131               preserve_properties: true
132             - source: /host-ssh/ssh_host_*_key
133               dest: /etc/ssh/
134               owner: "root"
135               perm: "0600"
136       docker_config:
137         step_4:
138           nova_migration_target:
139             image: {get_param: DockerNovaComputeImage}
140             net: host
141             privileged: true
142             user: root
143             restart: always
144             volumes:
145               list_concat:
146                 - {get_attr: [ContainersCommon, volumes]}
147                 -
148                   - /var/lib/kolla/config_files/nova-migration-target.json:/var/lib/kolla/config_files/config.json:ro
149                   - /var/lib/config-data/puppet-generated/nova_libvirt/:/var/lib/kolla/config_files/src:ro
150                   - /etc/ssh/:/host-ssh/:ro
151                   - /run:/run
152                   - /var/lib/nova:/var/lib/nova:shared
153             environment:
154              - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS