Skip to content

Instantly share code, notes, and snippets.

@marcaurele
Last active June 24, 2016 08:28
Show Gist options
  • Save marcaurele/74995960e378e7c2b538915eb46b6bbf to your computer and use it in GitHub Desktop.
Save marcaurele/74995960e378e7c2b538915eb46b6bbf to your computer and use it in GitHub Desktop.
Graceful MS shutdown for Cloudstack

Graceful shutdown of Management Server for Cloudstack

Idea

The goal is to provide a safe shutdown of a management server when running in cluster mode, so that the server stops processing new commands and waits for ongoing commands before being "ready to stop". Then the MS should be in a clean state for a shutdown. A little requirement is that the proxy in front of the management servers should have its route to the server going down turned off to avoid routing reconnection to the stopping server.

  • add a API call to request a graceful shutdown of a MS, which will not be received by a different MS (Since the proxy will not direct this call to the corresponding MS)

  • add a new flag for the MS state with value STOPPING

  • inform the clusterManager that it is going down

  • check ongoing jobs that have a return path to the management server and wait for them to come

  • disconnect from agents without pending jobs, and disconnect from the other as soon as the job answer has arrived.

  • stop all local threads executors (stop picking up new async job)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment