VMware Cloud Community
miskaste
Contributor
Contributor
Jump to solution

Capture vApp to template via API

Hi,

I want to create template from vApp and also as parameter include vdc compute policy. Main goal is separate win OS on selected hosts.

Successfully created  template via API without "CaptureVmParams" elements, but when I add these parameters call fails with 500 error code.

VM link I think is correct because I can browse VM parameters using this link also VDC policy is in place. What I'm missing?

POST https://1.1.1.1/api/catalog/f4382924-bf6c-44f0-9c0a-7263e5bab8db/action/captureVApp

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

<CaptureVAppParams

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

   name="Example Corp’s CRM Appliance">

   <Description>Captured CRM Appliance</Description>

   <Source

      href="https://1.1.1.1/api/vApp/vapp-bcb173ad-3c43-4f38-8d4d-29c294ea3a21" />

   <CaptureVmParams>

         <Source href="https://1.1.1.1/api/vApp/vm-e0b95812-88e1-4bf7-81f4-da630335ebc4" />

  <VdcComputePolicy

        href="https://1.1.1.1/cloudapi/1.0.0/vdcComputePolicies/urn:vcloud:vdcComputePolicy:87d220b1-2ff7-4e9b-bd2..."

          name="WIN" />

</CaptureVmParams>

  </CaptureVAppParams>

Thanks!

0 Kudos
1 Solution

Accepted Solutions
miskaste
Contributor
Contributor
Jump to solution

Experimenting I found solution when include compute policy ID then I can capture vApp to template.

After that when deploying VM from template it have correct  compute policy and host-affinity rules will place VM's

on specified ESXi hosts.

Something like this:

<CaptureVmParams>

    <Source href="  " />

    <VdcComputePolicy

         href="   "

         id="  "

         name="   " />

   </CaptureVmParams>

View solution in original post

0 Kudos
1 Reply
miskaste
Contributor
Contributor
Jump to solution

Experimenting I found solution when include compute policy ID then I can capture vApp to template.

After that when deploying VM from template it have correct  compute policy and host-affinity rules will place VM's

on specified ESXi hosts.

Something like this:

<CaptureVmParams>

    <Source href="  " />

    <VdcComputePolicy

         href="   "

         id="  "

         name="   " />

   </CaptureVmParams>

0 Kudos