Automating Tintri with vRO Part 5a: Sync VM

What is Sync VM?

Every now and then a technology on a storage array gets me really excited. When Adam Cavaliere showed me Sync VM last month I was impressed. After talking about it and showing it to customers, they were very interested. More specifically they wanted to see it automated, and in vRealize Automation.

So what is it, and how does it work?

I think it’s best explained by Adam Cavaliere and Emad Younis who have posts and videos on this already.

Video showing Database Example: https://www.youtube.com/watch?v=bWsVLUb9O_A

Blog post by Emad Younis: https://www.tintri.com/blog/2015/04/tech-tuesday-time-travel-syncvm-snapshots

The vRealize Orchestrator Workflow

In this part (5a), I will explain how to use the vRO workflow I’ve created which is available on FlowGrab along with the others in this series. In part 5b I will be showing how to integrate this vRO workflow with vRA, to offer it as a day 2 operation.

Pre Requisites:

1. Completed Part 3 verifying that you can get a Tintri UUID from a virtual machine.
2. Have a source and target virtual machine in vCenter with the same disk configuration upon which you want to sync.
3. Download the latest Tintri Workflow Package I created and uploaded to FlowGrab.

Important!

Do not execute this vRO workflow without an understanding of SyncVM. The code in this example replaces 3 disks (SCSI 0:1, SCSI 0:2, SCSI 0:3 to be precise). If you need to use alternate disk configurations, then you will need to adjust the parameters and action item to compensate. Please post questions if you are unsure how to do this, but this assumes a good understanding of vRealize Orchestrator.

Step 1: Import the Tintri Workflow Package you downloaded from FlowGrab.

You should now see extra workflows in your vRO Design view as per the screenshot below.

syncvmwflows

Take a look at FG-SyncVMExample you can see this utilizes a number of the other workflows previously created.
Sync VM Example

SyncVMInputs

Running FG-Tintri-SyncVM by itself, you can see this requires the RestHost, SessionID, and a snapshot UUID from the source VM, as well as the Tintri VM UUID from the target VM.

In FG-SyncVMExample I use the modular components built previously to retrieve all the information required to initiate a Sync VM operation.

The process is as follows:

  1. Create Rest Session
  2. Tintri Snapshot the Source VM in order to get the latest data.
    1. Get the Tintri VM UUID
    2. Snapshot the VM
    3. Get the Snapshot UUID for the latest snapshot
  3. Get the Tintri VM UUID for the target VM
  4. Shutdown the Guest OS (This is because if you initiate a sync VM via REST API it will do a hard power off of the virtual machine.)
  5. Initiate SyncVM now that we have the UUIDs we needed.
  6. Power back on the target VM.

Step 2: Run the workflow!

Exampleinputsforsyncvm

Select your REST Host, type in a sample name for the snapshot (this could obviously be set as a general attribute or automatically generated in the future), select your source VM and target VM from vCenter…and off we go!

Step 3: End Result

Login to your Tintri VM Store and you should see a message on the target VM indicating that synchronization is complete.

Screen Shot 2015-06-23 at 3.43.37 PM

vRealize Orchestrator will also show logging to indicate the Sync VM operation was successful.

vrologsyncvm

What’s next?

Hopefully this workflow helps. I would recommend adapting the actions and workflow to your use cases. i.e. which disks to sync? How many VMs do you want to sync to?

In the next post I’ll be demonstrating how you can add this capability to vRealize Automation as a Day 2 Operation you can present to Software Development and QA teams in order to get the latest data.

 

 

 

 

How to correlate Windows Disks with VMDKs

This post comes from a colleague of mine who couldn’t find a great resource on how to correlate the Windows Disk in Disk Management, with the Virtual Disk presented by VMware.

When all the disks are different sizes it is easy, but sometimes they are the same…how can you be sure you are expanding the right disk?

These instructions/steps should allow you to correlate Windows Disks to VMDK Disks.

  1. RDP  to the Windows server in question and run this powershell script
Get-WmiObject Win32_DiskDrive | select-object DeviceID,{$_.size/1024/1024/1024},scsiport,scsibus,scsitargetid,scsilogicalunit | out-file -FilePath c:\OutputPhysicalDrive.txt

This script should allow you to match the OS disks to the VMDK Disks. The output will be referenced in later steps.

Example output

DeviceID : \\.\PHYSICALDRIVE3
$_.size/1024/1024/1024 : 9.99680757522583
scsiport : 3
scsibus : 0
scsitargetid : 0
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE6
$_.size/1024/1024/1024 : 49.9993586540222
scsiport : 5
scsibus : 0
scsitargetid : 1
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE4
$_.size/1024/1024/1024 : 19.9936151504517
scsiport : 4
scsibus : 0
scsitargetid : 0
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE0
$_.size/1024/1024/1024 : 59.996166229248
scsiport : 2
scsibus : 0
scsitargetid : 0
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE1
$_.size/1024/1024/1024 : 19.9936151504517
scsiport : 2
scsibus : 0
scsitargetid : 1
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE2
$_.size/1024/1024/1024 : 19.9936151504517
scsiport : 2
scsibus : 0
scsitargetid : 2
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE5
$_.size/1024/1024/1024 : 49.9993586540222
scsiport : 5
scsibus : 0
scsitargetid : 0
scsilogicalunit : 0

The second step is to get a list of your VMDK disk information by editing the virtual machine in question. 

The information you will be retrieving is the
Disk Name: “Hard disk 1”
Size: “60 GB”
Bus ID: 0
Disk ID: 0

SCSI (X:Y) Hard Disk under Virtual Device Node. The X:Y values are:

X = Bus ID
Y = Disk ID

Enter the Disk information for all VMDK disks into a table like the one below:

Reference OutputPhysicalDrive.txt and match up any OS disks to VMDK disk that have a unique size.

For the non unique drives you will need to match the Windows disk scsitargetid with the VMDK Disk ID.

The first 2 in the example below are both 50GB Drives.

DeviceID : \\.\PHYSICALDRIVE6
$_.size/1024/1024/1024 : 49.9993586540222
scsiport : 5
scsibus : 0
scsitargetid : 1
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE5
$_.size/1024/1024/1024 : 49.9993586540222
scsiport : 5
scsibus : 0
scsitargetid : 0
scsilogicalunit : 0

The next 3 are all 20GB drives.

DeviceID : \\.\PHYSICALDRIVE2
$_.size/1024/1024/1024 : 19.9936151504517
scsiport : 2
scsibus : 0
scsitargetid : 2

DeviceID : \\.\PHYSICALDRIVE1
$_.size/1024/1024/1024 : 19.9936151504517
scsiport : 2
scsibus : 0
scsitargetid : 1
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE4
$_.size/1024/1024/1024 : 19.9936151504517
scsiport : 4
scsibus : 0
scsitargetid : 0
scsilogicalunit : 0

As you see following the steps above will allow you to correlate the OS disks to the VMDK Disks.

Thank you vRad for this great guide!