Quantcast
Channel: VMware Communities: Message List - VMware vCloud Director
Viewing all articles
Browse latest Browse all 7719

REST API - Struggling to customise a VM at point of deployment

$
0
0

Hi folks. I'm trying to build some automation around deploying new VMs and vApps etc. I have an existing vApp, and would like to deploy a new VM into it from a Catalog Item. So far, that seems to work if I only specify the bare minimum <source> element, and I end up with a clone of the template VM with the same name.

 

If I want to specify a new name however, I get a 400 BAD_REQUEST response with the error "The parameter is not supported in the current context: VmGeneralParamsType".

 

For example, this works and deploys a vanilla VM from the Catalog:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<RecomposeVAppParams

xmlns="http://www.vmware.com/vcloud/v1.5"

xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"

    xmlns:environment_1="http://schemas.dmtf.org/ovf/environment/1">

    <SourcedItem>

        <Source href="https://api.vcd.local/api/vAppTemplate/vappTemplate-b1490f4a-86e0-4095-b258-2e7062ee0335" />

    </SourcedItem>

</RecomposeVAppParams>

 

But this one fails with the error:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<RecomposeVAppParams

xmlns="http://www.vmware.com/vcloud/v1.5"

xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"

    xmlns:environment_1="http://schemas.dmtf.org/ovf/environment/1">

    <SourcedItem>

    <Source href="https://api.vcd.local/api/vAppTemplate/vappTemplate-b1490f4a-86e0-4095-b258-2e7062ee0335" />

        <VmGeneralParams>

            <Name>new-vm-name</Name>

            <Description>New VM Description</Description>

            <NeedsCustomization>true</NeedsCustomization>

        </VmGeneralParams>

    </SourcedItem>

</RecomposeVAppParams>

 

As far as I can determine from the docs, the elements are correct and even in the correct order.

 

As it may be relevant, I get my Source href by:

 

  1. Call /api/catalogs/query to find the CatalogRecord for the desired catalog, and getting the href
  2. Call the href from #1 to find the CatalogItem for the version I need.
  3. Call the href from #2 to find the template Entity

Viewing all articles
Browse latest Browse all 7719

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>