diff --git a/node/lib/openshift-origin-node/model/application_container_ext/snapshots.rb b/node/lib/openshift-origin-node/model/application_container_ext/snapshots.rb index 8edf852341a..ea9e7c2cc77 100644 --- a/node/lib/openshift-origin-node/model/application_container_ext/snapshots.rb +++ b/node/lib/openshift-origin-node/model/application_container_ext/snapshots.rb @@ -206,7 +206,11 @@ def restore(restore_git_repo, report_deployment) # Revert to the pre-restore state of the currently restored gear # if @state.value != pre_restore_state - (@state.value != State::STARTED) ? start_gear : stop_gear + if (@state.value != State::STARTED) + start_gear + else + scalable_restore ? post_restore_stop_gears(gear_groups, gear_env) : stop_gear + end end result[:status] = RESULT_SUCCESS @@ -311,6 +315,14 @@ def handle_scalable_restore(gear_groups, gear_env) expected_exitstatus: 0) end end + + def post_restore_stop_gears(gear_groups, gear_env) + $stderr.puts "Stopping gears after restore " + gear_groups['data'][0]['gears'].each do |gear| + ssh_coords = gear['ssh_url'].sub(/^ssh:\/\//, '') + run_in_container_context("#{::OpenShift::Runtime::ApplicationContainer::GEAR_TO_GEAR_SSH} #{ssh_coords} 'gear stop'", env: gear_env ) + end + end end end end