Add 'rsync_use_xinetd' as argument to swift::ringserver
Since in RHEL/CentOS >= 8 rsyncd systemd unit is shipped in a different package (rsync-dameon), we need to be able to not use xinetd to manage rsync service. The dependency on rsync-daemon for RHEL/CentOS >= 8 is handled in puppet-rsync with [1]. [1] https://github.com/puppetlabs/puppetlabs-rsync/pull/139/files Conflicts: manifests/params.pp Resolved conflict caused by5b0745101a. Closes-Bug: #1930855 Change-Id: I85abf3811d61fa8bfc0a1607818d6495549b5a6b (cherry picked from commit053a3a2a56)
This commit is contained in:
		
				
					committed by
					
						
						Takashi Kajinami
					
				
			
			
				
	
			
			
			
						parent
						
							a8dc75e183
						
					
				
				
					commit
					b3576e78bf
				
			@@ -36,6 +36,7 @@ class swift::params {
 | 
				
			|||||||
      $account_reaper_service_name       = 'swift-account-reaper'
 | 
					      $account_reaper_service_name       = 'swift-account-reaper'
 | 
				
			||||||
      $account_replicator_service_name   = 'swift-account-replicator'
 | 
					      $account_replicator_service_name   = 'swift-account-replicator'
 | 
				
			||||||
      $ceilometermiddleware_package_name = "python${pyvers}-ceilometermiddleware"
 | 
					      $ceilometermiddleware_package_name = "python${pyvers}-ceilometermiddleware"
 | 
				
			||||||
 | 
					      $xinetd_available                  = true
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    'RedHat': {
 | 
					    'RedHat': {
 | 
				
			||||||
      $package_name                      = 'openstack-swift'
 | 
					      $package_name                      = 'openstack-swift'
 | 
				
			||||||
@@ -62,6 +63,11 @@ class swift::params {
 | 
				
			|||||||
      $account_reaper_service_name       = 'openstack-swift-account-reaper'
 | 
					      $account_reaper_service_name       = 'openstack-swift-account-reaper'
 | 
				
			||||||
      $account_replicator_service_name   = 'openstack-swift-account-replicator'
 | 
					      $account_replicator_service_name   = 'openstack-swift-account-replicator'
 | 
				
			||||||
      $ceilometermiddleware_package_name = "python${pyvers}-ceilometermiddleware"
 | 
					      $ceilometermiddleware_package_name = "python${pyvers}-ceilometermiddleware"
 | 
				
			||||||
 | 
					      if (Integer.new($::os['release']['major']) > 8) {
 | 
				
			||||||
 | 
					        $xinetd_available                = false
 | 
				
			||||||
 | 
					      } else {
 | 
				
			||||||
 | 
					        $xinetd_available                = true
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    default: {
 | 
					    default: {
 | 
				
			||||||
      fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \
 | 
					      fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,10 @@
 | 
				
			|||||||
#   (optional) maximum connections to rsync server
 | 
					#   (optional) maximum connections to rsync server
 | 
				
			||||||
#   Defaults to 5
 | 
					#   Defaults to 5
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					# [*rsync_use_xinetd*]
 | 
				
			||||||
 | 
					#   (optional) Override whether to use xinetd to manage rsync service
 | 
				
			||||||
 | 
					#   Defaults to swift::params::xinetd_available
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
# == Dependencies
 | 
					# == Dependencies
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#   Class['swift']
 | 
					#   Class['swift']
 | 
				
			||||||
@@ -27,15 +31,20 @@
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
class swift::ringserver(
 | 
					class swift::ringserver(
 | 
				
			||||||
  $local_net_ip,
 | 
					  $local_net_ip,
 | 
				
			||||||
  $max_connections = 5
 | 
					  $max_connections = 5,
 | 
				
			||||||
) {
 | 
					  $rsync_use_xinetd = $::swift::params::xinetd_available,
 | 
				
			||||||
 | 
					) inherits swift::params {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  include swift::deps
 | 
					  include swift::deps
 | 
				
			||||||
  Class['swift::ringbuilder'] -> Class['swift::ringserver']
 | 
					  Class['swift::ringbuilder'] -> Class['swift::ringserver']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if $rsync_use_xinetd and ! $::swift::params::xinetd_available {
 | 
				
			||||||
 | 
					    fail('xinetd is not available in this distro')
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if !defined(Class['rsync::server']) {
 | 
					  if !defined(Class['rsync::server']) {
 | 
				
			||||||
    class { 'rsync::server':
 | 
					    class { 'rsync::server':
 | 
				
			||||||
      use_xinetd => true,
 | 
					      use_xinetd => $rsync_use_xinetd,
 | 
				
			||||||
      address    => $local_net_ip,
 | 
					      address    => $local_net_ip,
 | 
				
			||||||
      use_chroot => 'no',
 | 
					      use_chroot => 'no',
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,8 +8,9 @@
 | 
				
			|||||||
#  [*storage_local_net_ip*] ip address that the swift servers should
 | 
					#  [*storage_local_net_ip*] ip address that the swift servers should
 | 
				
			||||||
#    bind to. Required.
 | 
					#    bind to. Required.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#  [*rsync_use_xinetd*] indicate if xinetd should be used to manage
 | 
					#  [*rsync_use_xinetd*]
 | 
				
			||||||
#  rsync service, Default to True.
 | 
					#   (optional) Override whether to use xinetd to manage rsync service
 | 
				
			||||||
 | 
					#   Defaults to swift::params::xinetd_available
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# == Dependencies
 | 
					# == Dependencies
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
@@ -25,11 +26,15 @@
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
class swift::storage(
 | 
					class swift::storage(
 | 
				
			||||||
  $storage_local_net_ip,
 | 
					  $storage_local_net_ip,
 | 
				
			||||||
  $rsync_use_xinetd = true,
 | 
					  $rsync_use_xinetd = $::swift::params::xinetd_available,
 | 
				
			||||||
) {
 | 
					) inherits swift::params {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  include swift::deps
 | 
					  include swift::deps
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if $rsync_use_xinetd and ! $::swift::params::xinetd_available {
 | 
				
			||||||
 | 
					    fail('xinetd is not available in this distro')
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if !defined(Class['rsync::server']){
 | 
					  if !defined(Class['rsync::server']){
 | 
				
			||||||
    class{ 'rsync::server':
 | 
					    class{ 'rsync::server':
 | 
				
			||||||
      use_xinetd => $rsync_use_xinetd,
 | 
					      use_xinetd => $rsync_use_xinetd,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -122,6 +122,10 @@
 | 
				
			|||||||
#   (optional) maximum number of simultaneous connections allowed for rsync.
 | 
					#   (optional) maximum number of simultaneous connections allowed for rsync.
 | 
				
			||||||
#   Defaults to 25.
 | 
					#   Defaults to 25.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					# [*rsync_use_xinetd*]
 | 
				
			||||||
 | 
					#   (optional) Override whether to use xinetd to manage rsync service
 | 
				
			||||||
 | 
					#   Defaults to swift::params::xinetd_available
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
class swift::storage::all(
 | 
					class swift::storage::all(
 | 
				
			||||||
  $storage_local_net_ip,
 | 
					  $storage_local_net_ip,
 | 
				
			||||||
  $devices                        = '/srv/node',
 | 
					  $devices                        = '/srv/node',
 | 
				
			||||||
@@ -152,7 +156,8 @@ class swift::storage::all(
 | 
				
			|||||||
  $object_server_mb_per_sync      = 512,
 | 
					  $object_server_mb_per_sync      = 512,
 | 
				
			||||||
  $splice                         = false,
 | 
					  $splice                         = false,
 | 
				
			||||||
  $max_connections                = 25,
 | 
					  $max_connections                = 25,
 | 
				
			||||||
) {
 | 
					  $rsync_use_xinetd               = $::swift::params::xinetd_available,
 | 
				
			||||||
 | 
					) inherits swift::params {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  include swift::deps
 | 
					  include swift::deps
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -171,8 +176,13 @@ from 6001 to 6201 and will be changed in a later release')
 | 
				
			|||||||
from 6002 to 6202 and will be changed in a later release')
 | 
					from 6002 to 6202 and will be changed in a later release')
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if $rsync_use_xinetd and ! $::swift::params::xinetd_available {
 | 
				
			||||||
 | 
					    fail('xinetd is not available in this distro')
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  class { 'swift::storage':
 | 
					  class { 'swift::storage':
 | 
				
			||||||
    storage_local_net_ip => $storage_local_net_ip,
 | 
					    storage_local_net_ip => $storage_local_net_ip,
 | 
				
			||||||
 | 
					    rsync_use_xinetd     => $rsync_use_xinetd,
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Swift::Storage::Server {
 | 
					  Swift::Storage::Server {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					features:
 | 
				
			||||||
 | 
					  - |
 | 
				
			||||||
 | 
					    The new rsync_use_xinetd parameter has been added to the following classes,
 | 
				
			||||||
 | 
					    to add the ability to enable/disable usage of xinetd to run rsync server.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - ``swift::ringserver``
 | 
				
			||||||
 | 
					    - ``swift::storage::all``
 | 
				
			||||||
@@ -4,6 +4,13 @@ require 'spec_helper'
 | 
				
			|||||||
WebMock.disable_net_connect!(:allow => "169.254.169.254")
 | 
					WebMock.disable_net_connect!(:allow => "169.254.169.254")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe 'swift::ringserver' do
 | 
					describe 'swift::ringserver' do
 | 
				
			||||||
 | 
					  let :params do
 | 
				
			||||||
 | 
					    { :local_net_ip      => '127.0.0.1',
 | 
				
			||||||
 | 
					      :max_connections   => 5,
 | 
				
			||||||
 | 
					      :rsync_use_xinetd  => true,
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  shared_examples 'swift::ringserver' do
 | 
					  shared_examples 'swift::ringserver' do
 | 
				
			||||||
    context 'when storage.pp was already included' do
 | 
					    context 'when storage.pp was already included' do
 | 
				
			||||||
      let :pre_condition do
 | 
					      let :pre_condition do
 | 
				
			||||||
@@ -12,13 +19,6 @@ describe 'swift::ringserver' do
 | 
				
			|||||||
         include swift::ringbuilder"
 | 
					         include swift::ringbuilder"
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      let :params do
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          :local_net_ip    => '127.0.0.1',
 | 
					 | 
				
			||||||
          :max_connections => 5
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      it 'does not create the rsync::server class' do
 | 
					      it 'does not create the rsync::server class' do
 | 
				
			||||||
        is_expected.to compile
 | 
					        is_expected.to compile
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
@@ -41,13 +41,6 @@ describe 'swift::ringserver' do
 | 
				
			|||||||
         include swift::ringbuilder"
 | 
					         include swift::ringbuilder"
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      let :params do
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          :local_net_ip    => '127.0.0.1',
 | 
					 | 
				
			||||||
          :max_connections => 5
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      it 'does create the rsync::server class' do
 | 
					      it 'does create the rsync::server class' do
 | 
				
			||||||
        is_expected.to contain_class('rsync::server').with({
 | 
					        is_expected.to contain_class('rsync::server').with({
 | 
				
			||||||
          'use_xinetd' => 'true',
 | 
					          'use_xinetd' => 'true',
 | 
				
			||||||
@@ -77,7 +70,7 @@ describe 'swift::ringserver' do
 | 
				
			|||||||
        facts.merge(OSDefaults.get_facts())
 | 
					        facts.merge(OSDefaults.get_facts())
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it_configures 'swift::ringserver'
 | 
					      it_behaves_like 'swift::ringserver'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user