ha/glance-fs: avoid a race condition
authorEmilien Macchi <emilien@redhat.com>
Mon, 28 Mar 2016 20:09:20 +0000 (16:09 -0400)
committerEmilien Macchi <emilien@redhat.com>
Thu, 7 Apr 2016 20:28:08 +0000 (20:28 +0000)
Create the glance-fs Pacemaker resource on one node (pacemaker master)
instead of all nodes, and set verify_on_create to True.

* It will avoid a race condition if Puppet is applied on 2 nodes on the
  same time, so the filesystem is attempted to be created once.
* Verify with psc that the resource has been correctly created.

The full context of the bug is decribed here:
https://bugzilla.redhat.com/show_bug.cgi?id=1319384

Change-Id: I625f0879ae56e814664d1433ae47e27148779f12

puppet/manifests/overcloud_controller_pacemaker.pp

index 5417623..5a5028e 100644 (file)
@@ -654,17 +654,6 @@ if hiera('step') >= 4 {
   $http_store = ['glance.store.http.Store']
   $glance_store = concat($http_store, $backend_store)
 
-  if $glance_backend == 'file' and hiera('glance_file_pcmk_manage', false) {
-    $secontext = 'context="system_u:object_r:glance_var_lib_t:s0"'
-    pacemaker::resource::filesystem { 'glance-fs':
-      device       => hiera('glance_file_pcmk_device'),
-      directory    => hiera('glance_file_pcmk_directory'),
-      fstype       => hiera('glance_file_pcmk_fstype'),
-      fsoptions    => join([$secontext, hiera('glance_file_pcmk_options', '')],','),
-      clone_params => '',
-    }
-  }
-
   # TODO: notifications, scrubber, etc.
   include ::glance
   include ::glance::config
@@ -1340,6 +1329,18 @@ if hiera('step') >= 5 {
     }
 
     # Glance
+    if $glance_backend == 'file' and hiera('glance_file_pcmk_manage', false) {
+      $secontext = 'context="system_u:object_r:glance_var_lib_t:s0"'
+      pacemaker::resource::filesystem { 'glance-fs':
+        device           => hiera('glance_file_pcmk_device'),
+        directory        => hiera('glance_file_pcmk_directory'),
+        fstype           => hiera('glance_file_pcmk_fstype'),
+        fsoptions        => join([$secontext, hiera('glance_file_pcmk_options', '')],','),
+        verify_on_create => true,
+        clone_params     => '',
+      }
+    }
+
     pacemaker::resource::service { $::glance::params::registry_service_name :
       clone_params => 'interleave=true',
       require      => Pacemaker::Resource::Ocf['openstack-core'],