Creating reservations with PowervRA - This gist contains examples for creating vSphere and vCloud Air reservations
# --- Create Multiple vSphere Reservations
1..10 | % {
# --- Set the reservation name
$ReservationName = "PowervRA-vSphere-Reservation$($_)"
Write-Output "Creating $($ReservationName)"
# --- Get the compute resource id
$ComputeResource = Get-vRAReservationComputeResource -Type vSphere -Name "Cluster01 (vCenter)"
# --- Get the network definition
$NetworkDefinitionArray = @()
$Network1 = New-vRAReservationNetworkDefinition -Type vSphere -ComputeResourceId $ComputeResource.Id -NetworkPath "VM Network" -NetworkProfile "TestProfile"
$NetworkDefinitionArray += $Network1
# --- Get the storage definition
$StorageDefinitionArray = @()
$Storage1 = New-vRAReservationStorageDefinition -Type vSphere -ComputeResourceId $ComputeResource.Id -Path "Datastore01" -ReservedSizeGB 10 -Priority 0
$StorageDefinitionArray += $Storage1
$Param = @{
Type = "vSphere"
Name = $ReservationName
Tenant = "Tenant01"
BusinessGroup = "Default Business Group[Tenant01]"
ReservationPolicy = "ReservationPolicy01"
Priority = 0
ComputeResourceId = $ComputeResource.Id
Quota = 0
MemoryGB = 20
Storage = $StorageDefinitionArray
Resourcepool = "Resources"
Network = $NetworkDefinitionArray
EnableAlerts = $true
StorageAlertPercentageLevel = 20
EmailBusinessGroupManager = $true
AlertRecipients = "user1@vsphere.local", "user2@vsphere.local"
}
New-vRAReservation @Param
}
# --- Create Multiple vCloud Air Reservations
1..10 | % {
# --- Set the reservation name
$ReservationName = "PowervRA-vCA-Reservation$($_)"
Write-Output "Creating $($ReservationName)"
# --- Get the compute resource id
$ComputeResource = Get-vRAReservationComputeResource -Type "vCloud Air" -Name "uk-slough-1-6 - VDC1 (vCloud Air)"
# --- Get the network definition
$NetworkDefinitionArray = @()
$Network1 = New-vRAReservationNetworkDefinition -Type "vCloud Air" -ComputeResourceId $ComputeResource.Id -NetworkPath "isolated-network"
$NetworkDefinitionArray += $Network1
# --- Get the storage definition
$StorageDefinitionArray = @()
$Storage1 = New-vRAReservationStorageDefinition -Type "vCloud Air" -ComputeResourceId $ComputeResource.Id -Path "Standard" -ReservedSizeGB 500 -Priority 0
$StorageDefinitionArray += $Storage1
$Param = @{
Type = "vCloud Air"
Name = $ReservationName
Tenant = "Tenant01"
BusinessGroup = "Default Business Group[Tenant01]"
ReservationPolicy = "Test01"
Priority = 0
ComputeResourceId = $ComputeResource.Id
Quota = 0
MemoryGB = 50
Storage = $StorageDefinitionArray
Network = $NetworkDefinitionArray
EnableAlerts = $False
EmailBusinessGroupManager = $False
AlertRecipients = "cgumbley@vsphere.local", "jmedd@vsphere.local"
}
New-vRAReservation @Param
}
# --- Create a vSphere Reservation
# --- Get the compute resource id
$ComputeResource = Get-vRAReservationComputeResource -Type vSphere -Name "Cluster01 (vCenter)"
# --- Get the network definition
$NetworkDefinitionArray = @()
$Network1 = New-vRAReservationNetworkDefinition -Type vSphere -ComputeResourceId $ComputeResource.Id -NetworkPath "VM Network" -NetworkProfile "TestProfile"
$NetworkDefinitionArray += $Network1
# --- Get the storage definition
$StorageDefinitionArray = @()
$Storage1 = New-vRAReservationStorageDefinition -Type vSphere -ComputeResourceId $ComputeResource.Id -Path "Datastore01" -ReservedSizeGB 10 -Priority 0
$StorageDefinitionArray += $Storage1
$Param = @{
Type = "vSphere"
Name = "Reservation20"
Tenant = "Tenant01"
BusinessGroup = "Default Business Group[Tenant01]"
ReservationPolicy = "ReservationPolicy01"
Priority = 0
ComputeResourceId = $ComputeResource.Id
Quota = 0
MemoryGB = 20
Storage = $StorageDefinitionArray
Resourcepool = "Resources"
Network = $NetworkDefinitionArray
EnableAlerts = $true
StorageAlertPercentageLevel = 20
EmailBusinessGroupManager = $true
AlertRecipients = "user1@vsphere.local", "user2@vsphere.local"
}
New-vRAReservation @Param
# --- Create a vCloud Air Reservation
# --- Get the compute resource id
$ComputeResource = Get-vRAReservationComputeResource -Type "vCloud Air" -Name "uk-slough-1-6 - VDC1 (vCloud Air)"
# --- Get the network definition
$NetworkDefinitionArray = @()
$Network1 = New-vRAReservationNetworkDefinition -Type "vCloud Air" -ComputeResourceId $ComputeResource.Id -NetworkPath "isolated-network"
$NetworkDefinitionArray += $Network1
# --- Get the storage definition
$StorageDefinitionArray = @()
$Storage1 = New-vRAReservationStorageDefinition -Type "vCloud Air" -ComputeResourceId $ComputeResource.Id -Path "Standard" -ReservedSizeGB 500 -Priority 0
$StorageDefinitionArray += $Storage1
$Param = @{
Type = "vCloud Air"
Name = "vCA-Reservation-GB"
Tenant = "Tenant01"
BusinessGroup = "Default Business Group[Tenant01]"
ReservationPolicy = "ReservationPolicy01"
Priority = 0
ComputeResourceId = $ComputeResource.Id
Quota = 0
MemoryGB = 50
Storage = $StorageDefinitionArray
Network = $NetworkDefinitionArray
EnableAlerts = $False
EmailBusinessGroupManager = $False
AlertRecipients = "user1@vsphere.local", "user2@vsphere.local"
}
New-vRAReservation @Param