vCloud

 View Only
  • 1.  API Call to Migrate VM Between Resource Pools

    Posted Nov 09, 2020 03:41 PM

    Hello All,

    After upgrading our vCloud instances to version 10, we've found that the ability to migrate VMs between resource pools has been removed from the GUI. Support tells us this functionality is still possible, but only through an API call:

    I've searched through VMware's documentation but can only find very sparse info on this API call. I did locate an example on Tom Fojta's blog... from 2013 - https://fojta.wordpress.com/2013/01/13/vcloud-director-online-migration-of-virtual-data-center/

    When I craft a query and requisite parameters based on that example, I get a 404 error in return. I'm able to query each entity separately, so I'm not sure what is triggering the 404. I'm guessing the API call has changed since his post 7 years ago.

    Here is the body of my request:

     Has anyone used this API call before who might be able to give me a clue as to what I'm getting wrong?

    Thanks



  • 2.  RE: API Call to Migrate VM Between Resource Pools

    Broadcom Employee
    Posted Nov 10, 2020 04:30 PM

    Here is a sample request that is known to work (it's part of the vCD test suite): 

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <ns2:MigrateParams xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ns2="http://www.vmware.com/vcloud/extension/v1.5" xmlns:ns3="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:ns4="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ns5="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ns6="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:ns7="http://www.vmware.com/schema/ovf" xmlns:ns8="http://schemas.dmtf.org/ovf/environment/1" xmlns:ns9="http://www.vmware.com/vcloud/versions">
    <ns2:VmRef href="https://wdc-vcd-sp-static-34-49.eng.vmware.com/api/vApp/vm-a7dcd89e-23a0-480e-9090-ef91cec094da" id="urn:vcloud:vm:a7dcd89e-23a0-480e-9090-ef91cec094da" name="vm-1" type="application/vnd.vmware.vcloud.vm+xml"/>
    <ns2:ResourcePoolRef>
    <ns2:VimServerRef href="https://wdc-vcd-sp-static-34-49.eng.vmware.com/api/admin/extension/vimServer/40412aad-523d-406a-8257-e67d3d079b3f" id="urn:vcloud:vimserver:40412aad-523d-406a-8257-e67d3d079b3f" name="vc1" type="application/vnd.vmware.admin.vmwvirtualcenter+xml"/>
    <ns2:MoRef>resgroup-273</ns2:MoRef>
    <ns2:VimObjectType>RESOURCE_POOL</ns2:VimObjectType>
    </ns2:ResourcePoolRef>
    </ns2:MigrateParams>

    I think you are missing proper IDs in your handcrafted body.

     



  • 3.  RE: API Call to Migrate VM Between Resource Pools

    Posted Nov 11, 2020 06:23 AM

    Thanks for the reply!

    I tried using the sample you posted but I still get the same 404 response.

    Is there any way to determine which ID might be wrong? I'm able to successfully query the VM ID and the vCenter server ID, so I have at least confirmed that the IDs I'm supplying are valid.

    I tried running the request without the "ResourcePoolRef" parameter just to see what would happen (since the documentation indicates it is optional) and I get the same 404. I feel like I'm missing something basic.



  • 4.  RE: API Call to Migrate VM Between Resource Pools
    Best Answer

    Posted Nov 20, 2020 08:52 PM

    I was able to figure this out with some help from support. I was using the incorrect header value for "Content-Type" and a glitch in my Postman instance was preventing me from changing it. Reinstalled Postman and was able to supply the correct header which is "application/vnd.vmware.admin.migrateVmParams+xml"



  • 5.  RE: API Call to Migrate VM Between Resource Pools

    Posted Feb 22, 2021 01:31 PM

    Hi jrapine

    I was in contact with vmware too.

    I got the same manual as you. But at my vCloud Director ist doesn't really work as ist should.

    When I run the POST statement the system create a resource pool at the destination I want, but the vm doesn't move to the created resource pool.

    Do you got something similar?

    Thanks