Quantcast
Channel: VMware Communities : Popular Discussions - vCloud Director PowerCLI
Viewing all articles
Browse latest Browse all 13334

Adding a vApp Template to Cloud from Catalog in vCD with PowerCLI

$
0
0

I've imported the VM's directly from Virtual Center and created a vApp with Import-CIvApp. I've then shutdown and captured to Catalog with assistance from AtanasAtanasov.

 

So now I have 4 Catalogs each with 1 vApp of 3 machines in them:
Build 60.00 (LC1)
Build 60.00 (LC2)
Build 60.00 (LC3)
Build 60.00 (LC4)

 

Now I need to "Add to Cloud"  from  "Build 60.00 (LC1)". I've fiddled and got some code together that seems to be correct although there seems to be an issue with the NAT rules on the vApp Template:

 

$tem = Get-Catalog "Build 60.00 (LC1)" | get-civapptemplate
$vdc = Get-OrgVdc "My_vDC"

 

$instParams = new-object VMware.VimAutomation.Cloud.Views.InstantiateVAppTemplateParams
$instParams.InstantiationParams = new-object VMware.VimAutomation.Cloud.Views.InstantiationParams

$instParams.Source = $tem.href
$instParams.name = "Test from Build 60.00 (LC1)"
$instParams.Deploy = $true
$instParams.PowerOn = $false
$instParams.Description = "Created with PowerCLI"
$instParams.InstantiationParams.Section = $tem.ExtensionData.Section[0,1,2,3]
$vdc.ExtensionData.InstantiateVAppTemplate($instParams)

 

After running that I get the error:

 

Exception calling "InstantiateVAppTemplate" with "1" argument(s): "Bad request  - Unexpected JAXB Exception  - cvc-complex-type.2.4.b: The content of element 'NatRule' is not complete. One of '{"http://www.vmware.com/vcloud/v1.5":VCloudExtension, "http://www.vmware.com/vcloud/v1.5":Description, "http://www.vmware.com/vcloud/v1.5":OneToOneBasicRule, "http://www.vmware.com/vcloud/v1.5":OneToOneVmRule, "http://www.vmware.com/vcloud/v1.5":PortForwardingRule, "http://www.vmware.com/vcloud/v1.5":VmRule}' is expected."
At line:1 char:43
+ $vdc.ExtensionData.InstantiateVAppTemplate <<<< ($instParams)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

 

However if I take a look at both the below they are empty:

 

$instParams.InstantiationParams.Section[1].NetworkConfig[0].Configuration.Features[1].NatRule[0]
$tem.extensiondata.Section[3].NetworkConfig[0].Configuration.Features[1].NatRule[0]

 

Description                                      AnyAttr                                         VCloudExtension
-----------                                             -------                                            ---------------

 

I took a look before capturing the vApp to template and there were no NatRules for either VM's. I powered on the vApp and had a look again but still nothing: $civapp.ExtensionData.Section[3].NetworkConfig[0].Configuration.Features[1]

 

Is my code above correct? Or Am I missing something?

 

PS: I've split all my help requests up for when others have the same questions it's easier to search and it's not one huge topic.

 

Thanks!

 

 

EDIT: Removing the line  $instParams.InstantiationParams.Section = $tem.ExtensionData.Section[0,1,2,3] at least allows the vApp to deploy till this gets resolved...         


Viewing all articles
Browse latest Browse all 13334

Trending Articles