5457742c76
The cloud platform is configured explicitly to not use LVM metadata service for caching disk metadata. Currently LVM puppet is used to (in this order): 1. set 'use_lvmetad = 0' in /etc/lvm/lvm.conf 2. stop and disable lvm2-lvmetad.service LVM metadata is also listening on a socket created by lvm2-lvmetad.socket service unit. The socket file is under: /var/run/lvm/lvmetad.socket If lvm2-lvmetad.service (LVM metadata daemon) is stopped and 'use_lvmetad = 1', it can still be started via LVM metadata socket when needed, such as when running 'lvs' command. This is called service activation by socket in systemd. There is a potential race condition in the current LVM puppet manifest, where an LVM command (such as 'lvs') can arrive between the moment lvm2-lvmetad.service is stopped and 'use_lvmetad' is set to 0, causing the service to restart. From this moment, with LVM metadata service running and 'use_lvmetad = 0', each LVM command will raise the following warning: "WARNING: Not using lvmetad because config setting use_lvmetad=0" "WARNING: To avoid corruption, rescan devices to make changes visible (pvscan --cache)" LVM command result parsing will be affected and puppet manifest will fail. The solution is to update the LVM puppet manifest to ensure (in this order): lvm2-lvmetad.socket is masked and stopped lvm2-lvmetad.service is masked and stopped 'use_lvmetad = 0' Story: 2002983 Task: 22992 Change-Id: I16deb7f01fbedf8cb102af932f52834f69eda681 Signed-off-by: Stefan Dinescu <stefan.dinescu@windriver.com>
171 lines
3.8 KiB
Puppet
171 lines
3.8 KiB
Puppet
class platform::lvm::params (
|
|
$transition_filter = '[]',
|
|
$final_filter = '[]',
|
|
) {}
|
|
|
|
|
|
class platform::lvm
|
|
inherits platform::lvm::params {
|
|
|
|
# Mask socket unit as well to make sure
|
|
# systemd socket activation does not happen
|
|
service { 'lvm2-lvmetad.socket':
|
|
enable => mask,
|
|
ensure => 'stopped',
|
|
} ->
|
|
# Masking service unit ensures that it is not started again
|
|
service { 'lvm2-lvmetad':
|
|
enable => mask,
|
|
ensure => 'stopped',
|
|
} ->
|
|
# Since masking is changing unit symlinks to point to /dev/null,
|
|
# we need to reload systemd configuration
|
|
exec { 'lvmetad-systemd-daemon-reload':
|
|
command => "systemctl daemon-reload",
|
|
} ->
|
|
file_line { 'use_lvmetad':
|
|
path => '/etc/lvm/lvm.conf',
|
|
match => '^[^#]*use_lvmetad = 1',
|
|
line => ' use_lvmetad = 0',
|
|
}
|
|
}
|
|
|
|
|
|
define platform::lvm::global_filter($filter) {
|
|
file_line { "$name: update lvm global_filter":
|
|
path => '/etc/lvm/lvm.conf',
|
|
line => " global_filter = $filter",
|
|
match => '^[ ]*global_filter =',
|
|
}
|
|
}
|
|
|
|
|
|
define platform::lvm::umount {
|
|
exec { "umount disk $name":
|
|
command => "umount $name; true",
|
|
}
|
|
}
|
|
|
|
|
|
class platform::lvm::vg::cgts_vg(
|
|
$vg_name = 'cgts-vg',
|
|
$physical_volumes = [],
|
|
) inherits platform::lvm::params {
|
|
|
|
::platform::lvm::umount { $physical_volumes:
|
|
} ->
|
|
physical_volume { $physical_volumes:
|
|
ensure => present,
|
|
} ->
|
|
volume_group { $vg_name:
|
|
ensure => present,
|
|
physical_volumes => $physical_volumes,
|
|
}
|
|
}
|
|
|
|
class platform::lvm::vg::cinder_volumes(
|
|
$vg_name = 'cinder-volumes',
|
|
$physical_volumes = [],
|
|
) inherits platform::lvm::params {
|
|
# Let cinder manifests set up DRBD synced volume group
|
|
}
|
|
|
|
class platform::lvm::vg::nova_local(
|
|
$vg_name = 'nova-local',
|
|
$physical_volumes = [],
|
|
) inherits platform::lvm::params {
|
|
# TODO(rchurch): refactor portions of openstack::nova::storage an move here
|
|
}
|
|
|
|
##################
|
|
# Controller Hosts
|
|
##################
|
|
|
|
class platform::lvm::controller::vgs {
|
|
include ::platform::lvm::vg::cgts_vg
|
|
include ::platform::lvm::vg::cinder_volumes
|
|
include ::platform::lvm::vg::nova_local
|
|
}
|
|
|
|
class platform::lvm::controller
|
|
inherits ::platform::lvm::params {
|
|
|
|
::platform::lvm::global_filter { "transition filter":
|
|
filter => $transition_filter,
|
|
before => Class['::platform::lvm::controller::vgs']
|
|
}
|
|
|
|
::platform::lvm::global_filter { "final filter":
|
|
filter => $final_filter,
|
|
require => Class['::platform::lvm::controller::vgs']
|
|
}
|
|
|
|
include ::platform::lvm
|
|
include ::platform::lvm::controller::vgs
|
|
}
|
|
|
|
|
|
class platform::lvm::controller::runtime {
|
|
include ::platform::lvm::controller
|
|
}
|
|
|
|
###############
|
|
# Compute Hosts
|
|
###############
|
|
|
|
class platform::lvm::compute::vgs {
|
|
include ::platform::lvm::vg::nova_local
|
|
include ::platform::kubernetes::params
|
|
|
|
if $::platform::kubernetes::params::enabled {
|
|
include ::platform::lvm::vg::cgts_vg
|
|
}
|
|
}
|
|
|
|
class platform::lvm::compute
|
|
inherits ::platform::lvm::params {
|
|
|
|
::platform::lvm::global_filter { "transition filter":
|
|
filter => $transition_filter,
|
|
before => Class['::platform::lvm::compute::vgs']
|
|
}
|
|
|
|
::platform::lvm::global_filter { "final filter":
|
|
filter => $final_filter,
|
|
require => Class['::platform::lvm::compute::vgs']
|
|
}
|
|
|
|
include ::platform::lvm
|
|
include ::platform::lvm::compute::vgs
|
|
}
|
|
|
|
|
|
class platform::lvm::compute::runtime {
|
|
include ::platform::lvm::compute
|
|
}
|
|
|
|
###############
|
|
# Storage Hosts
|
|
###############
|
|
|
|
class platform::lvm::storage::vgs {
|
|
include ::platform::lvm::vg::cgts_vg
|
|
}
|
|
|
|
class platform::lvm::storage
|
|
inherits ::platform::lvm::params {
|
|
|
|
::platform::lvm::global_filter { "final filter":
|
|
filter => $final_filter,
|
|
before => Class['::platform::lvm::storage::vgs']
|
|
}
|
|
|
|
include ::platform::lvm
|
|
include ::platform::lvm::storage::vgs
|
|
}
|
|
|
|
|
|
class platform::lvm::storage::runtime {
|
|
include ::platform::lvm::storage
|
|
}
|