vCloud Director: Regaining your Edge (Redeploying from a command line)

In my demo vCD environment I often find that after a power-up the Edge Gateways don’t function properly. Options like “Upgrade to Full Configuration” don’t exist, traffic doesn’t flow or rules can’t be changed. A redeploy always fixed it so I started looking for a way to redeploy them automatically when the system started up.

I started with PowerCLI and after figuring out you need to select the vCloud Director plugin during the installation for commands like connect-ciserver to showup I realized it didn’t really address vSheild/VMware vCloud Networking and Security. That led me to Alan Renouf’s VMware vShield PowerShell Module which contains mostly GET commands for vShield but also has an Invoke routine that I played with for awhile before moving on to cURL

cURL ultimatly had what I needed, the final piece coming from a VMware Blog on using cURL with the vShield Rest API.

Step 1: Download cURL for your platform of choice and extract the executable into a suitable directory
Step 2: Find the identifier of the Edge Gateway to redeploy. Since I’m resetting the same gateways on a set install I just used the vShield Manager GUI:
curl1

Step 3: Execute the command (all on one line):
curl -k -u username:password –header “Content-Type:application/xml” -X POST https://vshieldmanagerip/api/3.0/edges/edge id?action=redeploy

Step 4: Use the vShield Manager to confirm:
curl2

I then added the commands to a batch file that executes on my vCenter server at start up. Works great!

This entry was posted in Cloud, Computing, PowerShell, Security, Virtualization, VMware and tagged , , , , , . Bookmark the permalink.

Leave a Reply