Make sure openstack services are dependent on openstack-core
authorJiri Stransky <jistr@redhat.com>
Tue, 12 Apr 2016 11:45:17 +0000 (13:45 +0200)
committerJiri Stransky <jistr@redhat.com>
Wed, 13 Apr 2016 11:19:37 +0000 (13:19 +0200)
Previously ceilometer-notification, aodh-listener and sahara-engine
didn't have constraints that would anchor them under openstack-core
dummy resource. Such constraints are added now. (sahara-engine starting
after sahara-api, aodh-listener after aodh-evaluator, and
ceilometer-notification after openstack-core.) Openstack-core ->
heat-api constraint has been removed because heat-api depends on
ceilometer-notification, so there's a transitive dependency on
openstack-core already.

Change-Id: Ided7321ebbf2c3556726343b4bb466fd8759b43a
Closes-Bug: #1569444

extraconfig/tasks/major_upgrade_pacemaker_migrations.sh
puppet/manifests/overcloud_controller_pacemaker.pp

index 1f420b3..b63198d 100644 (file)
 # been already applied, it should be possible to call the function
 # again without damaging the deployment or failing the upgrade.
 
+function add_missing_openstack_core_constraints {
+    # The CIBs are saved under /root as they might contain sensitive data
+    CIB="/root/migration.cib"
+    CIB_BACKUP="/root/backup.cib"
+    CIB_PUSH_NEEDED=n
+
+    rm -f "$CIB" "$CIB_BACKUP" || /bin/true
+    pcs cluster cib "$CIB"
+    cp "$CIB" "$CIB_BACKUP"
+
+    if ! pcs -f "$CIB" constraint --full | grep 'start openstack-sahara-api-clone then start openstack-sahara-engine-clone'; then
+        pcs -f "$CIB" constraint order start openstack-sahara-api-clone then start openstack-sahara-engine-clone
+        CIB_PUSH_NEEDED=y
+    fi
+
+    if ! pcs -f "$CIB" constraint --full | grep 'start openstack-core-clone then start openstack-ceilometer-notification-clone'; then
+        pcs -f "$CIB" constraint order start openstack-core-clone then start openstack-ceilometer-notification-clone
+        CIB_PUSH_NEEDED=y
+    fi
+
+    if ! pcs -f "$CIB" constraint --full | grep 'start openstack-aodh-evaluator-clone then start openstack-aodh-listener-clone'; then
+        pcs -f "$CIB" constraint order start openstack-aodh-evaluator-clone then start openstack-aodh-listener-clone
+        CIB_PUSH_NEEDED=y
+    fi
+
+    if pcs -f "$CIB" constraint --full | grep 'start openstack-core-clone then start openstack-heat-api-clone'; then
+        CID=$(pcs -f "$CIB" constraint --full | grep 'start openstack-core-clone then start openstack-heat-api-clone' | sed -e 's/.*id\://g' -e 's/)//g')
+        pcs -f "$CIB" constraint remove $CID
+        CIB_PUSH_NEEDED=y
+    fi
+
+    if [ "$CIB_PUSH_NEEDED" = 'y' ]; then
+        pcs cluster cib-push "$CIB"
+    fi
+}
+
 function remove_ceilometer_alarm {
     if pcs status | grep openstack-ceilometer-alarm; then
         # Disable pacemaker resources for ceilometer-alarms
index 5a5028e..7db3f01 100644 (file)
@@ -1327,6 +1327,15 @@ if hiera('step') >= 5 {
       require         => [Pacemaker::Resource::Service[$::sahara::params::api_service_name],
                           Pacemaker::Resource::Ocf['openstack-core']],
     }
+    pacemaker::constraint::base { 'sahara-api-then-sahara-engine-constraint':
+      constraint_type => 'order',
+      first_resource  => "${::sahara::params::api_service_name}-clone",
+      second_resource => "${::sahara::params::engine_service_name}-clone",
+      first_action    => 'start',
+      second_action   => 'start',
+      require         => [Pacemaker::Resource::Service[$::sahara::params::api_service_name],
+                          Pacemaker::Resource::Service[$::sahara::params::engine_service_name]],
+    }
 
     # Glance
     if $glance_backend == 'file' and hiera('glance_file_pcmk_manage', false) {
@@ -1743,6 +1752,15 @@ if hiera('step') >= 5 {
       require         => [Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name],
                           Pacemaker::Resource::Ocf['openstack-core']],
     }
+    pacemaker::constraint::base { 'keystone-then-ceilometer-notification-constraint':
+      constraint_type => 'order',
+      first_resource  => 'openstack-core-clone',
+      second_resource => "${::ceilometer::params::agent_notification_service_name}-clone",
+      first_action    => 'start',
+      second_action   => 'start',
+      require         => [Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name],
+                          Pacemaker::Resource::Ocf['openstack-core']],
+    }
     pacemaker::constraint::base { 'ceilometer-central-then-ceilometer-collector-constraint':
       constraint_type => 'order',
       first_resource  => "${::ceilometer::params::agent_central_service_name}-clone",
@@ -1826,6 +1844,15 @@ if hiera('step') >= 5 {
       require => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
                   Pacemaker::Resource::Service[$::aodh::params::notifier_service_name]],
     }
+    pacemaker::constraint::base { 'aodh-evaluator-then-aodh-listener-constraint':
+      constraint_type => 'order',
+      first_resource  => "${::aodh::params::evaluator_service_name}-clone",
+      second_resource => "${::aodh::params::listener_service_name}-clone",
+      first_action    => 'start',
+      second_action   => 'start',
+      require         => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
+                          Pacemaker::Resource::Service[$::aodh::params::listener_service_name]],
+    }
     pacemaker::constraint::colocation { 'aodh-listener-with-aodh-evaluator-colocation':
       source  => "${::aodh::params::listener_service_name}-clone",
       target  => "${::aodh::params::evaluator_service_name}-clone",
@@ -1858,15 +1885,6 @@ if hiera('step') >= 5 {
     pacemaker::resource::service { $::heat::params::engine_service_name :
       clone_params => 'interleave=true',
     }
-    pacemaker::constraint::base { 'keystone-then-heat-api-constraint':
-      constraint_type => 'order',
-      first_resource  => 'openstack-core-clone',
-      second_resource => "${::heat::params::api_service_name}-clone",
-      first_action    => 'start',
-      second_action   => 'start',
-      require         => [Pacemaker::Resource::Service[$::heat::params::api_service_name],
-                          Pacemaker::Resource::Ocf['openstack-core']],
-    }
     pacemaker::constraint::base { 'heat-api-then-heat-api-cfn-constraint':
       constraint_type => 'order',
       first_resource  => "${::heat::params::api_service_name}-clone",