Automating Rubrik with vRealize Orchestrator Part 1: Introduction

Rubrik_Lab2

After seeing Rubrik be unveiled at VFD5 this year, a lot of us were very excited to get our hands on the gear. We were impressed by the simplicity and easy access to REST APIs which meant this was another product which deserves some VMware vRO Workflow attention.

Working with my colleague Eric Shanks, along with Chris Wahl at Rubrik, we decided to build a vRO workflow package to automate some of the key tasks. Thankfully our Backup specialist John Affatati already had an appliance racked in the Ahead lab and we were able to get up and running quickly!

Eric and I split the work up, and as such this is a co-blogger series. For information on where to get the workflows and how to get them up and running, you will find those posts here on Systems Game. For a deeper dive into how the REST calls were created, Eric is posting those on his blog at www.theithollow.com.

So let’s begin!

For starters. Make sure you go over to FlowGrab and download our vRO workflow package we published. This contains all of the workflows/actions/configuration elements which will be discussed in the series. All of the code is provided Open Source and is freely available for you to modify.

The series, and workflows are broken down into the following posts:

  1. Introduction – This post
  2. vRO REST Configuration for Rubrik
  3. vRO Workflow: Authenticate with Rubrik
  4. vRO Workflow: Get Rubrik VM information
  5. vRO Workflow: Get Rubrik SLA Domain IDs
  6. vRO Workflow: Assign SLA Domain to Virtual Machine

Following the conclusion of Part 6, I will then show how you can integrate this into vRealize Automation (or any Cloud catalog), so that you can give your users a backup choice when they are requesting new virtual machines.

rubrikvra

Enjoy, and as always please provide Eric and I as much feedback as possible.

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.

 

 

 

 

Automating Tintri with vRO Part 4: Create Tintri Snapshot on VMware Virtual Machine

In this section I’m going to walk through utilizing the workflow I created to initiate a Tintri Snapshot on your Virtual Machine.

Pre Requisites:

1. Completed Part 3 verifying that you can get a Tintri UUID from a virtual machine.
2. Have a Virtual Machine in vCenter which is running on the Tintri VM Store.
3. Import the latest Tintri Workflow Package I created and uploaded to FlowGrab.

The Tintri Snapshot

It would take far too long to go into all the details of snapshots and how they work, so instead I’m going to refer you to this PDF from Tintri. This gives a detailed overview.

However, to be a little more clear, the workflow we are executing here is going to complete the equivalent of selecting a VM in the Tintri GUI and selecting “Take snapshot…” as shown in the image below.

snapui1

 

Note, that these snapshots will NOT appear in the vSphere client UI. This is expected.

If we want to view all the Tintri snapshots upon the VM, we can also select “View snapshots”, and the list will be displayed.

snapui2

 

Executing the snapshots with vRO

So we have a great feature within Tintri, but we don’t really want to go to the Tintri UI every time. By having the vRO workflow, we can execute them directly from within vCenter or as a Day 2 action within vRealize Automation.

Step 1: Import the latest package from FlowGrab

After importing the package you should see some additional vRO workflows and actions.

vROflowgrab

vROflowgrabActions

As you can see there are 2 SnapVM workflows. The “FG-Tintri-SnapVM” workflow just encapsulates the action “tintriSnapVMfromUUID”. The 2nd workflow “FG-Tintri-GetUUIDandSnapVM” combines all the workflows from Parts 2 and 3 to create the REST session and get the Tintri UUID. As a general rule I try always create the “lego brick” workflow, and then create a larger workflow to wrap all the pieces I need. I include them both, as there may be creative workflows you want to create and need to do multiple snaps etc.

vROflowgrabSchema

Step 2: Run the workflow

Run the vRO workflow and put in your REST Host, VM, and Snapshot name.

snapVMinputs

Check the logs to verify you received a successful snapshot creation.

snaplogs

The number that is returned at the end is actually the Snapshot UUID from Tintri. If you login to Tintri you should see your snapshot listed in the GUI.

snapVMvROUIresultIn addition if you browse to “https://YourTintriIP/api/v310/vm” you will see this listed as the current latest snapshot for your virtual machine.

snapshotID-JSONThat’s it. You can now successfully Tintri snapshot your VMware Virtual Machines using vRO! At the end of the series I’ll be showing how to add these to vRealize Automation as Day 2 Actions.

What’s next…

Part 5: Automating Tintri Sync VM with vRO – Expected June 2nd

 

 

 

 

Automating Tintri with vRO Part 3: Get UUID from VMware Virtual Machine

In this section I’m going to walk through utilizing the workflow I created to get the Tintri UUID from a VMware Virtual Machine.

Why do I need this workflow?

In order for us to be able to perform any actions against VMs from the Tintri perspective, we need to know the UUID of the VM. This workflow allows us to get it.

Pre Requisites:

1. Completed Part 2 verifying that you can create a session to your Tintri VM Store and are able to return a JSESSION ID.
2. Have a Virtual Machine in vCenter which is running on the Tintri VM Store you tested in Part 2.
3. Import the latest Tintri Workflow Package I created and uploaded to FlowGrab.

What is the Tintri UUID?

The Tintri UUID is the unique object identifier for which we need to reference when performing any Tintri operations against the Virtual Machine. This is how Tintri sees the virtual machine as opposed to VMware which uses the Managed Object Reference for the vCenter object.

For example, in VMware we have this VM:

demovm

If we look in vRealize Orchestrator, you can see that the Managed object reference for this VM is:

demovmvRO

In Tintri we have the same VM

demovmTintri

If we take it a step further and look at the Tintri API in your browser, you will see that Tintri has both values for the VM. The VM MOR, and the Tintri UUID. Our goal here is to get the Tintri UUID, so we can perform REST operations against it, like Snapshot, Replication, and Sync VM which are in the next set of posts.

tintriuuid

Step 1: Import the package you downloaded from FlowGrab

Once imported you should see some additional vRO workflows, and Actions.

newworkflows

Step 2: Take a peak inside the workflows

If you look in the workflow for Tintri-Session and Get UUID you will notice that this workflow includes the workflow from Part 2a for Creating the session as well as the other workflow we just imported.

sessionuuidworkflow

We first run the Create Session workflow, store the JSESSIONID as a general attribute, and then run the GetUUID fromVM workflow using the JSESSIONID we stored from the previous workflow.

visualbinding1

 

visualbinding2

Step 3: Run the workflow

Run the workflow and select a Virtual Machine.

runworkflow1

Check the logs and make a note of the MOR and UUID.

workflowrunlogs

Take a look in vRO at the VM from the inventory view and should see the Managed object reference matches the VM you selected.

Take a look in the Tintri API from your browser, and do a search for the MOR. You should see the matching Tintri UUID there as well.

What now…

Now we are able to successfully get the UUID, we can start to perform Tintri actions upon the VM using vRO. In the next part of the series we will be going through executing a Tintri Snapshot on the VM.

Part 4: vRO workflow: Tintri Snapshot a Virtual Machine – coming Tuesday May 26.

 

Checking for VM Memory Limits

Here is a quick one liner I found to check for any VMs which had memory limits set on them:

Get-VM | Get-VMResourceConfiguration | where {$_.MemlimitMB -ne -1}

If you want to target a specific cluster, just add Get-Cluster “clustername” to the beginning:

Get-Cluster “Clustername” | Get-VM | Get-VMResourceConfiguration | where {$_.MemlimitMB -ne -1}

Now if you want to get rid of the memory limits, add the following:

Set-VMResourceConfiguration -MemlimitMB $null

Final script for all VMs to find and remove limits:

Get-VM | Get-VMResourceConfiguration | where {$_.MemlimitMB -ne -1} | Set-VMResourceConfiguration -MemlimitMB $null

Next step…setting this as a scheduled workflow in Orchestrator to run every night/week and send a report out of any limits discovered.