edit the share testing .pp

not confirmed to work
This commit is contained in:
Ryan Hefner 2014-08-23 19:53:14 -04:00
parent 421875bda8
commit d412f40e2c

View File

@ -1,3 +1,4 @@
#NTAP: this needs to be tweaked - no idea what to put here
# == Class: manila::setup_test_share
#
# Setup a share group on a loop device for test purposes.
@ -13,33 +14,45 @@
# [*loopback_device*]
# Loop device name. Defaults to '/dev/loop2'.
#
# [*share_path*]
# Share image location. Defaults to '/var/lib/manila'.
class manila::setup_test_share(
$share_name = 'manila-shares',
$share_path = '/var/lib/manila',
$size = '4G',
$loopback_device = '/dev/loop2'
) {
Exec {
cwd => '/tmp/',
}
package { 'lvm2':
package { 'nfs-utils':
ensure => present,
} ~>
exec { "/bin/dd if=/dev/zero of=${share_name} bs=1 count=0 seek=${size}":
unless => "/sbin/vgdisplay ${share_name}"
file { $share_path:
ensure => directory,
owner => 'manila',
group => 'manila',
require => Package['manila'],
} ~>
exec { "/sbin/losetup ${loopback_device} ${share_name}":
exec { "create_${share_path}/${share_name}":
command => "dd if=/dev/zero of=\"${share_path}/${share_name}\" bs=1 count=0 seek=${size}",
path => ['/bin','/usr/bin','/sbin','/usr/sbin'],
unless => "stat ${share_path}/${share_name}",
} ~>
exec { "losetup ${loopback_device} ${share_path}/${share_name}":
path => ['/bin','/usr/bin','/sbin','/usr/sbin'],
refreshonly => true,
} ~>
exec { "/sbin/pvcreate ${loopback_device}":
exec { "pvcreate ${loopback_device}":
path => ['/bin','/usr/bin','/sbin','/usr/sbin'],
unless => "pvdisplay | grep ${share_name}",
refreshonly => true,
} ~>
exec { "/sbin/vgcreate ${share_name} ${loopback_device}":
exec { "vgcreate ${share_name} ${loopback_device}":
path => ['/bin','/usr/bin','/sbin','/usr/sbin'],
refreshonly => true,
}