Search code examples
vcloud-director-rest-api

vCloudDirector API can`t change instantiation params for vApp


Currently I was stopped by problem that I need to change my instantiation params programmatically to have possibility to run instances with different CPU number and Memory size.

I found out that I need to use InstantiateVAppTemplateParamsType (link below) https://code.vmware.com/apis/442/vcloud-director/doc/doc/types/InstantiateVAppTemplateParamsType.html

I found out how to start VApp with this parameters WITHOUT customization by simplifying params to:

<?xml version="1.0" encoding="UTF-8"?>
<InstantiateVAppTemplateParams
        xmlns="http://www.vmware.com/vcloud/v1.5"
        name="$TEMPLATE_NAME"
        deploy="true"
        powerOn="true"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">
    <Description>$TEMPLATE_DESCRIPTION</Description>
    <Source
            href="$SOURCE_TEMPLATE" />
</InstantiateVAppTemplateParams>

Now I'm frustrated because I can't build parameters for API to consume it and create vApp with customized VM.

I found information about InstantiationParamsType (link below) https://code.vmware.com/apis/442/vcloud-director/doc/doc/types/InstantiationParamsType.html

But I can`t build them properly to retrieve normal response instead of BAD_REQUEST.

Thanks in advance.

P.S. I`m using vCloudDirector API 9.5


Solution

  • Ok, issue was that I coppied VirtualHardwareSection from VMWare API guide which was in PDF, which broke my encoding.

    After that I found guide for service providers (link below)

    https://code.vmware.com/docs/6899/vcloud-api-programming-guide-for-service-providers/doc/GUID-BF9B790D-512E-4EA1-99E8-6826D4B8E6DC.html

    And after taking xml-snippet from there everything worked as was expected from documentation.