Using vCloud virtual appliances

A virtual appliance (vApp) is a container that contains one or more virtual machines. These virtual machines together make an application. For example, if you have a three-tier application, you can have a vApp that contains the database server, the application server, and the web server. In vCloud Director every virtual machine has to be part of a vApp.

In the following sections Retrieving vApp templates, Creating vCloud vApps, Retrieving vCloud vApps, Starting vCloud vApps, and Stopping vCloud vApps , we will show you how to use the PowerCLI cmdlets to retrieve vApp templates, create vApps, retrieve vApps, start vApps, and stop vApps.

Retrieving vApp templates

In vCloud Air, there are some predefined vApp templates available for use in your tenant environment. You can use the vApp templates to create your vApps. The Get-CIVAppTemplate cmdlet retrieves these vApp templates. The syntax of this cmdlet is as follows, and the first parameter set is the default:

Get-CIVAppTemplate [[-Name] <String[]>] [-Catalog <Catalog[]>]
    [-Owner <CIUser[]>] [-Server <CIServer[]>] [<CommonParameters>]

The second parameter set is to retrieve vApp templates by ID:

Get-CIVAppTemplate -Id <String[]> [-Server <CIServer[]>]
    [<CommonParameters>]

The -Id parameter is required.

In the following example, we will retrieve the vApp templates available by default in a vCloud Air tenant of the VMware Hands-on Labs:

PowerCLI C:> Get-CIVAppTemplate


    Name                                     Status   Owner  StorageUsed
                                                         GB
----                                     ------   -----  -----------
CentOS63-32BIT                           Resolved system 20.000
CentOS63-64BIT                           Resolved system 20.000
CentOS64-32BIT                           Resolved system 20.000
CentOS64-64BIT                           Resolved system 20.000
CentOs-Mini                              Resolved system 8.000
Ubuntu Server 12.04 LTS (amd64 20150127) Resolved system 10.000
Ubuntu Server 12.04 LTS (i386 20150127)  Resolved system 10.000
W2K12-STD-64BIT                          Resolved system 40.000
W2K12-STD-64BIT-SQL2K12-STD-SP1          Resolved system 40.000
W2K12-STD-64BIT-SQL2K12-WEB-SP1          Resolved system 40.000
W2K12-STD-R2-64BIT                       Resolved system 40.000
W2K12-STD-R2-SQL2K14-STD                 Resolved system 40.000
W2K12-STD-R2-SQL2K14-WEB                 Resolved system 40.000
W2K8-STD-R2-64BIT                        Resolved system 40.000
W2K8-STD-R2-64BIT-SQL2K8-STD-R2-SP2      Resolved system 40.000
W2K8-STD-R2-64BIT-SQL2K8-WEB-R2-SP2      Resolved system 40.000 

We will use one of these vApp templates in the following section, Creating vCloud vApps , to create a new vApp.

Creating vCloud vApps

To create a new vApp, you can use the New-CIVApp cmdlet. The syntax of the New-CIVApp cmdlet is given here, the first parameter set is to create empty vApps:

New-CIVApp [-Name] <String> [-Description <String>] [-OrgVdc
    <OrgVdc>] [-RunAsync] [-RuntimeLease <TimeSpan>] [-Server 
    <CIServer[]>] [-StorageLease <TimeSpan>] [-WhatIf] [-Confirm] 
    [<CommonParameters>]

The -Name and -OrgVdc parameters are required.

The second parameter set is to create vApps from a template:

New-CIVApp [-Name] <String> [-Description <String>] [-OrgVdc 
    <OrgVdc>] [-RunAsync] [-RuntimeLease <TimeSpan>] [-Server 
    <CIServer[]>] [-StorageLease <TimeSpan>] -VAppTemplate 
    <CIVAppTemplate> [-WhatIf] [-Confirm] [<CommonParameters>]

The -Name and -VAppTemplate parameters are required.

The third parameter set is for cloning a vApp:

New-CIVApp [-Name] <String> [-Description <String>] [-OrgVdc
    <OrgVdc>] [-RunAsync] [-RuntimeLease <TimeSpan>] [-Server
    <CIServer[]>] [-StorageLease <TimeSpan>] -VApp <CIVApp> 
    [-WhatIf] [-Confirm] [<CommonParameters>]

The -Name and -VApp parameters are required.

In the first example, we will create an empty vApp named vApp001:

PowerCLI C:> New-CIVApp -Name vApp001 -Description 'Empty
    vApp for later use' -OrgVdc student501


    Name    Enabled InMaintenanceMode Owner
----    ------- ----------------- -----
vApp001 True    False             [email protected]

In the second example, we will create a vApp, named vApp002, from the CentOS64-64BIT template available in vCloud Air, containing a CentOS 6.4 64-bit virtual machine:

PowerCLI C:> New-CIVApp -Name vApp002 -Description 'CentOS
    6.4 64-bit Server' -OrgVdc student501 -VAppTemplate CentOS64-64BIT


    Name    Enabled InMaintenanceMode Owner
----    ------- ----------------- -----
vApp002 True    False             [email protected]

In the following screenshot of VMware vCloud Director, you will see the vApps we have just created, plus the student501-Cent-OS-Mini vApp already created by the Hands-on Lab.

Creating vCloud vApps

Retrieving vCloud vApps

The Get-CIVApp cmdlet retrieves virtual appliances in the cloud. The syntax of the Get-CIVApp cmdlet is as follows, and the first parameter set is the default:

    Get-CIVApp [[-Name] <String[]>] [-Server <CIServer[]>] 
    [-Org <Org[]>] [-OrgVdcNetwork <OrgNetworkBase[]>] [-OrgVdc
    <OrgVdc[]>] [-Owner <CIUser[]>] [-Status <CIVAppStatus[]>]
    [<CommonParameters>]

The second parameter set is for retrieving vApps by ID.

Get-CIVApp -Id <String[]> [-Server <CIServer[]>] [<CommonParameters>]

The -Id parameter is required.

In the first example, we will retrieve all of the vApps.

PowerCLI C:> Get-CIVApp


    Name                    Enabled InMaintenanceMode Owner
----                    ------- ----------------- -----
student501-Cent-OS-Mini True    False             system
vApp001                 True    False             student501@vcah...
vApp002                 True    False             student501@vcah...

In the second example, we will retrieve some other properties of the vApps, such as Status, SizeGB, CpuCount, MemoryAllocationGB, and Shared. A shared vApp is shared with other users or groups in your organization:

PowerCLI C:> Get-CIVApp |
>> Select-Object -Property Name,Status,SizeGB,CpuCount,
    MemoryAllocationGB |
>> Format-Table -AutoSize

    Name                        Status SizeGB CpuCount MemoryAllocation
                                                       GB
----                        ------ ------ -------- -----------------
student501-Cent-OS-Mini  PoweredOn      8        1                 1
vApp001                   Resolved      0        0                 0
vApp002                 PoweredOff     20        1                 1

Starting vCloud vApps

If you start a vApp, you will power on all of the virtual machines in the vApp. The Start-CIVApp cmdlet will start vApps for you. Unfortunately, you cannot specify the start order of the virtual machines in the vApp using the Start-CIVApp cmdlet. If you want to start the virtual machines of a vApp in a specific order, you have to use the Start-CIVM cmdlet that we will discuss in the section Starting vCloud virtual machines .

The syntax of the Start-CIVApp cmdlet is as follows:

Start-CIVApp [-VApp] <CIVApp[]> [-RunAsync] [-Server 
    <CIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

The -VApp parameter is required.

In the following example, we will start vApp002:

PowerCLI C:> Start-CIVApp -VApp vApp002


    Name               Enabled InMaintenanceMode    Owner
----               ------- -----------------    -----
vApp002            True    False                [email protected]

Stopping vCloud vApps

The Stop-CIVApp cmdlet stops the specified vApp. Stopping a vApp will power off all of the virtual machines in the vApp. You cannot use the Stop-CIVApp cmdlet to specify the stop order of the virtual machines in the vApp. If you want to stop the virtual machines of a vApp in a specific order, you have to use the Stop-CIVM cmdlet that we will discuss in the section Stopping vCloud virtual machines .

The syntax of the Stop-CIVApp cmdlet is as follows:

Stop-CIVApp [-VApp] <CIVApp[]> [-RunAsync] [-Server 
    <CIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

The -VApp parameter is required.

In the following example, we will stop vApp002:

PowerCLI C:> Stop-CIVApp -VApp vApp002 -Confirm:$false


    Name               Enabled InMaintenanceMode    Owner
----               ------- -----------------    -----
vApp002                 True    False           [email protected]
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.160.61