diff --git a/manifests/swift/storage-node.pp b/manifests/swift/storage-node.pp index 45bb476..841e703 100644 --- a/manifests/swift/storage-node.pp +++ b/manifests/swift/storage-node.pp @@ -7,10 +7,11 @@ class openstack::swift::storage-node ( $storage_mnt_base_dir = '/srv/node', $storage_devices = ['1', '2'], $storage_weight = 1, - $package_ensure = 'present' + $package_ensure = 'present', + $byte_size = '1024', ) { - class { 'swift': + class { 'swift': swift_hash_suffix => $swift_hash_suffix, package_ensure => $package_ensure, } @@ -24,6 +25,13 @@ class openstack::swift::storage-node ( require => Class['swift'], } } + # make xfs filesystem on physical disk and mount them + 'disk': { + swift::storage::disk {$storage_devices: + mnt_base_dir => $storage_mnt_base_dir, + byte_size => $byte_size, + } + } } # install all swift storage servers together diff --git a/spec/classes/openstack_swift_storage-node.rb b/spec/classes/openstack_swift_storage-node.rb new file mode 100644 index 0000000..f9001e2 --- /dev/null +++ b/spec/classes/openstack_swift_storage-node.rb @@ -0,0 +1,51 @@ +require 'spec_helper' + +describe 'openstack::swift::storage-node' do + + let :params do + { + :swift_zone => '1', + :storage_devices => '1', + } + end + + let :facts do + { :ipaddress_eth0 => '192.168.1.2' } + end + + it 'should configure using the default values' do + should contain_class('swift').with( + :swift_hash_suffix => 'swift_secret', + :package_ensure => 'present', + ) + should contain_define('swift::storage::loopback').with( + :base_dir => '/srv/loopback-device', + :mnt_base_dir => '/srv/node', + ) + should contain_class('swift::storage::all').with( + :storage_local_net_ip => '192.168.1.2', + ) + end + + describe 'when setting up dsik for storage_type' do + before do + params.merge!( + :storage_type => 'disk', + :storage_devices => 'sda', + ) + end + it 'should configure using the configured values' do + should contain_class('swift').with( + :swift_hash_suffix => 'swift_secret', + :package_ensure => 'present', + ) + should contain_define('swift::storage::disk').with( + :mnt_base_dir => '/srv/node', + :byte_size => '1024', + ) + should contain_class('swift::storage::all').with( + :storage_local_net_ip => '192.168.1.2', + ) + end + +end