Merge pull request #633 from enovance/nfs-images
NFS backend for Glance images
This commit is contained in:
commit
c0c0cbf469
@ -123,11 +123,23 @@ fixtures:
|
||||
'ssh':
|
||||
repo: 'git://github.com/enovance/puppet-ssh.git'
|
||||
ref: '10675c0d80511a8cdd514af67b695887fa97ec40'
|
||||
'rpcbind':
|
||||
repo: 'git://github.com/enovance/puppet-module-rpcbind.git'
|
||||
ref: 'da943d26f09f9658159c1190e058bf1af88f465d'
|
||||
'rsyslog':
|
||||
repo: 'git://github.com/enovance/puppet-rsyslog.git'
|
||||
ref: '67c7c501b916ebd1a27a8a218d49602339526c4f'
|
||||
'rsync':
|
||||
repo: 'git://github.com/enovance/puppetlabs-rsync.git'
|
||||
ref: '7122983d89bf68bc4170415cc03212f6a8a4636e'
|
||||
'nfs':
|
||||
repo: 'git://github.com/enovance/puppet-module-nfs.git'
|
||||
ref: '65086bcc5fc5cd9ff617a425505326619a0887fc'
|
||||
'common':
|
||||
repo: 'git://github.com/enovance/puppet-module-common.git'
|
||||
ref: '2d0606fce1078222dd483e731ec32807f5b4ca53'
|
||||
'types':
|
||||
repo: 'git://github.com/enovance/puppet-module-types.git'
|
||||
ref: '4c58ae8b6cdb1a9da3da9654a35375e274019dfb'
|
||||
symlinks:
|
||||
'cloud': '#{source_dir}'
|
||||
|
14
Puppetfile
14
Puppetfile
@ -68,6 +68,9 @@ mod 'ceph',
|
||||
mod 'cloud',
|
||||
:git => 'git://github.com/enovance/puppet-openstack-cloud.git',
|
||||
:ref => 'master'
|
||||
mod 'common',
|
||||
:git => 'git://github.com/enovance/puppet-module-common.git',
|
||||
:ref => '2d0606fce1078222dd483e731ec32807f5b4ca53'
|
||||
mod 'concat',
|
||||
:git => 'git://github.com/enovance/puppet-concat.git',
|
||||
:ref => '04356974f72b90a1d0f57346a00e95a717924e43'
|
||||
@ -125,6 +128,11 @@ mod 'mongodb',
|
||||
mod 'mysql',
|
||||
:git => 'git://github.com/enovance/puppetlabs-mysql.git',
|
||||
:ref => '8b814d4d2cb5786a15e8e37fb3b7444d5d5f0d3f'
|
||||
# TODO(EmilienM) Come back to upstream after
|
||||
# https://github.com/ghoneycutt/puppet-module-nfs/pull/43 got merged.
|
||||
mod 'nfs',
|
||||
:git => 'git://github.com/enovance/puppet-module-nfs.git',
|
||||
:ref => '65086bcc5fc5cd9ff617a425505326619a0887fc'
|
||||
mod 'ntp',
|
||||
:git => 'git://github.com/enovance/puppetlabs-ntp.git',
|
||||
:ref => 'eb02ba2937ce86fb609ae41499767244b78ec58d'
|
||||
@ -137,6 +145,9 @@ mod 'rabbitmq',
|
||||
mod 'rhnreg_ks',
|
||||
:git => 'git://github.com/enovance/puppet-rhnreg_ks.git',
|
||||
:ref => '8fdc051992b44a09f39d3b510d7cd6db5ed5ff66'
|
||||
mod 'rpcbind',
|
||||
:git => 'git://github.com/enovance/puppet-module-rpcbind.git',
|
||||
:ref => 'da943d26f09f9658159c1190e058bf1af88f465d'
|
||||
mod 'rsync',
|
||||
:git => 'git://github.com/enovance/puppetlabs-rsync.git',
|
||||
:ref => '7122983d89bf68bc4170415cc03212f6a8a4636e'
|
||||
@ -154,6 +165,9 @@ mod 'stdlib',
|
||||
mod 'sysctl',
|
||||
:git => 'git://github.com/enovance/puppet-sysctl.git',
|
||||
:ref => '4a463384e844f51b270428643a5b8beb3628e854'
|
||||
mod 'types',
|
||||
:git => 'git://github.com/enovance/puppet-module-types.git',
|
||||
:ref => '4c58ae8b6cdb1a9da3da9654a35375e274019dfb'
|
||||
mod 'vswitch',
|
||||
:git => 'git://github.com/enovance/puppet-vswitch.git',
|
||||
:ref => '49dbaff15e8f017dbe365ebf08eb505472b695a1'
|
||||
|
2
Rakefile
2
Rakefile
@ -12,6 +12,8 @@ PuppetLint.configuration.fail_on_warnings = true
|
||||
PuppetLint.configuration.send('disable_80chars')
|
||||
# for manifest loadbalancer.pp +39 (default value as an array of variables)
|
||||
PuppetLint.configuration.send('disable_class_parameter_defaults')
|
||||
# manifests/image/api.pp - WARNING: string containing only a variable on line 189
|
||||
PuppetLint.configuration.send('disable_only_variable_string')
|
||||
# For stonith-enabled (it's a string not a bool)
|
||||
PuppetLint.configuration.send('disable_quoted_booleans')
|
||||
# Ignore all upstream modules
|
||||
|
@ -69,9 +69,15 @@
|
||||
#
|
||||
# [*backend*]
|
||||
# (optionnal) Backend to use to store images
|
||||
# Can be 'rbd' or 'file'.
|
||||
# Can be 'rbd', 'file' or 'nfs'.
|
||||
# Defaults to 'rbd' to maintain backward compatibility
|
||||
#
|
||||
# [*nfs_device*]
|
||||
# (optionnal) NFS device to mount
|
||||
# Example: 'nfs.example.com:/vol1'
|
||||
# Required when running 'nfs' backend.
|
||||
# Defaults to false
|
||||
#
|
||||
class cloud::image::api(
|
||||
$glance_db_host = '127.0.0.1',
|
||||
$glance_db_user = 'glance',
|
||||
@ -94,7 +100,8 @@ class cloud::image::api(
|
||||
$log_facility = 'LOG_LOCAL0',
|
||||
$use_syslog = true,
|
||||
$backend = 'rbd',
|
||||
$filesystem_store_datadir = undef
|
||||
$filesystem_store_datadir = undef,
|
||||
$nfs_device = false,
|
||||
) {
|
||||
|
||||
# Disable twice logging if syslog is enabled
|
||||
@ -170,6 +177,27 @@ class cloud::image::api(
|
||||
class { 'glance::backend::file':
|
||||
filesystem_store_datadir => $filesystem_store_datadir
|
||||
}
|
||||
} elsif ($backend == 'nfs') {
|
||||
# There is no NFS backend in Glance.
|
||||
# We mount the NFS share in filesystem_store_datadir to fake the
|
||||
# backend.
|
||||
if $nfs_device {
|
||||
class { 'glance::backend::file':
|
||||
filesystem_store_datadir => $filesystem_store_datadir
|
||||
}
|
||||
$nfs_mount = {
|
||||
"${filesystem_store_datadir}" => {
|
||||
'ensure' => 'present',
|
||||
'fstype' => 'nfs',
|
||||
'device' => $nfs_device
|
||||
}
|
||||
}
|
||||
ensure_resource('class', 'nfs', {
|
||||
mounts => $nfs_mount
|
||||
})
|
||||
} else {
|
||||
fail('When running NFS backend, you need to provide nfs_device parameter.')
|
||||
}
|
||||
} else {
|
||||
fail("${backend} is not a Glance supported backend.")
|
||||
}
|
||||
|
@ -106,6 +106,34 @@ describe 'cloud::image::api' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'with NFS Glance backend' do
|
||||
before :each do
|
||||
params.merge!(:backend => 'nfs',
|
||||
:filesystem_store_datadir => '/srv/images/',
|
||||
:nfs_device => 'nfs.example.com:/vol1' )
|
||||
end
|
||||
|
||||
it 'configure Glance with NFS backend' do
|
||||
should contain_class('glance::backend::file')
|
||||
should_not contain_class('glance::backend::rbd')
|
||||
should contain_glance_api_config('DEFAULT/filesystem_store_datadir').with('value' => '/srv/images/')
|
||||
should contain_glance_api_config('DEFAULT/default_store').with('value' => 'file')
|
||||
should contain_mount('/srv/images/').with({
|
||||
'ensure' => 'present',
|
||||
'fstype' => 'nfs',
|
||||
'device' => 'nfs.example.com:/vol1',
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
context 'with missing parameter when using Glance NFS backend' do
|
||||
before :each do
|
||||
params.merge!(:backend => 'nfs',
|
||||
:nfs_device => false )
|
||||
end
|
||||
it { should compile.and_raise_error(/When running NFS backend, you need to provide nfs_device parameter./) }
|
||||
end
|
||||
|
||||
context 'with wrong Glance backend' do
|
||||
before :each do
|
||||
params.merge!(:backend => 'Something')
|
||||
@ -116,7 +144,9 @@ describe 'cloud::image::api' do
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
{ :osfamily => 'Debian',
|
||||
# required for rpcbind module
|
||||
:lsbdistid => 'Debian' }
|
||||
end
|
||||
|
||||
it_configures 'openstack image api'
|
||||
@ -124,7 +154,9 @@ describe 'cloud::image::api' do
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
{ :osfamily => 'RedHat',
|
||||
# required for nfs module
|
||||
:lsbmajdistrelease => '7' }
|
||||
end
|
||||
|
||||
it_configures 'openstack image api'
|
||||
|
Loading…
x
Reference in New Issue
Block a user