vCD-Module _Update
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
#Requires -Version 4
|
||||
#Requires -Modules VMware.VimAutomation.Cloud, @{ModuleName="VMware.VimAutomation.Cloud";ModuleVersion="6.3.0.0"}
|
||||
Function New-MyOrgVdc {
|
||||
Function New-MyOrgVdc {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates a new vCD Org VDC with Default Parameters
|
||||
@@ -9,7 +7,6 @@ Function New-MyOrgVdc {
|
||||
Creates a new vCD Org VDC with Default Parameters
|
||||
|
||||
Default Parameters are:
|
||||
* Allocation Model
|
||||
* Network Quota
|
||||
* VM Quota
|
||||
* 'vCpu In Mhz'
|
||||
@@ -20,27 +17,38 @@ Function New-MyOrgVdc {
|
||||
.NOTES
|
||||
File Name : New-MyOrgVdc.ps1
|
||||
Author : Markus Kraus
|
||||
Version : 1.2
|
||||
Version : 1.3
|
||||
State : Ready
|
||||
|
||||
.LINK
|
||||
https://mycloudrevolution.com/
|
||||
|
||||
.EXAMPLE
|
||||
New-MyOrgVdc -Name "TestVdc" -CPULimit 1000 -MEMLimit 1000 -StorageLimit 1000 -StorageProfile "Standard-DC01" -NetworkPool "NetworkPool-DC01" -ProviderVDC "Provider-VDC-DC01" -Org "TestOrg" -ExternalNetwork "External_OrgVdcNet"
|
||||
New-MyOrgVdc -Name "TestVdc" -AllocationModel AllocationPool -CPULimit 1000 -MEMLimit 1000 -StorageLimit 1000 -StorageProfile "Standard-DC01" -NetworkPool "NetworkPool-DC01" -ProviderVDC "Provider-VDC-DC01" -Org "TestOrg" -ExternalNetwork "External_OrgVdcNet"
|
||||
|
||||
.EXAMPLE
|
||||
New-MyOrgVdc -Name "TestVdc" -CPULimit 1000 -MEMLimit 1000 -StorageLimit 1000 -StorageProfile "Standard-DC01" -NetworkPool "NetworkPool-DC01" -ProviderVDC "Provider-VDC-DC01" -Org "TestOrg"
|
||||
New-MyOrgVdc -Name "TestVdc" -AllocationModel AllocationVApp -StorageLimit 1000 -StorageProfile "Standard-DC01" -NetworkPool "NetworkPool-DC01" -ProviderVDC "Provider-VDC-DC01" -Org "TestOrg"
|
||||
|
||||
.PARAMETER Name
|
||||
Name of the New Org VDC as String
|
||||
|
||||
.PARAMETER AllocationModel
|
||||
Allocation Model of the New Org VDC as String
|
||||
|
||||
.PARAMETER CPULimit
|
||||
CPU Limit (MHz) of the New Org VDC as String
|
||||
|
||||
Default: 0 (Unlimited)
|
||||
|
||||
Note: If AllocationModel is not AllocationVApp (Pay as you go), a limit needs to be set
|
||||
|
||||
.PARAMETER MEMLimit
|
||||
Memory Limit (MB) of the New Org VDC as String
|
||||
|
||||
Default: 0 (Unlimited)
|
||||
|
||||
Note: If AllocationModel is not AllocationVApp (Pay as you go), a limit needs to be set
|
||||
|
||||
.PARAMETER StorageLimit
|
||||
Storage Limit (MB) of the New Org VDC as String
|
||||
|
||||
@@ -76,12 +84,16 @@ Function New-MyOrgVdc {
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Name of the New Org VDC as String")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[String] $Name,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="CPU Limit (MHz) of the New Org VDC as String")]
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Allocation Model of the New Org VDC as String")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[int] $CPULimit,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Memory Limit (MB) of the New Org VDC as String")]
|
||||
[ValidateSet("AllocationPool","AllocationVApp")]
|
||||
[String] $AllocationModel,
|
||||
[Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage="CPU Limit (MHz) of the New Org VDC as String")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[int] $MEMLimit,
|
||||
[int] $CPULimit = 0,
|
||||
[Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage="Memory Limit (MB) of the New Org VDC as String")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[int] $MEMLimit = 0,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Storage Limit (MB) of the New Org VDC as String")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[int] $StorageLimit,
|
||||
@@ -117,7 +129,7 @@ Function New-MyOrgVdc {
|
||||
$providerVdcRef = New-Object VMware.VimAutomation.Cloud.Views.Reference
|
||||
$providerVdcRef.Href = $OrgVdcproviderVdc.Href
|
||||
$adminVdc.ProviderVdcReference = $providerVdcRef
|
||||
$adminVdc.AllocationModel = "AllocationPool"
|
||||
$adminVdc.AllocationModel = $AllocationModel
|
||||
$adminVdc.ComputeCapacity = New-Object VMware.VimAutomation.Cloud.Views.ComputeCapacity
|
||||
$adminVdc.ComputeCapacity.Cpu = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage
|
||||
$adminVdc.ComputeCapacity.Cpu.Units = "MHz"
|
||||
@@ -132,8 +144,8 @@ Function New-MyOrgVdc {
|
||||
$adminVdc.StorageCapacity.Limit = $StorageLimit
|
||||
$adminVdc.NetworkQuota = 10
|
||||
$adminVdc.VmQuota = 0
|
||||
$adminVdc.VCpuInMhz = 1000
|
||||
$adminVdc.VCpuInMhz2 = 1000
|
||||
$adminVdc.VCpuInMhz = 2000
|
||||
$adminVdc.VCpuInMhz2 = 2000
|
||||
$adminVdc.UsesFastProvisioning = $false
|
||||
$adminVdc.IsThinProvision = $true
|
||||
|
||||
@@ -143,20 +155,21 @@ Function New-MyOrgVdc {
|
||||
$orgVdc = $orgED.CreateVdc($adminVdc)
|
||||
|
||||
## Wait for getting Ready
|
||||
Write-Verbose "Wait for getting Ready"
|
||||
Write-Verbose "Wait for OrgVdc getting Ready after creation"
|
||||
$i = 0
|
||||
while(($orgVdc = Get-OrgVdc -Name $Name -Verbose:$false).Status -eq "NotReady"){
|
||||
$i++
|
||||
Start-Sleep 2
|
||||
if($i -gt $Timeout) { Write-Error "Creating Org Failed."; break}
|
||||
Write-Progress -Activity "Creating Org" -Status "Wait for Org to become Ready..."
|
||||
if($i -gt $Timeout) { Write-Error "Creating OrgVdc Failed."; break}
|
||||
Write-Progress -Activity "Creating OrgVdc" -Status "Wait for OrgVdc to become Ready..."
|
||||
}
|
||||
Write-Progress -Activity "Creating Org" -Completed
|
||||
Write-Progress -Activity "Creating OrgVdc" -Completed
|
||||
Start-Sleep 2
|
||||
|
||||
## Search given Storage Profile
|
||||
Write-Verbose "Search given Storage Profile"
|
||||
$ProVdcStorageProfile = search-cloud -QueryType ProviderVdcStorageProfile -Name $StorageProfile | Get-CIView
|
||||
$Filter = "ProviderVdc==" + $OrgVdcproviderVdc.Id
|
||||
$ProVdcStorageProfile = search-cloud -QueryType ProviderVdcStorageProfile -Name $StorageProfile -Filter $Filter | Get-CIView
|
||||
|
||||
## Create Storage Profile Object with Settings
|
||||
Write-Verbose "Create Storage Profile Object with Settings"
|
||||
@@ -174,14 +187,14 @@ Function New-MyOrgVdc {
|
||||
$orgVdc.ExtensionData.CreateVdcStorageProfile($UpdateParams)
|
||||
|
||||
## Wait for getting Ready
|
||||
Write-Verbose "Wait for getting Ready"
|
||||
Write-Verbose "Wait for OrgVdc getting Ready after update"
|
||||
while(($orgVdc = Get-OrgVdc -Name $name -Verbose:$false).Status -eq "NotReady"){
|
||||
$i++
|
||||
Start-Sleep 1
|
||||
if($i -gt $Timeout) { Write-Error "Update Org Failed."; break}
|
||||
Write-Progress -Activity "Updating Org" -Status "Wait for Org to become Ready..."
|
||||
if($i -gt $Timeout) { Write-Error "Update OrgVdc Failed."; break}
|
||||
Write-Progress -Activity "Updating OrgVdc" -Status "Wait for OrgVdc to become Ready..."
|
||||
}
|
||||
Write-Progress -Activity "Updating Org" -Completed
|
||||
Write-Progress -Activity "Updating OrgVdc" -Completed
|
||||
Start-Sleep 1
|
||||
|
||||
## Search Any-StorageProfile
|
||||
|
||||
Reference in New Issue
Block a user