VMware {code} Community
wizardnjau
Contributor
Contributor

An error occur when using "/api/vdc/#/action/instantiateVAppTemplate" create a vapp

Hello,

  I am using  "/api/vdc/#/action/instantiateVAppTemplate"  to create a vapp from a vapp  template, and  get a request error "the  entity network 172.2/16 bla bla  not exist".

  I check the vm in the template,and find the network name of the vm is "172.2/16".I can't see this network in my organization.

  So whether could I create a vapp from a template in this situation?How?

  One more question, I used three steps to deploy a new vapp from a vapp template

   step1:/api/vdc/#/action/instantiateVAppTemplate (create vapp)

   step2:/api/vApp/#/networkConnectionSection/(change the network of the vm)

   step3:Power On the vm

Is this correct? Or I miss some steps?

Reply
0 Kudos
8 Replies
wizardnjau
Contributor
Contributor

Here is the networksection of my post body

<NetworkConfigSection>
    <ovf:Info>The configuration parameters for logical networks</ovf:Info>
        <NetworkConfig networkName="enet-org-vCloud">
            <Description/>
            <Configuration>
        <ParentNetwork
            href="https://10.153.147.90:443/api/network/a7961a26-93d7-469d-9862-c043af29b845" />
        <FenceMode>bridged</FenceMode>
    </Configuration>
        </NetworkConfig>
</NetworkConfigSection>

Reply
0 Kudos
admin
Immortal
Immortal

In your case the VM in the template is misconfigured.

The 'network' attribute of the NetworkConnection section (inside the NetworkConnectionSection section) in the VM should point to the network that you are creating upon instantiation - in your case it should be 'enet-org-vCloud'.

You could try to pass the value specified in the VM NetworkConnection's network attribute in your POST request.

Otherwise you will have to recreate your template and choose a better name for the network.

Note: this is for 1.5 API.

Hope that helps.

Reply
0 Kudos
Todor_Todorov
Hot Shot
Hot Shot

If you don't specify a <NetworkConfigSection> element while instantiating the vApp template, then vCloud Director will automatically create the needed vApp network. After that you can modify that <NetworkConfigSection> in the newly created vApp to suit your needs.

Your request is failing because the network names (the one you're specifying during POST and the one from the template) don't match.

The three steps you're mentioning look correct.

Regards,

Todor Todorov

wizardnjau
Contributor
Contributor

Thank you for your response.

It does work, and I can create vapp from template.

But when I try to change the network of the VM through REST /api/vApp/vm-id/networkConfigSection/, I got an error and fail to update network Info "The network enet-org-vCloud in the VCD doesn't exsit",after that all the nic info of the VM lost.

So I modify the network of the VM through the vCloud UI, and add the network "enet-org-vCloud"

Then I'm in a new trouble,the vapp can't started,and got an error "The VDC associated with this vApp does not have the required network resources to start this vApp."

I can create a vapp through vCloud UI and start correctly.

Have I miss some important step or my configuration is not correct.

Reply
0 Kudos
wizardnjau
Contributor
Contributor

Here is my xml context:

instantiate

<InstantiateVAppTemplateParams xmlns="http://www.vmware.com/vcloud/v1.5" name="REST test"
deploy="false"
powerOn="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">
<Description>Example Rest Test</Description>
<InstantiationParams>
<LeaseSettingsSection
type="application/vnd.vmware.vcloud.leaseSettingsSection+xml">
<ovf:Info>Lease Settings</ovf:Info>
<DeploymentLeaseInSeconds>172800</DeploymentLeaseInSeconds>
<StorageLeaseInSeconds>172800</StorageLeaseInSeconds>
</LeaseSettingsSection>
</InstantiationParams>
<Source
href="https://10.153.147.90:443/api/vAppTemplate/vappTemplate-a4e8da22-fc53-4596-97ae-0e5c744a4681" />
</InstantiateVAppTemplateParams>

Reply
0 Kudos
wizardnjau
Contributor
Contributor

Here is another one

change the network

<NetworkConnectionSection xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">
    <ovf:Info>Specifies the available VM network connections</ovf:Info>
    <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
    <NetworkConnection needsCustomization="true" network="enet-org-vCloud">
        <NetworkConnectionIndex>0</NetworkConnectionIndex>
        <IsConnected>true</IsConnected>
        <IpAddressAllocationMode>POOL</IpAddressAllocationMode>

    </NetworkConnection>
   <NetworkConnection needsCustomization="true" network="none">
        <NetworkConnectionIndex>0</NetworkConnectionIndex>
        <IsConnected>false</IsConnected>
        <IpAddressAllocationMode>NONE</IpAddressAllocationMode>
    </NetworkConnection>

</NetworkConnectionSection>

Reply
0 Kudos
AmitvCD
Contributor
Contributor

Hi,

How you solved this issue? Can you please provide some details. I am also facing similar issue.

>> The VCD entity network "Win-vAppNet" does not exist.

Thanks,

Amit

Reply
0 Kudos
AmitvCD
Contributor
Contributor

Did you find any solution to this problem?

Reply
0 Kudos