Creating multiple vCloud vApps with PowerCLI

Sometimes when I’m testing in vCloud, I’ll find myself going through the vCloud vApp wizard over and over again.   Here is some PowerCLI code to create vApps from the command line.  It’s pretty basic right now and I plan on adding more functionality to it later.

# Your environmental variables

$vCloudName = 'cloud51.vmware.local'
$orgName = 'vmware'
$catalogName = 'Linux'
$orgVdcName = 'vmware-payg-prod1-vc5c'
$vAppTemplateName = 'Linux Minimal vApp'
$startPrefix = 1
$endPrefix = 3

connect-ciserver $vCloudName # connect to vCloud
$org = Get-Org $orgName # get the org
$orgvdc = $org | Get-OrgVdc $orgVdcName # get the org vDC
$catalog = get-org admin | Get-Catalog $catalogName # get the catalog where our vApp Template is
$vAppTemplate = $catalog | Get-CIVAppTemplate $vAppTemplateName # get the vApp Template from the catalog

# Create the vApps
($startPrefix..$endPreFix) | foreach { New-CIVApp "$($vAppTemplateName)$($_)" -OrgVdc $orgvdc -VAppTemplate $vAppTemplate }

You may want to connect the vApps to a network. This will connect every NIC on every VM in the vApp to a single network. At least it should, I haven't tested it with call cases.

# Your environmental variables
$vCloudName = 'cloud51.vmware.local'
$orgName = 'vmware'
$orgNetworkName = 'external-vlan5'
$catalogName = 'Linux'
$orgVdcName = 'vmware-payg-prod1-vc5c'
$vAppTemplateName = 'Linux Minimal vApp'
$startPrefix = 1
$endPrefix = 3

connect-ciserver $vCloudName # connect to vCloud
$org = Get-Org $orgName # get the org
$orgNetwork = $org | Get-OrgNetwork $orgNetworkName # get the org network we will connect the vApp to
$orgvdc = $org | Get-OrgVdc $orgVdcName # get the org vDC
$catalog = get-org admin | Get-Catalog $catalogName # get the catalog where our vApp Template is
$vAppTemplate = $catalog | Get-CIVAppTemplate $vAppTemplateName # get the vApp Template from the catalog

# Create the vApps
($startPrefix..$endPrefix) | foreach { 
 $vApp = New-CIVApp "$($vAppTemplateName)$($_)" -OrgVdc $orgvdc -VAppTemplate $vAppTemplate
 $vAppNetwork = New-CIVAppNetwork -Direct -ParentOrgNetwork $orgNetwork -VApp $vApp
 $vApp | Get-CIVM | Get-CINetworkAdapter | Set-CINetworkAdapter -VAppNetwork $vAppNetwork -IPAddressAllocationMode POOL
}

 


Broken pipe when uploading OVFs into vCloud 5.5

I was trying to deploy an OVA into a new vCloud 5.5 instance in my lab and it kept failing with the error “Internal Server Error: Broken Pipe”.

Image

The OVA was uploaded to the vCloud cell, but when vCloud attempted to deploy it into vCenter it failed. 

Image

The OVA was from a VM that I built in vCenter and the cause of the problem was that I had forgotten to install VMware tools.  I installed VMware tools, exported the VM and was then successfully able to import into vCloud. 

I was attempting to import the OVA directly into my organization’s “My Cloud”, which is a new feature in vCloud 5.5.  In prior versions of vCloud, you were able to import VMs from vCenter into your organization’s “My Cloud” or a catalog.  If you imported into your “My Cloud” and VMware tools wasn’t installed, the import would succeed but guest customization would be disabled for the VM since VMware tools is needed for guest customization.  If you imported the VM into a catalog, the catalog would be marked as an identical copy so no customization would occur. 

 

 

 


Unable to perform file transfers in vCloud with Java 7 Update 45

I recently tried to download a vCloud template, which uses Java, and was unable to do so.  Nothing would happen when I clicked the browse button to choose the destination for the OVF on my local filesystem.  I don’t perform file transfers in vCloud very often so I’m not sure when the issue started, but I believe that Java must have been upgraded at some point and is now causing the problem.

I appears that there are two fixes.  The first is to go to the Control Panel in Windows.  (or wherever your OS has its Java settings).  Open the Java control panel item, select Security and set the security to the lowest option (medium).  This probably isn’t a good idea so I’ll explain how to update to the latest version of Java (as of this post) where you can leave the Java security setting at high and still access vCloud’s Java functionality.

Update to Java 7 Update 51

Go to http://www.java.com and update Java.  Once  you’re finished you should receive

Image

You can also go to http://java.com/en/download/installed.jsp to verify your Java version.

Uninstall older versions of Java

If you no longer need any of the previous versions of Java, I suggest removing them.  You can remove them by going to http://www.java.com/en/download/uninstallapplet.jsp or through the Windows Control Panel.  On one system I had to reboot in order to remove the older versions of Java completely.

Here I’m removing Java 7 Update 45

Image

Image

Configure Java’s security settings

Now with only the current Java installed, we can go to the control panel and make our security changes.  On Windows 7 to go Start > Control Panel > Java > Security tab.  If you have correctly done everything above, you will see

Image

Select “Edit Site List…” and enter the URLs of your vCloud server(s).

Image

Try the download again

Now we can go to vCloud and perform a Java related action that wasn’t working previously.  Here I’m going to try to download a template.  Upon selecting the Browse button to choose the destination for the template OVF I receive

Image

Choose “Don’t Block” and press cancel on the current vCloud window.  Now try to download the template again and you should receive your OS’s program that allows you to choose the OVF destination.

I want to say that either after or before the last screenshot there was another step that I missed where it again asked if you wanted to Allow/Not Allow Java to run.