Automation–Orchestrator Runbook Spotlight–Virtual Machine Startup by Priority

Hello Readers/Viewers!

Today we are going to take an in depth look at a specific example Runbook – Virtual Machine Startup by Priority

Use Case:

Ability to query Virtual Machine Manager for Virtual Machines (for more than 1 Virtual Machine) within a Cloud, then start up those Virtual Machines in a specified order (often used in Disaster Recovery Scenarios, like this one: Automation–Orchestrating Hyper-V Replica with System Center for Planned Failover).

Components leveraged in this example:

  • System Center 2012 SP1 - Orchestrator
  • System Center 2012 SP1 - Virtual Machine Manager
  • System Center 2012 SP1 - Orchestrator Integration Pack for VMM
  • Windows Server 2012 with Hyper-V
  • Windows PowerShell

Example Solution Theory:

  • Create two Orchestrator Runbooks:
    • Runbook 1: To query Virtual Machine Manager through the Integration Pack for VMM;
    • Runbook 2: To process the startup actions for each VM
  • High Level Logic and Flow:
    • Virtual Machine data would be passed from Runbook 1 to Runbook 2 (Sub-Runbook)
    • Priority is configured and determined by the “Delayed Start Time” setting
    • Startup actions are dependent on the “Delayed Start Time (s)” for each VM
  • Runbook 1 Special Logic Used:
    • Junction: Merge two paths, Wait for individual “streams” of data (from both paths), Republish “Cloud Name” for “Complete” Notification, Collapse Multi-Value Data coming from the “Get VMs” path so that subsequent activities only execute once
    • Get VM Status Flatten and Loop: Flatten Multi-Value Data with Delimiter, Loop Until all VMs are in a “Running” state (or at least not in “Starting” or “Stopped” state – other non-Running states can be added as well)
  • Runbook 2 (the Sub-Runbook) is configured to execute concurrently (for as many VMs are in the Cloud)
    • If the “Delayed Start Time (s)” settings for all VMs in the Cloud are set to “0”, then all VMs will start up at the same time.
    • Staggered “Delayed  Start Time (s)” settings for each VM will allow them to start up in a specific order

Example Solution Execution:

Runbook 1:

image

Runbook 2:

image

Example Solution Runbook Download:

Click here for the TechNet Gallery Contribution for these Example Runbooks!

Notes on Importing the Example Runbooks:

  1. Download the VM_Startup_by_Priority_Example_Runbooks_20130619.ois_export File
  2. Create a New Folder and Import the VM_Startup_by_Priority_Example_Runbooks_20130619.ois_export File into Orchestrator
    (recommended settings)
    image
  3. Ensure that a VMM Connection is created with the name of “SC2012SP1 VMM Connection
    (this is the name of what the existing VMM Activities are configured to use for the export)
    image
    image

Example Solution Runbook Activity Screen Captures:

Runbook 1:

Initiate VM Start by Priority:

image

Get VMs:

image

Invoke Start VMs:

image

Junction:

image

Get VM Status:

image

Get VM Status – Looping (General Tab):

image

Get VM Status – Looping (Exit Tab):

image

Get VM Status – Looping (Do Not Exit Tab):

image

Send Platform Event (Complete):

image

Runbook 2:

Initiate VM Start:

image

Run .Net Script (Delay Start by Priority):

image

Start VM:

image

Return Data (Return VM Status):

image

Runbook 2 (0.2 VM Startup by Priority Example - Start VMs) – Job Concurrency Settings:

image

Example Solution VM Delay Start Up (seconds) Configuration Screen Captures (from VMM Console):

VM - spftest03 (Priority 3):

image

VM - spftest02 (Priority 2)

image

VM - spftest01 (Priority 1)

image


For more information and tips/tricks for Orchestrator, be sure to watch for blog posts in the Automation Track!

enJOY!