Add puppet class for rook
Create a new drbd device for rook. For duplex system, device mount to folder /var/lib/ceph/mon-a for mon data sync on two controllers. Story: 2005527 Task: 40281 Change-Id: Ic5edca16e2dce905aeb582b0359446bd222e5ad3 Signed-off-by: Martin, Chen <haochuan.z.chen@intel.com>
This commit is contained in:
parent
9d8af1864b
commit
ce66ffd30c
|
@ -102,6 +102,7 @@ include ::openstack::barbican::api
|
|||
include ::platform::sm
|
||||
|
||||
include ::platform::lmon
|
||||
include ::platform::rook
|
||||
|
||||
class { '::platform::config::controller::post':
|
||||
stage => post,
|
||||
|
|
|
@ -30,6 +30,7 @@ include ::platform::filesystem::storage
|
|||
include ::platform::docker::storage
|
||||
include ::platform::containerd::storage
|
||||
include ::platform::ceph::storage
|
||||
include ::platform::rook
|
||||
|
||||
class { '::platform::config::storage::post':
|
||||
stage => post,
|
||||
|
|
|
@ -42,6 +42,7 @@ include ::platform::ceph::worker
|
|||
include ::platform::worker::storage
|
||||
include ::platform::pciirqaffinity
|
||||
include ::platform::lmon
|
||||
include ::platform::rook
|
||||
|
||||
class { '::platform::config::worker::post':
|
||||
stage => post,
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# Returns true if Rook Ceph has been configured on current node
|
||||
|
||||
Facter.add("is_node_rook_ceph_configured") do
|
||||
setcode do
|
||||
File.exist?('/etc/platform/.node_rook_ceph_configured')
|
||||
end
|
||||
end
|
|
@ -415,7 +415,7 @@ class platform::ceph::osds(
|
|||
# skip_osds_during_restore is set to true when the default primary
|
||||
# ceph backend "ceph-store" has "restore" as its task and it is
|
||||
# not an AIO system.
|
||||
if ! $skip_osds_during_restore {
|
||||
if ! $skip_osds_during_restore and $service_enabled {
|
||||
file { '/var/lib/ceph/osd':
|
||||
ensure => 'directory',
|
||||
path => '/var/lib/ceph/osd',
|
||||
|
|
|
@ -435,6 +435,60 @@ class platform::drbd::cephmon ()
|
|||
}
|
||||
}
|
||||
|
||||
class platform::drbd::rookmon::params (
|
||||
$device = '/dev/drbd9',
|
||||
$lv_name = 'ceph-mon-lv',
|
||||
$mountpoint = '/var/lib/ceph/mon-a',
|
||||
$port = '7788',
|
||||
$resource_name = 'drbd-cephmon',
|
||||
$vg_name = 'cgts-vg',
|
||||
) {}
|
||||
|
||||
class platform::drbd::rookmon ()
|
||||
inherits ::platform::drbd::rookmon::params {
|
||||
|
||||
include ::platform::rook::params
|
||||
|
||||
$system_mode = $::platform::params::system_mode
|
||||
$system_type = $::platform::params::system_type
|
||||
|
||||
if ((str2bool($::is_controller_active) or str2bool($::is_standalone_controller))
|
||||
and ! str2bool($::is_node_rook_ceph_configured)) {
|
||||
# Active controller, first time configuration.
|
||||
$drbd_primary = true
|
||||
$drbd_initial = true
|
||||
$drbd_automount = true
|
||||
|
||||
} elsif str2bool($::is_standalone_controller) {
|
||||
# Active standalone controller, successive reboots.
|
||||
$drbd_primary = true
|
||||
$drbd_initial = undef
|
||||
$drbd_automount = true
|
||||
} else {
|
||||
# Node unlock, reboot or standby configuration
|
||||
# Do not mount ceph
|
||||
$drbd_primary = undef
|
||||
$drbd_initial = undef
|
||||
$drbd_automount = undef
|
||||
}
|
||||
|
||||
if ($platform::rook::params::service_enabled and
|
||||
$system_type == 'All-in-one' and 'duplex' in $system_mode) {
|
||||
platform::drbd::filesystem { $resource_name:
|
||||
vg_name => $vg_name,
|
||||
lv_name => $lv_name,
|
||||
lv_size => $platform::rook::params::mon_lv_size,
|
||||
port => $port,
|
||||
device => $device,
|
||||
mountpoint => $mountpoint,
|
||||
resync_after => undef,
|
||||
manage_override => true,
|
||||
ha_primary_override => $drbd_primary,
|
||||
initial_setup_override => $drbd_initial,
|
||||
automount_override => $drbd_automount,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class platform::drbd(
|
||||
$service_enable = false,
|
||||
|
@ -464,6 +518,7 @@ class platform::drbd(
|
|||
include ::platform::drbd::etcd
|
||||
include ::platform::drbd::dockerdistribution
|
||||
include ::platform::drbd::cephmon
|
||||
include ::platform::drbd::rookmon
|
||||
include ::platform::drbd::trigger_resize_check
|
||||
|
||||
# network changes need to be applied prior to DRBD resources
|
||||
|
@ -569,5 +624,10 @@ class platform::drbd::cephmon::runtime {
|
|||
include ::platform::drbd::params
|
||||
include ::platform::drbd::runtime_service_enable
|
||||
include ::platform::drbd::cephmon
|
||||
include ::platform::drbd::trigger_resize_check
|
||||
}
|
||||
|
||||
class platform::drbd::rookmon::runtime {
|
||||
include ::platform::drbd::params
|
||||
include ::platform::drbd::runtime_service_enable
|
||||
include ::platform::drbd::rookmon
|
||||
}
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
class platform::rook::params(
|
||||
$service_enabled = false,
|
||||
$mon_lv_size = 20,
|
||||
$node_rook_ceph_configured_flag = '/etc/platform/.node_rook_ceph_configured',
|
||||
) { }
|
||||
|
||||
|
||||
define platform::rook::mapping {
|
||||
exec { 'enable volume group device mapper mapping':
|
||||
command => "vgchange -ay ${name} || true",
|
||||
onlyif => "test ! -d /dev/${name}",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
define platform_rook_directory(
|
||||
$disk_node,
|
||||
$data_path,
|
||||
$directory,
|
||||
) {
|
||||
exec { "mount ${disk_node}":
|
||||
unless => "mount | grep -q ${disk_node}",
|
||||
command => "mount ${data_path} ${directory} || true",
|
||||
}
|
||||
}
|
||||
|
||||
class platform::rook::directories(
|
||||
$dir_config = {},
|
||||
) inherits ::platform::rook::params {
|
||||
|
||||
create_resources('platform_rook_directory', $dir_config)
|
||||
}
|
||||
|
||||
class platform::rook::vg::rook_vg(
|
||||
$vg_name = [],
|
||||
) inherits platform::rook::params {
|
||||
::platform::rook::mapping { $vg_name:
|
||||
}
|
||||
}
|
||||
|
||||
class platform::rook::storage {
|
||||
include ::platform::rook::directories
|
||||
include ::platform::rook::vg::rook_vg
|
||||
}
|
||||
|
||||
class platform::rook::post
|
||||
inherits ::platform::rook::params {
|
||||
|
||||
if $service_enabled {
|
||||
# Ceph configuration on this node is done
|
||||
file { $node_rook_ceph_configured_flag:
|
||||
ensure => present
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class platform::rook_base
|
||||
inherits ::platform::ceph::params {
|
||||
|
||||
$system_mode = $::platform::params::system_mode
|
||||
$system_type = $::platform::params::system_type
|
||||
|
||||
if $service_enabled {
|
||||
file { '/var/lib/ceph/mon-a':
|
||||
ensure => 'directory',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
}
|
||||
|
||||
if $system_type == 'All-in-one' and 'duplex' in $system_mode {
|
||||
# ensure DRBD config init only once
|
||||
Drbd::Resource <| |> -> Class[$name]
|
||||
}
|
||||
|
||||
class { '::platform::rook::post':
|
||||
stage => post
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class platform::rook {
|
||||
include ::platform::rook::storage
|
||||
include ::platform::rook_base
|
||||
}
|
||||
|
||||
class platform::rook::runtime {
|
||||
|
||||
include ::platform::rook_base
|
||||
}
|
|
@ -93,6 +93,11 @@ class platform::sm
|
|||
$cephmon_fs_device = $::platform::drbd::cephmon::params::device
|
||||
$cephmon_fs_directory = $::platform::drbd::cephmon::params::mountpoint
|
||||
|
||||
include ::platform::rook::params
|
||||
$rookmon_drbd_resource = $::platform::drbd::rookmon::params::resource_name
|
||||
$rookmon_fs_device = $::platform::drbd::rookmon::params::device
|
||||
$rookmon_fs_directory = $::platform::drbd::rookmon::params::mountpoint
|
||||
|
||||
include ::openstack::keystone::params
|
||||
$keystone_api_version = $::openstack::keystone::params::api_version
|
||||
$keystone_identity_uri = $::openstack::keystone::params::identity_uri
|
||||
|
@ -164,6 +169,7 @@ class platform::sm
|
|||
# Ceph-Rados-Gateway
|
||||
include ::platform::ceph::params
|
||||
$ceph_configured = $::platform::ceph::params::service_enabled
|
||||
$rook_configured = $::platform::rook::params::service_enabled
|
||||
$rgw_configured = $::platform::ceph::params::rgw_enabled
|
||||
|
||||
if $system_mode == 'simplex' {
|
||||
|
@ -725,6 +731,17 @@ class platform::sm
|
|||
-> exec { 'Configure ceph-osd':
|
||||
command => "sm-configure service_instance ceph-osd ceph-osd \"\"",
|
||||
}
|
||||
|
||||
Exec['Provision service-group storage-monitoring-services']
|
||||
-> exec { 'Configure Rookmon DRBD':
|
||||
command => "sm-configure service_instance drbd-rookmon drbd-rookmon:${hostunit} \"drbd_resource=${rookmon_drbd_resource}\"",
|
||||
}
|
||||
-> exec { 'Configure Rookmon FileSystem':
|
||||
command => "sm-configure service_instance rookmon-fs rookmon-fs \"device=${rookmon_fs_device},directory=${rookmon_fs_directory},options=noatime,nodiratime,fstype=ext4,check_level=20\"",
|
||||
}
|
||||
-> exec { 'Configure Rook mon exit':
|
||||
command => "sm-configure service_instance rook-mon-exit rook-mon-exit \"\"",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -782,6 +799,20 @@ class platform::sm
|
|||
}
|
||||
}
|
||||
|
||||
if $rook_configured {
|
||||
if $system_type == 'All-in-one' and 'duplex' in $system_mode {
|
||||
exec { 'Provision Rookmon FS in SM (service-group-member rookmon-fs)':
|
||||
command => 'sm-provision service-group-member controller-services rookmon-fs',
|
||||
}
|
||||
-> exec { 'Provision Rookmon DRBD in SM (service-group-member drbd-rookmon)':
|
||||
command => 'sm-provision service-group-member controller-services drbd-rookmon',
|
||||
}
|
||||
-> exec { 'Provision Rook-mon-exit in SM (service-group-member rook-mon-exit)':
|
||||
command => 'sm-provision service-group-member controller-services rook-mon-exit',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Ceph-Rados-Gateway
|
||||
if $rgw_configured {
|
||||
exec {'Provision Ceph-Rados-Gateway (service-group-member ceph-radosgw)':
|
||||
|
@ -1027,6 +1058,7 @@ class platform::sm::rgw::runtime {
|
|||
|
||||
class platform::sm::ceph::runtime {
|
||||
$ceph_configured = $::platform::ceph::params::service_enabled
|
||||
$rook_configured = $::platform::rook::params::service_enabled
|
||||
$system_mode = $::platform::params::system_mode
|
||||
$system_type = $::platform::params::system_type
|
||||
|
||||
|
@ -1055,4 +1087,18 @@ class platform::sm::ceph::runtime {
|
|||
command => 'sm-provision service-group-member storage-monitoring-services ceph-manager --apply',
|
||||
}
|
||||
}
|
||||
|
||||
if $rook_configured {
|
||||
if $system_type == 'All-in-one' and 'duplex' in $system_mode {
|
||||
exec { 'Provision Cephmon FS in SM (service-group-member cephmon-fs)':
|
||||
command => 'sm-provision service-group-member controller-services rookmon-fs --apply',
|
||||
}
|
||||
-> exec { 'Provision Cephmon DRBD in SM (service-group-member drbd-cephmon':
|
||||
command => 'sm-provision service-group-member controller-services drbd-rookmon --apply',
|
||||
}
|
||||
-> exec { 'Provision Rook-mon-exit in SM (service-group-member rook-mon-exit)':
|
||||
command => 'sm-provision service-group-member controller-services rook-mon-exit --apply',
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue