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.
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:
Runbook 2:
Example Solution Runbook Download:
Click here for the TechNet Gallery Contribution for these Example Runbooks!
Notes on Importing the Example Runbooks:
- Download the VM_Startup_by_Priority_Example_Runbooks_20130619.ois_export File
- Create a New Folder and Import the VM_Startup_by_Priority_Example_Runbooks_20130619.ois_export File into Orchestrator
(recommended settings) - 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)
Example Solution Runbook Activity Screen Captures:
Runbook 1:
Initiate VM Start by Priority:
Get VMs:
Invoke Start VMs:
Junction:
Get VM Status:
Get VM Status – Looping (General Tab):
Get VM Status – Looping (Exit Tab):
Get VM Status – Looping (Do Not Exit Tab):
Send Platform Event (Complete):
Runbook 2:
Initiate VM Start:
Run .Net Script (Delay Start by Priority):
Start VM:
Return Data (Return VM Status):
Runbook 2 (0.2 VM Startup by Priority Example - Start VMs) – Job Concurrency Settings:
Example Solution VM Delay Start Up (seconds) Configuration Screen Captures (from VMM Console):
VM - spftest03 (Priority 3):
VM - spftest02 (Priority 2)
VM - spftest01 (Priority 1)
For more information and tips/tricks for Orchestrator, be sure to watch for blog posts in the Automation Track!
enJOY!