You can retrieve the list of virtual machines in the inventory of a vCenter server that is registered to a cloud. To retrieve the list, make a GET request to the server's vmsList link.

When you import a virtual machine from vCenter, your request must supply a reference to the vCenter server and a VIM object reference to the virtual machine. See Finding Available vCenter Resources.

Prerequisites

This operation is restricted to system administrators.

Procedure

  1. Retrieve the XML representation of a vCenter server registered to your cloud.
  2. Examine the response, a VimServer element, to locate the vmsList link.
    This link has the following form:
    <vcloud:Link
       rel="down"
       type="application/vnd.vmware.admin.vmsObjectRefsList+xml"
       href="https://vcloud.example.com/api/admin/extension/vimServer/9/vmsList" />
  3. GET the URL in the value of this link's href attribute to retrieve the list of virtual machines.
    See the request portion of Retrieve a List of Virtual Machines from a vCenter Server. If the list is empty, there are no virtual machines in the server's inventory.

Example: Retrieve a List of Virtual Machines from a vCenter Server

Request:
GET https://vcloud.example.com/api/admin/extension/vimServer/9/vmsList
Response:
200 OK
Content-Type: application/vnd.vmware.admin.vmsobjectrefslist+xml
...
<vmext:VmObjectRefsList
   xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5"
   page="1"
   numberOfPages="1"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ... >
   <vmext:VmObjectRef
      name="RH5u3_32bit">
      <vmext:VimServerRef
         type="application/vnd.vmware.admin.vmwvirtualcenter+xml"
         name="vc2-v41u1"
         href="https://vcloud.example.com/api/admin/extension/vimServer/9" />
      <vmext:MoRef>vm-41</vmext:MoRef>
      <vmext:VimObjectType>VIRTUAL_MACHINE</vmext:VimObjectType>
   </vmext:VmObjectRef>
   <vmext:VmObjectRef
      name="W2K3 64 R2">
      <vmext:VimServerRef
         type="application/vnd.vmware.admin.vmwvirtualcenter+xml"
         name="vc2-v41u1"
         href="https://vcloud.example.com/api/admin/extension/vimServer/9" />
      <vmext:MoRef>vm-43</vmext:MoRef>
      <vmext:VimObjectType>VIRTUAL_MACHINE</vmext:VimObjectType>
   </vmext:VmObjectRef>
   <vmext:VmObjectRef
      name="Ubuntu91_32_vt4">
      <vmext:VimServerRef
         type="application/vnd.vmware.admin.vmwvirtualcenter+xml"
         name="vc2-v41u1"
         href="https://vcloud.example.com/api/admin/extension/vimServer/9" />
      <vmext:MoRef>vm-44</vmext:MoRef>
      <vmext:VimObjectType>VIRTUAL_MACHINE</vmext:VimObjectType>
   </vmext:VmObjectRef>
</vmext:VmObjectRefsList>