VMware {code} Community
wizardnjau
Contributor
Contributor
Jump to solution

Get an Exception while instantiating a vApp template

I got an Exception while  instantiating a vApp template through REST, and get a result as "Bad request",Here it is the log:

com.vmware.vcloud.api.presentation.service.BadRequestException: Changing a routed vApp network to bridged mode and changing the parent network of a bridged vApp network, are not supported while instantiating a vApp template  with "Identical copy" (CustomizeOnInstantiate=false) selected.
at com.vmware.vcloud.vdc.impl.VdcServiceImpl.renameDirectConnectedVappNetworks(VdcServiceImpl.java:3614)
at com.vmware.vcloud.vdc.impl.VdcServiceImpl.instantiateVApp(VdcServiceImpl.java:3549)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
....

What should I do? Did I have some wrong configuration?

Regard.

0 Kudos
1 Solution

Accepted Solutions
Todor_Todorov
Hot Shot
Hot Shot
Jump to solution

Hi,

You cannot change the MAC address before or during instantiation of the vApp.

However, once the vApp is created (instantiated) and before it's deployed, you can change the MAC address for each of its VMs.

This can be done by modifying the networkConnectionSection in each VM using REST API:

PUT https://<host>/api/vApp/<uuid>/networkConnectionSection

Content-Type: application/vnd.vmware.vcloud.networkConnectionSection+xml

Request body:

<?xml version="1.0" encoding="UTF-8"?>
    <ovf:Info>Specifies the available VM network connections</ovf:Info>
    <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
    <NetworkConnection network="none" needsCustomization="true">
        <NetworkConnectionIndex>0</NetworkConnectionIndex>
        <IsConnected>false</IsConnected>
        <MACAddress>00:50:56:18:02:7b</MACAddress>
        <IpAddressAllocationMode>NONE</IpAddressAllocationMode>
    </NetworkConnection>
    <Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://10.26.49.174/api/vApp/vm-2a17fb4c-e67a-4b33-b82c-f53df52cead8/networkConnectionSection/"/>
</NetworkConnectionSection>

Regards,

Todor Todorov

View solution in original post

0 Kudos
11 Replies
admin
Immortal
Immortal
Jump to solution

Could you try to instantiate with CustomizeOnInstantiate=true?

wizardnjau
Contributor
Contributor
Jump to solution

Where could I get this option?When I create a vApp Template or somewhere else?

0 Kudos
admin
Immortal
Immortal
Jump to solution

There is a property in the GuestCustomizationSection of a vAppTemplate:

<CustomizationSection type="application/vnd.vmware.vcloud.customizationSection+xml" href=".. omitted.../customizationSection/" goldMaster="false" ovf:required="false">
        <ovf:Info>VApp template customization section</ovf:Info>
        <CustomizeOnInstantiate>true</CustomizeOnInstantiate>
</CustomizationSection>

This property will be used as a default. But even if it is false in the template you can still customize all VMs in the vApp before Power ON.

To achieve this through the UI you have to go through all VMs in the vApp -> Properties -> Guest OS Customization -> Enable guest customization.

To do this through the API you will have to get the GuestCustomizationSection of each VM and set enabled=true.

I hope that helps.

wizardnjau
Contributor
Contributor
Jump to solution

Hi,

before I build a vApp from a vApp template, can I set up the mac address for each VM.

I mean using rest api.

now, when I deploy a vApp by a template, mac address is genereted automaticlly. I want to control it to the value I input.

can our rest api support this?

regards

0 Kudos
Todor_Todorov
Hot Shot
Hot Shot
Jump to solution

Hi,

You cannot change the MAC address before or during instantiation of the vApp.

However, once the vApp is created (instantiated) and before it's deployed, you can change the MAC address for each of its VMs.

This can be done by modifying the networkConnectionSection in each VM using REST API:

PUT https://<host>/api/vApp/<uuid>/networkConnectionSection

Content-Type: application/vnd.vmware.vcloud.networkConnectionSection+xml

Request body:

<?xml version="1.0" encoding="UTF-8"?>
    <ovf:Info>Specifies the available VM network connections</ovf:Info>
    <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
    <NetworkConnection network="none" needsCustomization="true">
        <NetworkConnectionIndex>0</NetworkConnectionIndex>
        <IsConnected>false</IsConnected>
        <MACAddress>00:50:56:18:02:7b</MACAddress>
        <IpAddressAllocationMode>NONE</IpAddressAllocationMode>
    </NetworkConnection>
    <Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://10.26.49.174/api/vApp/vm-2a17fb4c-e67a-4b33-b82c-f53df52cead8/networkConnectionSection/"/>
</NetworkConnectionSection>

Regards,

Todor Todorov

0 Kudos
caryme
Contributor
Contributor
Jump to solution

I am working with the .NET API, I am trying to create an image, install some software on that image and then save an updated template back into the catalog.  I have this working but can't seem to get the new template to have the correct customization settings.

1) I get the CustomizationSectionType from the vappTemplate.

2) I change CustomizeOnInstantiate = true

3) I then call UpdateSection() on the vappTemplate

Error I get is Cannot change value between "Make Identical Copy" and "Customize VM Settings" (for CustomizeOnInstantiate).

This seemed like the logical place to change it but do I need to change it early or is there something else I need to do before changing that option?  Even on one of these saved images in the catalog using the UI I can't change the option both options are grayed out.

Thanks
Cary

0 Kudos
aturli
Contributor
Contributor
Jump to solution

I'm having the same problem reported by Caryme

I am working with the .NET API, I am trying to create an image, install some software on that image and then save an updated template back into the catalog.  I have this working but can't seem to get the new template to have the correct customization settings.

1) I get the CustomizationSectionType from the vappTemplate.

2) I change CustomizeOnInstantiate = true

3) I then call UpdateSection() on the vappTemplate

Error I get is Cannot change value between "Make Identical Copy" and "Customize VM Settings" (for CustomizeOnInstantiate).

This seemed like the logical place to change it but do I need to change it early or is there something else I need to do before changing that option?  Even on one of these saved images in the catalog using the UI I can't change the option both options are grayed out.    

To me, it happens when I try to change CustomizeOnInstantiate from `true` to `false`

From vCloud 1.5 doc

PUT /vAppTemplate/{id}/customizationSection

Operation:
PUT /vAppTemplate/{id}/customizationSection
Description:
Modifies the vApp template customization information.

What kind of modifications are allowed?

Thanks,
Andrea
0 Kudos
admin
Immortal
Immortal
Jump to solution

You could try to instantiate the vAppTemplate as it is (with powerOn=false and deploy=false) and after that you should be able to change the customization section of the vApp for each VM individually. Then you can deploy and power on the vApp.

0 Kudos
aturli
Contributor
Contributor
Jump to solution

Thanks vtodorov,

You could try to instantiate the vAppTemplate as it is (with powerOn=false and deploy=false) and after that you should be able to change the customization section of the vApp for each VM individually. Then you can deploy and power on the vApp.

Looking at the UI there is a note that says:

When creating a vApp from this template:     Make Identical copy                 Customize VM settings

"This setting is applicable during "Add to My Cloud" and "Add from Catalog" operations.

It will not be used during "New" vApp and "Add VM" to vApp operations where VMs behave
as building blocks."
which is grayed.
So apparently it is not editable with
Operation:
PUT /vAppTemplate/{id}/customizationSection
Description:
Modifies the vApp template customization information.

What's the purpose of this API call then?
0 Kudos
admin
Immortal
Immortal
Jump to solution

This could be a mistake in the documentation but generally vAppTemplates are read-only. You can change their name and description only.

0 Kudos
aturli
Contributor
Contributor
Jump to solution

ok thanks

0 Kudos