From 2ab7c95205af43aea1ee6a02eb51cc98d9c02953 Mon Sep 17 00:00:00 2001 From: Andrey Shestakov Date: Fri, 25 Mar 2016 13:28:29 +0200 Subject: [PATCH] Add RadosGW readiness check After radosgw service start it requires some time to get operational state This change introduces check script which waits until radosgw start to serve http requests. Change-Id: Iaeb3f60c0da114de1fea3f0ec3aa69acd05b037a Closes-bug: #1545651 (cherry picked from commit 3d159974341211ffa90045e9f0cc3b819f212f3e) --- .../manifests/ceph/enable_rados.pp | 24 ++++++++++++++++++- .../noop/spec/hosts/ceph/enable_rados_spec.rb | 16 ++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/deployment/puppet/osnailyfacter/manifests/ceph/enable_rados.pp b/deployment/puppet/osnailyfacter/manifests/ceph/enable_rados.pp index 23dc89d059..004fb93530 100644 --- a/deployment/puppet/osnailyfacter/manifests/ceph/enable_rados.pp +++ b/deployment/puppet/osnailyfacter/manifests/ceph/enable_rados.pp @@ -2,6 +2,10 @@ class osnailyfacter::ceph::enable_rados { notice('MODULAR: ceph/enable_rados.pp') + $management_vip = hiera('management_vip', '') + $service_endpoint = hiera('service_endpoint', '') + $ssl_hash = hiera_hash('use_ssl', {}) + include ::ceph::params $radosgw_service = $::ceph::params::service_radosgw @@ -30,13 +34,31 @@ class osnailyfacter::ceph::enable_rados { Service['radosgw'] -> File[$radosgw_override_file] ~> - Service['radosgw-all'] + Service['radosgw-all'] -> + ::Osnailyfacter::Wait_for_backend['object-storage'] } else { service { $radosgw_service: ensure => running, enable => true, } + + Service[$radosgw_service] -> ::Osnailyfacter::Wait_for_backend['object-storage'] } + $rgw_protocol = get_ssl_property($ssl_hash, {}, 'radosgw', 'internal', 'protocol', 'http') + $rgw_address = get_ssl_property($ssl_hash, {}, 'radosgw', 'internal', 'hostname', [$service_endpoint, $management_vip]) + $rgw_url = "${rgw_protocol}://${rgw_address}:8080" + + $lb_hash = { + 'object-storage' => { + name => 'object-storage', + provider => 'http', + url => $rgw_url + } + } + + ::osnailyfacter::wait_for_backend {'object-storage': + lb_hash => $lb_hash + } } diff --git a/tests/noop/spec/hosts/ceph/enable_rados_spec.rb b/tests/noop/spec/hosts/ceph/enable_rados_spec.rb index decd2fb389..337fb12ae7 100644 --- a/tests/noop/spec/hosts/ceph/enable_rados_spec.rb +++ b/tests/noop/spec/hosts/ceph/enable_rados_spec.rb @@ -13,7 +13,7 @@ manifest = 'ceph/enable_rados.pp' describe manifest do shared_examples 'catalog' do - it "should contain radowgw service" do + it "should contain radosgw service" do if facts[:operatingsystem] == 'Ubuntu' should contain_service('radosgw').with( @@ -46,6 +46,20 @@ describe manifest do ) end end + + it "should wait until radosgw get ready" do + ssl_hash = Noop.hiera_hash('use_ssl', {}) + service_endpoint = Noop.hiera('service_endpoint', '') + management_vip = Noop.hiera('management_vip', '') + rgw_protocol = Noop.puppet_function 'get_ssl_property', ssl_hash, {}, 'radosgw', 'internal', 'protocol', 'http' + rgw_address = Noop.puppet_function 'get_ssl_property', ssl_hash, {}, 'radosgw', 'internal', 'hostname', [service_endpoint, management_vip] + rgw_url = "#{rgw_protocol}://#{rgw_address}:8080" + + should contain_haproxy_backend_status('object-storage').with( + :url => rgw_url, + :provider => 'http' + ) + end end test_ubuntu_and_centos manifest