NFS backend support to store Nova instances
Allow to store instances on a NFS share. * New parameters: nfs_enabled, nfs_device and filesystem_store_datadir * Disabled by default * Unit tests with 3 contexts to validate all eventual cases
This commit is contained in:
parent
c0c0cbf469
commit
2713f14f68
@ -33,6 +33,22 @@
|
|||||||
# (optional) Allow to manage or not TSO issue.
|
# (optional) Allow to manage or not TSO issue.
|
||||||
# Default to true.
|
# Default to true.
|
||||||
#
|
#
|
||||||
|
# [*nfs_enabled*]
|
||||||
|
# (optional) Store (or not) instances on a NFS share.
|
||||||
|
# Defaults to false
|
||||||
|
#
|
||||||
|
# [*nfs_device*]
|
||||||
|
# (optional) NFS device to mount
|
||||||
|
# Example: 'nfs.example.com:/vol1'
|
||||||
|
# Required when nfs_enabled is at true.
|
||||||
|
# Defaults to false
|
||||||
|
#
|
||||||
|
# [*filesystem_store_datadir*]
|
||||||
|
# (optional) Full path of data directory to store the instances.
|
||||||
|
# Don't modify this parameter if you don't know what you do.
|
||||||
|
# You may have side effects (SElinux for example).
|
||||||
|
# Defaults to '/var/lib/nova/instances'
|
||||||
|
#
|
||||||
class cloud::compute::hypervisor(
|
class cloud::compute::hypervisor(
|
||||||
$server_proxyclient_address = '127.0.0.1',
|
$server_proxyclient_address = '127.0.0.1',
|
||||||
$libvirt_type = 'kvm',
|
$libvirt_type = 'kvm',
|
||||||
@ -47,6 +63,10 @@ class cloud::compute::hypervisor(
|
|||||||
$vm_rbd = false,
|
$vm_rbd = false,
|
||||||
$volume_rbd = false,
|
$volume_rbd = false,
|
||||||
$manage_tso = true,
|
$manage_tso = true,
|
||||||
|
# when using NFS storage backend
|
||||||
|
$nfs_enabled = false,
|
||||||
|
$nfs_device = false,
|
||||||
|
$filesystem_store_datadir = '/var/lib/nova/instances',
|
||||||
# set to false to keep backward compatibility
|
# set to false to keep backward compatibility
|
||||||
$ks_spice_public_proto = false,
|
$ks_spice_public_proto = false,
|
||||||
$ks_spice_public_host = false,
|
$ks_spice_public_host = false,
|
||||||
@ -84,6 +104,35 @@ class cloud::compute::hypervisor(
|
|||||||
$ks_spice_public_host_real = $ks_nova_public_host
|
$ks_spice_public_host_real = $ks_nova_public_host
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $nfs_enabled {
|
||||||
|
if ! $vm_rbd {
|
||||||
|
# There is no NFS backend in Nova.
|
||||||
|
# We mount the NFS share in filesystem_store_datadir to fake the
|
||||||
|
# backend.
|
||||||
|
if $nfs_device {
|
||||||
|
nova_config { 'DEFAULT/instances_path': value => $filesystem_store_datadir; }
|
||||||
|
$nfs_mount = {
|
||||||
|
"${filesystem_store_datadir}" => {
|
||||||
|
'ensure' => 'present',
|
||||||
|
'fstype' => 'nfs',
|
||||||
|
'device' => $nfs_device
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ensure_resource('class', 'nfs', {
|
||||||
|
mounts => $nfs_mount
|
||||||
|
})
|
||||||
|
# Not using /var/lib/nova/instances may cause side effects.
|
||||||
|
if $filesystem_store_datadir != '/var/lib/nova/instances' {
|
||||||
|
warning('filesystem_store_datadir is not /var/lib/nova/instances so you may have side effects (SElinux, etc)')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fail('When running NFS backend, you need to provide nfs_device parameter.')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fail('When running NFS backend, vm_rbd parameter cannot be set to true.')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
file{ '/var/lib/nova/.ssh':
|
file{ '/var/lib/nova/.ssh':
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
mode => '0700',
|
mode => '0700',
|
||||||
|
@ -469,6 +469,41 @@ describe 'cloud::compute::hypervisor' do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when storing instances on a NFS share' do
|
||||||
|
before :each do
|
||||||
|
params.merge!(
|
||||||
|
:nfs_enabled => true,
|
||||||
|
:nfs_device => 'nfs.example.com:/vol1' )
|
||||||
|
end
|
||||||
|
it 'configure nova instances path and NFS mount' do
|
||||||
|
should contain_nova_config('DEFAULT/instances_path').with('value' => '/var/lib/nova/instances')
|
||||||
|
should contain_mount('/var/lib/nova/instances').with({
|
||||||
|
'ensure' => 'present',
|
||||||
|
'fstype' => 'nfs',
|
||||||
|
'device' => 'nfs.example.com:/vol1',
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when storing instances on a NFS share without nfs_device' do
|
||||||
|
before :each do
|
||||||
|
params.merge!(
|
||||||
|
:nfs_enabled => true,
|
||||||
|
:nfs_device => false )
|
||||||
|
end
|
||||||
|
it_raises 'a Puppet::Error', /When running NFS backend, you need to provide nfs_device parameter./
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when storing instances on a NFS share with vm_rbd enabled' do
|
||||||
|
before :each do
|
||||||
|
params.merge!(
|
||||||
|
:nfs_enabled => true,
|
||||||
|
:vm_rbd => true,
|
||||||
|
:nfs_device => 'nfs.example.com:/vol1' )
|
||||||
|
end
|
||||||
|
it_raises 'a Puppet::Error', /When running NFS backend, vm_rbd parameter cannot be set to true./
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on Debian platforms' do
|
context 'on Debian platforms' do
|
||||||
@ -476,7 +511,9 @@ describe 'cloud::compute::hypervisor' do
|
|||||||
{ :osfamily => 'Debian',
|
{ :osfamily => 'Debian',
|
||||||
:operatingsystem => 'Debian',
|
:operatingsystem => 'Debian',
|
||||||
:vtx => true,
|
:vtx => true,
|
||||||
:concat_basedir => '/var/lib/puppet/concat'
|
:concat_basedir => '/var/lib/puppet/concat',
|
||||||
|
# required for rpcbind module
|
||||||
|
:lsbdistid => 'Debian'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -485,9 +522,11 @@ describe 'cloud::compute::hypervisor' do
|
|||||||
|
|
||||||
context 'on RedHat platforms' do
|
context 'on RedHat platforms' do
|
||||||
let :facts do
|
let :facts do
|
||||||
{ :osfamily => 'RedHat',
|
{ :osfamily => 'RedHat',
|
||||||
:vtx => true,
|
:vtx => true,
|
||||||
:concat_basedir => '/var/lib/puppet/concat'
|
:concat_basedir => '/var/lib/puppet/concat',
|
||||||
|
# required for nfs module
|
||||||
|
:lsbmajdistrelease => '7'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user