My Next Big Thing

The Infrastructure Years

For the last 5 years, I have had a front row seat to a major transformation of Information Technology. In 2008 I was hired as employee #9 into a visionary company called Bluelock. Bluelock was a new kind of service company, completely dedicated to Infrastructure as a Service, First coined on Wikipedia my friend and CTO, Pat O’Day. Bluelock’s datacenters did not focus on traditional colocation. Bluelock focused on providing pools of resources dedicated to a particular client in a highly available multi-tenant infrastructure made up of multiple VMware VI 3.5 clusters. These pools are now known as Virtual Datacenters, and now come in all different shapes and sizes. As a Systems Engineer and later Solutions Architect, my passion gravitated toward the needs for automation of the infrastructure, not so much about adding infrastructure faster, but removing the human error from the equation. Automation doesn’t stop at the provider layer either. You may notice most of the content on my blog is about consuming cloud, not providing it.

Bluelock has been an amazing journey for me, and I will miss the Bluelock family that I’ve been with all the way back to just our start-up days.

A few highlights from my Bluelock days include:

  • vCloud 1.0 Powershell module
  • vExpert award for 2010-2013
  • vCloud Organizations Course at TrainSignal
  • VMworld session: Bare metal to the Cloud, and Beyond with Alan Renouf and Eric Williams

 

Desired State

I’m excited to announce that I will be joining VMware in Dallas, Texas. It’s a big move for the Robinsons, but I am honored to say I will be working with Nick Weaver and an all-star lineup on the vCHS R&D team, who are building the next-generation of cloud infrastructure automation frameworks. This opportunity is an amazing trifecta of my passions in infrastructure, code, and automation. There will be lots of vCloud, Puppet and Razor in my future. I’m honored to be on the team and hope to share more very soon.

Important: If you are going to VMworld, be sure to attend Nick and Nan’s session on Cloud Automation and Project Zombie.

Thank you again to the VMware community for all the well-wishes and good lucks. Special thank you’s to my friends at Bluelock, and to my new friends at VMware (See you all soon :)).

 


VMware Tools reporting in vCloud with PowerCLI

When running VMs at a public cloud provider like Bluelock, it’s still important to maintain installations and proper versions of VMware Tools on your VMs. While some providers will make an effort to report this to you, others may leave the ball in your court. Thankfully, it’s a simple one-liner to report on VMware Tools in the cloud!

Get-CIVM | Select-Object name,vapp, @{n=“VMTools”; e={$_.ExtensionData.GetRuntimeInfoSection().VMWareTools.version}} Sort-Object vapp,name


Simple VM reporting in vCloud with PowerCLI

Because of the unique requirement of VMs to exist inside vApps in vCloud Director, it’s a challenge to get a nice view of all the VMs and their locations within your vCloud Organization. This can mostly be satisfied with a Get-CIVM command, which will return great info about your VMs, but it’s missing the storage assignment. Here’s a sweet little script to report specifically on the VM resources in use inside your vCloud Organization:


$vms = get-civm
$objects = @()

foreach($vm in $vms)
{
 $hardware = $vm.ExtensionData.GetVirtualHardwareSection()
 $diskMB = (($hardware.Item | where {$_.resourcetype.value -eq "17"}) | %{$_.hostresource[0].anyattr[0]."#text"} | Measure-Object -Sum).sum
 $row = New-Object PSObject -Property @{"vapp" = $vm.vapp; "name"=$vm.Name;"cpuCount"=$vm.CpuCount;"memoryGB"=$vm.MemoryGB;"storageGB"=($diskMB/1024)}
 $objects += $row
}

# Use select object to get the column order right. Sort by vApp. Force table formatting and auto-width.
$objects | select-Object name,vapp,cpuCount,memoryGB,storageGB | Sort-Object -Property vapp | Format-Table -AutoSize

You can easily export to a CSV by using Export-CSV or just run the report to get output that looks something like this:

VMreport


Setting Default VDSwitch security for vCloud with PowerCLI

Working as a public vCloud provider periodically gives me the opportunity to help clients that are running their own private vCloud. It’s a great side benefit to working with an experienced public vCloud provider in case you need some advanced help, or custom code/scripting!

In this case, my client needed to set default security permissions for all new VDPortgroups that were created by vCloud Director. This is different than setting security on a single portgroup. This sets the defaults for ALL portgroups created after the setting change! This is very handy when the network creation is out of our hands.😀

############################################

# Configuration Settings                   #

############################################

$switchName=“dvSwitch”

$promiscuous=$true

$forgedTransmits=$false

$macChanges=$false

 

###################################################

# Shouldn’t need to edit anything below this line #

###################################################

$dvSwitch Get-VDSwitch $switchname

$spec New-Object VMware.Vim.VMwareDVSConfigSpec

$spec.configVersion $dvswitch.ExtensionData.Config.ConfigVersion

$spec.DefaultPortConfig New-Object VMware.Vim.VMwareDVSPortSetting

$spec.DefaultPortConfig.SecurityPolicy New-Object VMware.Vim.DVSSecurityPolicy

$spec.DefaultPortConfig.SecurityPolicy.AllowPromiscuous New-Object VMware.Vim.BoolPolicy

$spec.DefaultPortConfig.SecurityPolicy.AllowPromiscuous.Value $promiscuous

 

$spec.DefaultPortConfig.SecurityPolicy.MacChanges New-ObjectVMware.Vim.BoolPolicy

$spec.DefaultPortConfig.SecurityPolicy.MacChanges.Value $macChanges

 

$spec.DefaultPortConfig.SecurityPolicy.ForgedTransmits New-Object VMware.Vim.BoolPolicy

$spec.DefaultPortConfig.SecurityPolicy.ForgedTransmits.Value $forgedTransmits

 

$dvswitch.ExtensionData.ReconfigureDvs_Task($spec)

I’ve written about getting around the missing dvPortgroup inheritance in the past, and there are also a couple good posts from Luc Dekens and Alan Renouf:

http://geekafterfive.com/2011/04/04/dvportgroup-inheritance/

http://www.lucd.info/2009/10/12/dvswitch-scripting-part-2-dvportgroup/

http://blogs.vmware.com/vipowershell/2011/11/vsphere-distributed-switch-powercli-cmdlets.html

Last but not least, special thanks to William Lam for pointing me to the right spot in the API.🙂


vCloud VM and VApp Backups with PowerCLI

vcloud backups

There are times when a snapshot doesn’t cut it, and asking the Backup Administrator or Cloud Provider to set up backups doesn’t make sense. Just a couple examples I’ve run into as a Cloud Provider:

  • Upgrades with testing could take longer than a snapshot should exist for.
  • Temporary workloads may need backups for “warm storage”

So where is the in-between? Wouldn’t it be great to hot clone a VM or VApp with some light scheduling and retention capabilities?

vCloudBackups is the Powershell module for doing this.

The vCloudBackups powershell module allows you to create local backups of VMs and vApps at any cloud provider running vCloud Director 1.5 or 5.1. By local, I mean the VMs and vApps will currently be cloned to the same storage the workloads are currently running on. If you don’t trust your SAN with this level of backup, you probably need to talk to you Backup Administrator or cloud provider for that off-site backup.🙂

How does it work?

Very simply, the module is just doing hot-clones of VMs or vApps through the vCloud API. When backing up just VMs, they are stored inside a vApp simply called ‘Backups.’ Each VM backup is named with the vApp origination, VM name, and a date/time of the backup.

VApp backups are simply just exact copies of the originals, except named titled as Backup with a date/time of the backup.

“Retention” is built into the module as a number to keep. The oldest will automatically be deleted.

Scheduling is accomplished through your Windows Task Scheduler and an included script called MyBackups.ps1. Credentials for your vCloud Director login are stored encrypted in a configuration file, meaning NO PLAIN TEXT PASSWORDS!

If you are interested in the vCloud Backups script, please contact me on Twitter, Google+, or the comments below.


vCloud 5.1 API Support in PowerCLI 5.1 R2

Quite a few people have been asking about vCloud 5.1 feature support in PowerCLI. Guess what: It’s here! PowerCLI 5.1 R2 has officially dropped, and the new vCloud 5.1 features are built in!

You will find all the new 5.1 API properties and methods in the .extensiondata of objects such as a VM returned by Get-CIVM. Snapshots come to mind as a frequent request. Here’s how to find them:

$vm=Get-CIVM “MyVM”

$vm.ExtensionData Get-Member

The .extensiondata property is really the same object as you would get from the Get-CIView cmdlet.

So, lets say we wanted to find out what new fancy 5.1 VM snapshot properties and methods are available to us:

$vm=Get-CIVM “MyVM”

$vm.ExtensionData Get-Member*snapshot*

PowerCLI snapshots

From this,  we see that we now have the ability to automate the creation, removal and revert of snapshots in vCloud Director 5.1!

Creating, Reporting on, and Removing snapshots is now easy!

# Create Snapshot (Snapshot memory false, quiece true, snapshot name, description)

$vm.extensiondata.CreateSnapshot($false,$true,“Snapshot”,“Description”)

# Get VM snapshot

$vm.ExtensionData.GetSnapshotSection().snapshot

# Remove Snapshots

$vm.ExtensionData.RemoveAllSnapshots()

SNAG-0215

Let’s check out another one. Edge Gateways are new in vCloud Director 5.1. How do we find those without any new cmdlets? Search-Cloud!

Search-Cloud -QueryType EdgeGateway Get-CIView

Search-Cloud returns a search object, and from this we can get the .NET object with all the properties and methods.

$edge Get-Member

Edge Gateway in PowerCLI

Note that we don’t have to use the .extensiondata, because we used Get-CIView to directly get the .NET object.

Let’s check out the .configuration!

$edge.configuration

PowerCLI Edge Gateway Configuration

Both the vCloud Admin and Tenant PowerCLI snap-ins have been updated, so if your cloud provider is running on 5.1, enjoy the new features!

Now, this is certainly not all PowerCLI 5.1 R2 has to offer.  Powershell 3 support as well as an official VDS snap-in are also available! You can read more about these updates on the Official PowerCLI Blog! For tons of VDS examples, See Alan’s post!


Follow

Get every new post delivered to your Inbox.

Join 1,024 other followers

%d bloggers like this: