Make MySQL ignore lost+found directory in its datadir
This commit introduces optional ignore_db_dirs parameter that can be passed to mysql::server. It is expected to be an array and is empty by default. Change-Id: Ic8815b89fea41182692f9f8fafd07bbe6ca15af6 Closes-Bug: 1484552
This commit is contained in:
parent
2a92075c2a
commit
fb100ee828
@ -11,10 +11,11 @@
|
|||||||
# [*config_file*] - my.cnf configuration file path.
|
# [*config_file*] - my.cnf configuration file path.
|
||||||
# [*socket*] - mysql socket.
|
# [*socket*] - mysql socket.
|
||||||
# [*datadir*] - path to datadir.
|
# [*datadir*] - path to datadir.
|
||||||
# [*ssl] - enable ssl
|
# [*ssl*] - enable ssl
|
||||||
# [*ssl_ca] - path to ssl-ca
|
# [*ssl_ca*] - path to ssl-ca
|
||||||
# [*ssl_cert] - path to ssl-cert
|
# [*ssl_cert*] - path to ssl-cert
|
||||||
# [*ssl_key] - path to ssl-key
|
# [*ssl_key*] - path to ssl-key
|
||||||
|
# [*ignore_db_dirs*] - array of directories to ignore in datadir.
|
||||||
#
|
#
|
||||||
# Actions:
|
# Actions:
|
||||||
#
|
#
|
||||||
@ -49,6 +50,7 @@ class mysql::config(
|
|||||||
$server_id = $mysql::params::server_id,
|
$server_id = $mysql::params::server_id,
|
||||||
$debug = $mysql::params::debug,
|
$debug = $mysql::params::debug,
|
||||||
$wait_timeout = $mysql::params::wait_timeout,
|
$wait_timeout = $mysql::params::wait_timeout,
|
||||||
|
$ignore_db_dirs = $mysql::params::ignore_db_dirs,
|
||||||
) inherits mysql::params {
|
) inherits mysql::params {
|
||||||
|
|
||||||
$mysql_buffer_pool_size = $::mysql::params::mysql_buffer_pool_size
|
$mysql_buffer_pool_size = $::mysql::params::mysql_buffer_pool_size
|
||||||
@ -59,6 +61,10 @@ class mysql::config(
|
|||||||
$myisam_sort_buffer_size = $::mysql::params::myisam_sort_buffer_size
|
$myisam_sort_buffer_size = $::mysql::params::myisam_sort_buffer_size
|
||||||
$open_files_limit = $::mysql::params::open_files_limit
|
$open_files_limit = $::mysql::params::open_files_limit
|
||||||
|
|
||||||
|
if ! is_array($ignore_db_dirs) {
|
||||||
|
fail('The ignore_db_dirs parameter is expected to be an array')
|
||||||
|
}
|
||||||
|
|
||||||
if $custom_setup_class != "pacemaker_mysql" {
|
if $custom_setup_class != "pacemaker_mysql" {
|
||||||
File {
|
File {
|
||||||
owner => 'root',
|
owner => 'root',
|
||||||
|
@ -32,6 +32,7 @@ class mysql::params {
|
|||||||
$open_files_limit = '102400'
|
$open_files_limit = '102400'
|
||||||
$max_connections = '3000'
|
$max_connections = '3000'
|
||||||
$debug = false
|
$debug = false
|
||||||
|
$ignore_db_dirs = []
|
||||||
|
|
||||||
case $::osfamily {
|
case $::osfamily {
|
||||||
'RedHat': {
|
'RedHat': {
|
||||||
|
@ -41,6 +41,7 @@ class mysql::server (
|
|||||||
$bind_address = '0.0.0.0',
|
$bind_address = '0.0.0.0',
|
||||||
$use_syslog = true,
|
$use_syslog = true,
|
||||||
$wait_timeout = $mysql::params::wait_timeout,
|
$wait_timeout = $mysql::params::wait_timeout,
|
||||||
|
$ignore_db_dirs = $mysql::params::ignore_db_dirs,
|
||||||
) inherits mysql::params {
|
) inherits mysql::params {
|
||||||
|
|
||||||
if ($config_hash['config_file']) {
|
if ($config_hash['config_file']) {
|
||||||
|
@ -22,6 +22,11 @@ port = <%= @port %>
|
|||||||
basedir = <%= @basedir %>
|
basedir = <%= @basedir %>
|
||||||
datadir = <%= @datadir %>
|
datadir = <%= @datadir %>
|
||||||
tmpdir = /tmp
|
tmpdir = /tmp
|
||||||
|
<% if @ignore_db_dirs and (@ignore_db_dirs.length > 0) %>
|
||||||
|
<% @ignore_db_dirs.each do |directory| %>
|
||||||
|
ignore-db-dir = <%= directory %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
skip-external-locking
|
skip-external-locking
|
||||||
bind-address = <%= @bind_address %>
|
bind-address = <%= @bind_address %>
|
||||||
max_allowed_packet = 256M
|
max_allowed_packet = 256M
|
||||||
|
@ -53,6 +53,12 @@ if $enabled {
|
|||||||
$config_hash_real = { }
|
$config_hash_real = { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if '/var/lib/mysql' in split($::mounts, ',') {
|
||||||
|
$ignore_db_dirs = ['lost+found']
|
||||||
|
} else {
|
||||||
|
$ignore_db_dirs = []
|
||||||
|
}
|
||||||
|
|
||||||
class { 'mysql::server':
|
class { 'mysql::server':
|
||||||
bind_address => '0.0.0.0',
|
bind_address => '0.0.0.0',
|
||||||
etc_root_password => true,
|
etc_root_password => true,
|
||||||
@ -68,6 +74,7 @@ if $enabled {
|
|||||||
mysql_skip_name_resolve => $mysql_skip_name_resolve,
|
mysql_skip_name_resolve => $mysql_skip_name_resolve,
|
||||||
use_syslog => $use_syslog,
|
use_syslog => $use_syslog,
|
||||||
config_hash => $config_hash_real,
|
config_hash => $config_hash_real,
|
||||||
|
ignore_db_dirs => $ignore_db_dirs,
|
||||||
}
|
}
|
||||||
|
|
||||||
class { 'osnailyfacter::mysql_user':
|
class { 'osnailyfacter::mysql_user':
|
||||||
|
@ -4,6 +4,12 @@ manifest = 'database/database.pp'
|
|||||||
|
|
||||||
describe manifest do
|
describe manifest do
|
||||||
shared_examples 'catalog' do
|
shared_examples 'catalog' do
|
||||||
|
let(:facts) {
|
||||||
|
Noop.ubuntu_facts.merge({
|
||||||
|
:mounts => '/,/boot,/var/log,/var/lib/glance,/var/lib/mysql'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
let(:endpoints) do
|
let(:endpoints) do
|
||||||
Noop.hiera('network_scheme', {}).fetch('endpoints', {})
|
Noop.hiera('network_scheme', {}).fetch('endpoints', {})
|
||||||
end
|
end
|
||||||
@ -24,7 +30,7 @@ describe manifest do
|
|||||||
(Noop.puppet_function 'get_node_to_ipaddr_map_by_network_role', database_nodes, 'mgmt/database').values
|
(Noop.puppet_function 'get_node_to_ipaddr_map_by_network_role', database_nodes, 'mgmt/database').values
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should delcare osnailyfacter::mysql_user with correct other_networks" do
|
it "should declare osnailyfacter::mysql_user with correct other_networks" do
|
||||||
expect(subject).to contain_class('osnailyfacter::mysql_user').with(
|
expect(subject).to contain_class('osnailyfacter::mysql_user').with(
|
||||||
'user' => 'root',
|
'user' => 'root',
|
||||||
'access_networks' => access_networks,
|
'access_networks' => access_networks,
|
||||||
@ -37,6 +43,12 @@ describe manifest do
|
|||||||
).that_comes_before('Osnailyfacter::Mysql_user')
|
).that_comes_before('Osnailyfacter::Mysql_user')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should configure mysql to ignore lost+found directory" do
|
||||||
|
expect(subject).to contain_class('mysql::server').with(
|
||||||
|
'ignore_db_dirs' => ['lost+found']
|
||||||
|
).that_comes_before('Osnailyfacter::Mysql_user')
|
||||||
|
end
|
||||||
|
|
||||||
it { should contain_class('osnailyfacter::mysql_access') }
|
it { should contain_class('osnailyfacter::mysql_access') }
|
||||||
it { should contain_class('openstack::galera::status').that_comes_before('Haproxy_backend_status[mysql]') }
|
it { should contain_class('openstack::galera::status').that_comes_before('Haproxy_backend_status[mysql]') }
|
||||||
it { should contain_haproxy_backend_status('mysql').that_comes_before('Class[osnailyfacter::mysql_access]') }
|
it { should contain_haproxy_backend_status('mysql').that_comes_before('Class[osnailyfacter::mysql_access]') }
|
||||||
|
Loading…
Reference in New Issue
Block a user