A VM group is a collection of virtual machines with similar host requirements. The virtual machines must all be in the same resource pool.

Prerequisites

You must be a system administrator to create or update a VM group.

Procedure

  1. VM groups are properties of a resource pool. Select a resource pool from the Resource Pools list under vSphere Properties.
    VM groups in the resource pool are listed on its VM Groups tab. To see a list of all VM groups in all resource pools, click VM Groups under vSphere Properties.
    Each VMWProviderVdcResourcePool element in a VMWProviderVdcResourcePoolSet response includes links that you can use to create or update VM groups in the resource pool.
    <?xml version="1.0" encoding="UTF-8"?>
    <VMWProviderVdcResourcePoolSet ...>
       ...
       <VMWProviderVdcResourcePool
          primary="true">
          <Link
             rel="migrateVms"
             href="https://vcloud.example.com/api/admin/extension/resourcePool/83/action/migrateVms" />
          <Link
             rel="resourcePoolVmList"
             href="https://vcloud.example.com/api/admin/extension/resourcePool/83/vmList" />
          <Link
             rel="down"
             href="https://vcloud.example.com/api/admin/extension/resourcePool/83/hostGroups"
             type="application/vnd.vmware.admin.vmwHostGroupsType+xml" />
          <Link
             rel="down"
             href="https://vcloud.example.com/api/admin/extension/resourcePool/83/vmGroups"
             type="application/vnd.vmware.admin.vmwVmGroupType+xml" />
          <Link
             rel="add"
             href="https://vcloud.example.com/api/admin/extension/resourcePool/83/vmGroups"
             type="application/vnd.vmware.admin.vmwVmGroupType+xml" />
          <Link
             rel="down"
             href="https://vcloud.example.com/api/admin/extension/resourcePool/83/rules"
             type="application/vnd.vmware.admin.vmwVmHostAffinityRules+xml" />
          ...
       </VMWProviderVdcResourcePool>
       ...
    </VMWProviderVdcResourcePoolSet>
  2. To create a VM group in the resource pool, click the plus sign icon on the VM Groups tab to open the Create VM Group window.
    Give the group a name and click OK.
    After the system creates the group, you can add VMs to it.
  3. To edit a VM group to add or remove VMs, click VM Groups under vSphere Properties, then right-click the group name in the VM Groups list and select Edit.
    Option Action
    Add VMs to the group Select one or more VMs from the upper table and click Add.
    Remove VMs from the group Select one or more VMs from the lower table and click Remove.
  4. To create a VM group in the resource pool, make a POST request to the add link for vmGroups.
    The request body is a VMWVmGroup element. See Create a VM Group.

Example: Create a VM Group

The request body specifies a name for the group.

Request:

POST https://vcloud.example.com/api/admin/extension/resourcePool/83/vmGroups
Content-type: application/vnd.vmware.admin.vmwVmGroupType+xml
...
<VMWVmGroup
   xmlns="http://www.vmware.com/vcloud/extension/v1.5"
   xmlns:vcloud_v1.5="http://www.vmware.com/vcloud/v1.5">
   <VmGroupName>ExampleGroup</VmGroupName>
</VMWVmGroup>
The response is a Task. When the task completes, you can retrieve the vmGroups in the resource pool to see the new VM Group. The system supplies a unique identifier and a count of VMs, initially 0, in the group.
GET https://vcloud.example.com/api/admin/extension/resourcePool/83/vmGroups
...
<vmext:VMWVmGroups ...>
   <vmext:VmGroup
      href="https://vcloud.example.com/api/admin/extension/vmGroup/34">
      <vcloud:Link
         rel="remove"
         href="https://vcloud.example.com/api/admin/extension/vmGroup/34" />
      <vcloud:Link
         rel="down"
         href="https://vcloud.example.com/api/admin/extension/vmGroup/34/vmsList"
         type="application/vnd.vmware.vcloud.VmGroupVmsRecord+xml" />
      <vcloud:Link
         rel="addVms"
         href="https://vcloud.example.com/api/admin/extension/vmGroup/name/foo/action/addVms"
         type="application/vnd.vmware.vcloud.vms+xml" />
      <vcloud:Link
         rel="removeVms"
         href="https://vcloud.example.com/api/admin/extension/vmGroup/name/foo/action/removeVms"
         type="application/vnd.vmware.vcloud.vms+xml" />
      <vmext:VmGroupId>34</vmext:VmGroupId>
      <vmext:VmGroupName>ExampleGroup</vmext:VmGroupName>
      <vmext:vmCount>0</vmext:vmCount>
   </vmext:VmGroup>
   ...
</vmext:VMWVmGroups>