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:
I have the same problema here.
Sad about this is that documentation dont say anything about this error.
I can't rename VM using this call on vCLOUD api.
Indeed using VmGeneralParamsType in this scenario fails (correctly) with a BAD_REQUEST exception (I have reproduced this).
If instead you change your input to be:
<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" name="XXX"/>
</SourcedItem>
</RecomposeVAppParams>
then the name attribute is completely ignored. This means there's no way to rename a VM on the fly in recompose when the input comes from a vAppTemplate.
Changing this is a feature request.
Note however that if all you do is use recomposeVApp to reconfigure a VM and rename it, then that works. So you can solve your problem by doing 2 recomposes: 1 to instantiate the template, and another 1 to rename the VM.