Merge "Do not create cinder-volumes if not needed"

This commit is contained in:
Jenkins
2014-12-01 11:49:46 +00:00
committed by Gerrit Code Review

View File

@@ -1,31 +1,34 @@
class { 'cinder::setup_test_volume': $create_cinder_volume = hiera('CONFIG_CINDER_VOLUMES_CREATE')
size => hiera('CONFIG_CINDER_VOLUMES_SIZE'),
loopback_device => '/dev/loop2',
volume_path => '/var/lib/cinder',
volume_name => 'cinder-volumes',
}
# Add loop device on boot if $create_cinder_volume == 'y' {
$el_releases = ['RedHat', 'CentOS', 'Scientific'] class { 'cinder::setup_test_volume':
if $::operatingsystem in $el_releases and $::operatingsystemmajrelease < 7 { size => hiera('CONFIG_CINDER_VOLUMES_SIZE'),
loopback_device => '/dev/loop2',
volume_path => '/var/lib/cinder',
volume_name => 'cinder-volumes',
}
file_line{ 'rc.local_losetup_cinder_volume': # Add loop device on boot
path => '/etc/rc.d/rc.local', $el_releases = ['RedHat', 'CentOS', 'Scientific']
match => '^.*/var/lib/cinder/cinder-volumes.*$', if $::operatingsystem in $el_releases and $::operatingsystemmajrelease < 7 {
line => 'losetup -f /var/lib/cinder/cinder-volumes && service openstack-cinder-volume restart',
}
file { '/etc/rc.d/rc.local': file_line{ 'rc.local_losetup_cinder_volume':
mode => '0755', path => '/etc/rc.d/rc.local',
} match => '^.*/var/lib/cinder/cinder-volumes.*$',
line => 'losetup -f /var/lib/cinder/cinder-volumes && service openstack-cinder-volume restart',
}
} else { file { '/etc/rc.d/rc.local':
mode => '0755',
}
file { 'openstack-losetup': } else {
path => '/usr/lib/systemd/system/openstack-losetup.service',
before => Service['openstack-losetup'], file { 'openstack-losetup':
notify => Exec['/usr/bin/systemctl daemon-reload'], path => '/usr/lib/systemd/system/openstack-losetup.service',
content => '[Unit] before => Service['openstack-losetup'],
notify => Exec['/usr/bin/systemctl daemon-reload'],
content => '[Unit]
Description=Setup cinder-volume loop device Description=Setup cinder-volume loop device
DefaultDependencies=false DefaultDependencies=false
Before=openstack-cinder-volume.service Before=openstack-cinder-volume.service
@@ -40,20 +43,27 @@ RemainAfterExit=yes
[Install] [Install]
RequiredBy=openstack-cinder-volume.service', RequiredBy=openstack-cinder-volume.service',
} }
exec { '/usr/bin/systemctl daemon-reload': exec { '/usr/bin/systemctl daemon-reload':
refreshonly => true, refreshonly => true,
before => Service['openstack-losetup'], before => Service['openstack-losetup'],
} }
service { 'openstack-losetup': service { 'openstack-losetup':
ensure => running, ensure => running,
enable => true, enable => true,
require => Class['cinder::setup_test_volume'], require => Class['cinder::setup_test_volume'],
} }
}
} }
else {
package {'lvm2':
ensure => 'present',
}
}
file_line { 'snapshot_autoextend_threshold': file_line { 'snapshot_autoextend_threshold':
path => '/etc/lvm/lvm.conf', path => '/etc/lvm/lvm.conf',
@@ -74,6 +84,8 @@ cinder::backend::iscsi { 'lvm':
require => Package['lvm2'], require => Package['lvm2'],
} }
cinder::type { 'iscsi': cinder::type { 'iscsi':
set_key => 'volume_backend_name', set_key => 'volume_backend_name',
set_value => 'lvm', set_value => 'lvm',