Configure the Multipathd service

This is part 2 of a series of patches to properly deploy multipathd.

This patch configures /etc/multipath.conf, which is required by the
multipath daemon. The config file contents are managed using the
'mpathconf' tool instead of a puppet module, but a tiny puppet wrapper
is employed to take advantage of the tripleo tooling (e.g. restarting
the multipathd container whenever the config file changes).

Other changes include:
- Ensuring the multipath daemon isn't running on the host
- Preparing the /etc/multipath directory that must be shared by all
  containers that use the service
- Adding a volume mount to services that need access to /etc/multipath

Closes-Bug: #1834042
Change-Id: Ib3ce0a753f7220c3ee2556425e9798b0c4a906f3
This commit is contained in:
Alan Bishop 2019-06-24 12:03:55 -07:00
parent b172661995
commit 906d03ea19
7 changed files with 124 additions and 2 deletions

View File

@ -48,6 +48,14 @@ parameters:
default: 10280
description: The size of the loopback file used by the cinder LVM driver.
type: number
MultipathdEnable:
default: false
description: Whether to enable the multipath daemon
type: boolean
conditions:
multipathd_enabled: {equals: [{get_param: MultipathdEnable}, true]}
resources:
@ -160,6 +168,11 @@ outputs:
- /var/lib/cinder:/var/lib/cinder:z
- /var/lib/iscsi:/var/lib/iscsi:z
- /var/log/containers/cinder:/var/log/cinder:z
-
if:
- multipathd_enabled
- - /etc/multipath:/etc/multipath:z
- []
cinder_volume_environment:
description: Docker environment for the cinder-volume container (HA or non-HA)
@ -190,6 +203,11 @@ outputs:
- /var/lib/cinder:/var/lib/cinder:z
- /var/lib/iscsi:/var/lib/iscsi:z
- /var/log/containers/cinder:/var/log/cinder:z
-
if:
- multipathd_enabled
- - /etc/multipath:/etc/multipath:z
- []
cinder_backup_environment:
description: Docker environment for the cinder-backup container (HA or non-HA)

View File

@ -205,6 +205,10 @@ parameters:
description: >
The Ceph cluster name must be at least 1 character and contain only
letters and numbers.
MultipathdEnable:
default: false
description: Whether to enable the multipath daemon
type: boolean
GlanceApiOptVolumes:
default: []
description: list of optional volumes to be mounted
@ -220,6 +224,12 @@ conditions:
internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
cinder_backend_enabled: {equals: [{get_param: GlanceBackend}, cinder]}
cinder_multipathd_enabled:
and:
- cinder_backend_enabled
- equals:
- get_param: MultipathdEnable
- true
rbd_backend_enabled: {equals: [{get_param: GlanceBackend}, rbd]}
use_tls_proxy: {equals : [{get_param: EnableInternalTLS}, true]}
glance_workers_unset: {equals : [{get_param: GlanceWorkers}, '']}
@ -501,6 +511,11 @@ outputs:
- /etc/iscsi:/etc/iscsi
- /var/lib/iscsi:/var/lib/iscsi:z
- []
-
if:
- cinder_multipathd_enabled
- - /etc/multipath:/etc/multipath:z
- []
environment:
- KOLLA_BOOTSTRAP=True
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS

View File

@ -10,6 +10,18 @@ parameters:
ContainerMultipathdConfigImage:
description: The container image to use for the multipathd config_volume
type: string
MultipathdEnable:
default: false
description: Whether to enable the multipath daemon
type: boolean
MultipathdEnableUserFriendlyNames:
default: false
description: Whether to enable assigning a user friendly name to each path
type: boolean
MultipathdEnableFindMultipaths:
default: true
description: Whether to automatically create a multipath device for each path
type: boolean
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
@ -37,6 +49,12 @@ parameters:
default: {}
type: json
conditions:
multipathd_enabled: {equals: [{get_param: MultipathdEnable}, true]}
user_friendly_names_enabled: {equals: [{get_param: MultipathdEnableUserFriendlyNames}, true]}
find_multipaths_enabled: {equals: [{get_param: MultipathdEnableFindMultipaths}, true]}
resources:
ContainersCommon:
@ -52,12 +70,38 @@ outputs:
# BEGIN DOCKER SETTINGS
puppet_config:
config_volume: multipathd
step_config: ''
puppet_tags: exec
step_config:
str_replace:
template: |
exec { "update multipath.conf":
command => "/usr/sbin/mpathconf CMD --with_multipathd n --user_friendly_names UFN --find_multipaths FM"
}
params:
CMD:
if:
- multipathd_enabled
- '--enable'
- '--disable'
UFN:
if:
- user_friendly_names_enabled
- 'y'
- 'n'
FM:
if:
- find_multipaths_enabled
- 'y'
- 'n'
config_image: {get_param: ContainerMultipathdConfigImage}
kolla_config:
/var/lib/kolla/config_files/multipathd.json:
command: /usr/sbin/multipathd -d
config_files:
- source: "/var/lib/kolla/config_files/src/*"
dest: "/"
merge: true
preserve_properties: true
- source: "/var/lib/kolla/config_files/src-iscsid/*"
dest: "/etc/iscsi/"
merge: true
@ -77,22 +121,38 @@ outputs:
- {get_attr: [ContainersCommon, volumes]}
-
- /var/lib/kolla/config_files/multipathd.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/multipathd/:/var/lib/kolla/config_files/src:ro
- /etc/iscsi:/var/lib/kolla/config_files/src-iscsid:ro
- /dev/:/dev/
- /run/:/run/
- /sys:/sys
- /lib/modules:/lib/modules:ro
- /var/lib/cinder:/var/lib/cinder:z
- /var/lib/iscsi:/var/lib/iscsi:z
- /etc/multipath:/etc/multipath:z
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:
- name: Check if multipathd is deployed on the host
command: systemctl is-enabled --quiet multipathd
ignore_errors: True
register: multipathd_enabled_result
- name: Set fact multipathd_enabled
set_fact:
multipathd_enabled: "{{ multipathd_enabled_result.rc == 0 }}"
- name: Stop multipathd on the host
service: name=multipathd state=stopped enabled=no
when: multipathd_enabled|bool
- name: load dm-multipath
import_role:
name: tripleo-module-load
vars:
modules:
- name: dm-multipath
- name: prepare /etc/multipath
file:
path: /etc/multipath
state: directory
setype: svirt_sandbox_file_t
upgrade_tasks: []
post_upgrade_tasks:
- when: step|int == 1

View File

@ -311,6 +311,10 @@ parameters:
description: Whether to wait for `network-vif-plugged` events before starting guest transfer.
default: true
type: boolean
MultipathdEnable:
default: false
description: Whether to enable the multipath daemon
type: boolean
resources:
@ -653,6 +657,11 @@ outputs:
- /var/lib/libvirt:/var/lib/libvirt:shared,z
- /sys/class/net:/sys/class/net
- /sys/bus/pci:/sys/bus/pci
-
if:
- {equals: [{get_param: MultipathdEnable}, true]}
- - /etc/multipath:/etc/multipath:z
- []
environment:
list_concat:
- {get_param: NovaComputeOptEnvVars}

View File

@ -40,6 +40,10 @@ parameters:
description: The password for the Ironic service and db account, used by the Ironic services
type: string
hidden: true
MultipathdEnable:
default: false
description: Whether to enable the multipath daemon
type: boolean
resources:
@ -147,6 +151,11 @@ outputs:
- /var/lib/iscsi:/var/lib/iscsi:z
- /var/lib/nova/:/var/lib/nova:shared,z
- /var/log/containers/nova:/var/log/nova:z
-
if:
- {equals: [{get_param: MultipathdEnable}, true]}
- - /etc/multipath:/etc/multipath:z
- []
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
nova_wait_for_compute_service:

View File

@ -0,0 +1,5 @@
resource_registry:
OS::TripleO::Services::Multipathd: ../deployment/multipathd/multipathd-container.yaml
parameter_defaults:
MultipathdEnable: true

View File

@ -0,0 +1,6 @@
---
features:
- |
Add support for the Multipathd service on nodes that access Block Storage
(cinder) volumes. Multipathd is an optional service that can be enabled
by including environments/multipathd.yaml in the deployment.