Modified nova-volume:
* Tried to refactor to allow other nova-volume drivers to easily be added. * As well, allow other iscsi implementations to be configured in iscsi.pp * Added iscsi_helper and iscsi_ip_address as a parameter for nova::volume::iscsi * Added tests for volume manifests * Added example configs.
This commit is contained in:
parent
624c7be8e4
commit
40cd1f308a
@ -178,6 +178,8 @@ class { 'nova::volume':
|
||||
enabled => true
|
||||
}
|
||||
|
||||
class { 'nova::volume::iscsi': }
|
||||
|
||||
class { 'nova::cert':
|
||||
enabled => true
|
||||
}
|
||||
|
@ -197,6 +197,12 @@ node /controller/ {
|
||||
enabled => true
|
||||
}
|
||||
|
||||
class { 'nova::volume':
|
||||
enabled => true,
|
||||
}
|
||||
|
||||
class { 'nova::volume::iscsi': }
|
||||
|
||||
######## Horizon ########
|
||||
|
||||
class { 'memcached':
|
||||
|
@ -1,34 +1,13 @@
|
||||
class nova::volume(
|
||||
$enabled = false,
|
||||
$ensure_package = 'present'
|
||||
$enabled = false
|
||||
) {
|
||||
|
||||
include 'nova::params'
|
||||
|
||||
exec { 'volumes':
|
||||
command => 'dd if=/dev/zero of=/tmp/nova-volumes.img bs=1M seek=20k count=0 && /sbin/vgcreate nova-volumes `/sbin/losetup --show -f /tmp/nova-volumes.img`',
|
||||
onlyif => 'test ! -e /tmp/nova-volumes.img',
|
||||
path => ["/usr/bin", "/bin", "/usr/local/bin"],
|
||||
before => Service['nova-volume'],
|
||||
}
|
||||
|
||||
nova::generic_service { 'volume':
|
||||
enabled => $enabled,
|
||||
package_name => $::nova::params::volume_package_name,
|
||||
service_name => $::nova::params::volume_service_name,
|
||||
ensure_package => $ensure_package,
|
||||
}
|
||||
|
||||
package { 'tgt':
|
||||
name => $::nova::params::tgt_package_name,
|
||||
ensure => present,
|
||||
}
|
||||
# TODO is this fedora specific?
|
||||
service {'tgtd':
|
||||
name => $::nova::params::tgt_service_name,
|
||||
provider => $::nova::params::special_service_provider,
|
||||
ensure => $service_ensure,
|
||||
enable => $enabled,
|
||||
require => [Nova::Generic_service['volume'], Package['tgt']],
|
||||
}
|
||||
}
|
||||
|
57
deployment/puppet/nova/manifests/volume/iscsi.pp
Normal file
57
deployment/puppet/nova/manifests/volume/iscsi.pp
Normal file
@ -0,0 +1,57 @@
|
||||
# Class: nova::volume::iscsi
|
||||
#
|
||||
# iscsi is the default volume driver for OpenStack.
|
||||
#
|
||||
# [*Parameters*]
|
||||
#
|
||||
# [volume_group] Name of the volume group to use.
|
||||
# Optional. Defaults to 'nova-volumes' - the OpenStack default.
|
||||
#
|
||||
# [iscsi_helper] Name of the iscsi helper to use.
|
||||
# Optional. Defaults to 'tgtadm' - the OpenStack default.
|
||||
#
|
||||
# [iscsi_ip_address] IP address on the nova-volume server where
|
||||
# compute nodes will connect to for volumes.
|
||||
# Optional. Defaults to undef. OpenStack defaults to server IP.
|
||||
#
|
||||
# This class assumes that you have already configured your
|
||||
# volume group - either by another module or during the server
|
||||
# provisioning
|
||||
#
|
||||
|
||||
class nova::volume::iscsi (
|
||||
$volume_group = 'nova-volumes',
|
||||
$iscsi_helper = 'tgtadm',
|
||||
$iscsi_ip_address = undef,
|
||||
) {
|
||||
|
||||
include 'nova::params'
|
||||
|
||||
nova_config { 'volume_group': value => $volume_group }
|
||||
|
||||
if $iscsi_ip_address {
|
||||
nova_config { 'iscsi_ip_address': value => $iscsi_ip_address }
|
||||
}
|
||||
|
||||
case $iscsi_helper {
|
||||
'tgtadm': {
|
||||
package { 'tgt':
|
||||
name => $::nova::params::tgt_package_name,
|
||||
ensure => present,
|
||||
}
|
||||
service { 'tgtd':
|
||||
name => $::nova::params::tgt_service_name,
|
||||
provider => $::nova::params::special_service_provider,
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => [Nova::Generic_service['volume'], Package['tgt']],
|
||||
}
|
||||
# This is the default, but might as well be verbose
|
||||
nova_config { 'iscsi_helper': value => 'tgtadm' }
|
||||
}
|
||||
|
||||
default: {
|
||||
fail("Unsupported iscsi helper: ${iscsi_helper}. The supported iscsi helper is tgtadm.")
|
||||
}
|
||||
}
|
||||
}
|
5
deployment/puppet/nova/tests/volume.pp
Normal file
5
deployment/puppet/nova/tests/volume.pp
Normal file
@ -0,0 +1,5 @@
|
||||
class { 'nova': }
|
||||
|
||||
class { 'nova::volume':
|
||||
enabled => true,
|
||||
}
|
5
deployment/puppet/nova/tests/volume/iscsi.pp
Normal file
5
deployment/puppet/nova/tests/volume/iscsi.pp
Normal file
@ -0,0 +1,5 @@
|
||||
class { 'nova': }
|
||||
class { 'nova::volume':
|
||||
enabled => true,
|
||||
}
|
||||
class {'nova::volume::iscsi': }
|
Loading…
Reference in New Issue
Block a user