Create a placement policy in Azure VMware Solution (Preview)

Important

Azure VMware Solution placement policy (Preview) is currently in preview. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews. To use the preview feature, you'll need to register both the DRS Placement Policy and Early Access features. Search for and select the features, and then select Register.

In Azure VMware Solution, clusters in a private cloud are a managed resource. As a result, the cloudadmin role can't make certain changes to the cluster from the vSphere Client, including the management of Distributed Resource Scheduler (DRS) rules.

The placement policy feature is available in all Azure VMware Solution regions. Placement policies let you control the placement of virtual machines (VMs) on hosts within a cluster through the Azure portal. When you create a placement policy, it includes a DRS rule in the specified vSphere cluster. It also includes additional logic for interoperability with Azure VMware Solution operations.

A placement policy has at least five required components:

  • Name - Defines the name of the policy and is subject to the naming constraints of Azure Resources.

  • Type - Defines the type of control you want to apply to the resources contained in the policy.

  • Cluster - Defines the cluster for the policy. The scope of a placement policy is a vSphere cluster, so only resources from the same cluster may be part of the same placement policy.

  • State - Defines if the policy is enabled or disabled. In certain scenarios, a policy might be disabled automatically when a conflicting rule gets created. For more information, see Considerations below.

  • Virtual machine - Defines the VMs and hosts for the policy. Depending on the type of rule you create, your policy may require you to specify some number of VMs and hosts. For more information, see Placement policy types below.

Prerequisites

  • You must have Contributor level access to the private cloud to manage placement policies.

  • DRS Placement Policy and Early Access features are registered.

Placement policy types

VM-VM policies

VM-VM policies specify if selected VMs should run on the same host or kept on separate hosts. In addition to choosing a name and cluster for the policy, VM-VM policies requires that you select at least two VMs to assign. The assignment of hosts isn't required or permitted for this policy type.

  • VM-VM Affinity policies instruct DRS to try keeping the specified VMs together on the same host. It's useful for performance reasons, for example.

  • VM-VM Anti-Affinity policies instruct DRS to try keeping the specified VMs apart from each other on separate hosts. It's useful in scenarios where a problem with one host doesn't affect multiple VMs within the same policy.

VM-Host policies

VM-Host policies specify if selected VMs can run on selected hosts. To avoid interference with platform-managed operations such as host maintenance mode and host replacement, VM-Host policies in Azure VMware Solution are always preferential (also known as "should" rules). Accordingly, VM-Host policies may not be honored in certain scenarios. For more information, see Monitor the operation of a policy below.

Certain platform operations dynamically update the list of hosts defined in VM-Host policies. For example, when you delete a host that is a member of a placement policy, the host is removed if more than one host is part of that policy. Also, if a host is part of a policy and needs to be replaced as part of a platform-managed operation, the policy is updated dynamically with the new host.

In addition to choosing a name and cluster for the policy, a VM-Host policy requires that you select at least one VM and one host to assign to the policy.

  • VM-Host Affinity policies instruct DRS to try running the specified VMs on the hosts defined.

  • VM-Host Anti-Affinity policies instruct DRS to try running the specified VMs on hosts other than those defined.

Considerations

Cluster scale in

Azure VMware Solution attempts to prevent certain DRS rule violations from occurring when performing cluster scale-in operations.

You can't remove the last host from a VM-Host policy. However, if you need to remove the last host from the policy, you can remediate it by adding another host to the policy before removing the host from the cluster. Alternatively, you can delete the placement policy before removing the host.

You can't have a VM-VM Anti Affinity policy with more VMs than the number of hosts in a cluster. If removing a host would result in fewer hosts in the cluster than VMs, you'll receive an error preventing the operation. You can remediate it by first removing VMs from the rule and then removing the host from the cluster.

Rule conflicts

If DRS rule conflicts are detected when you create a VM-VM policy, it results in that policy being created in a disabled state following standard VMware DRS Rule behavior. For more information on viewing rule conflicts, see Monitor the operation of a policy below.

Create a placement policy

There is no defined limit to the number of policies that you create. However, the more placement constraints you create, the more challenging it is for vSphere DRS to effectively move virtual machines within the cluster and provide the resources needed by the workloads.

Make sure to review the requirements for the policy type.

  1. In your Azure VMware Solution private cloud, under Manage, select Placement policies > + Create.

    Tip

    You may also select the Cluster from the Placement Policy overview pane and then select Create.

    Screenshot showing an alternative option for creating a placement policy.

    Screenshot showing how to start the process to create a VM-VM placement policy.

  2. Provide a descriptive name, select the policy type, and select the cluster where the policy is created. Then select Enable.

    Warning

    If you disable the policy, then the policy and the underlying DRS rule are created, but the policy actions are ignored until you enable the policy.

    Screenshot showing the placement policy options.

  3. If you selected VM-Host affinity or VM-Host anti-affinity as the type, select + Add host and the hosts to include in the policy. You can select multiple hosts.

    Note

    The select hosts pane shows how many VM-Host policies are associated with the host and the total number of VMs contained in those associated policies.

    Screenshot showing the number of VM-Host policies associated with the host along with the number of VMs contained in those associated policies.

  4. Select + Add virtual machine and the VMs to include in the policy. You can select multiple VMs.

    Screenshot showing the list of VMs to select.

    Note

    The select hosts pane shows how many VM-Host policies are associated with the host and the total number of VMs contained in those associated policies.

  5. Once you've finished adding the VMs you want, select Add virtual machines.

  6. Select Next: Review and create to review your policy.

  7. Select Create policy. If you want to make changes, select Back: Basics.

    Screenshot showing the placement policy settings before it's created.

  8. After the placement policy gets created, select Refresh to see it in the list.

    Screenshot showing the placement policy as Enabled after it's created.

Edit a placement policy

You can change the state of a policy, add a new resource, or unassign an existing resource.

Change the policy state

You can change the state of a policy to Enabled or Disabled.

  1. In your Azure VMware Solution private cloud, under Manage, select Placement policies.

  2. For the policy you want to edit, select More (...) and then select Edit.

    Tip

    You can disable a policy from the Placement policy overview by selecting Disable from the Settings drop-down. You can't enable a policy from the Settings drop-down.

    Screenshot showing how to edit a placement policy.

  3. If the policy is enabled but you want to disable it, select Disabled and then select Disabled on the confirmation message. Otherwise, if the policy is disabled and you want to enable it, select Enable.

  4. Select Review + update.

  5. Review the changes and select Update policy. If you want to make changes, select Back: Basics.

Update the resources in a policy

You can add new resources, such as a VM or a host, to a policy or remove existing ones.

  1. In your Azure VMware Solution private cloud, under Manage, select Placement policies.

  2. For the policy you want to edit, select More (...) and then Edit.

    Screenshot showing how to edit the resources in a placement policy.

    • To remove an existing resource, select one or more resources you want to remove and select Unassign.

      Screenshot showing how to remove an existing resource from a placement policy.

    • To add a new resource, select Edit virtual machine or Edit host, select the resource you'd like to add, and then select Save.

  3. Select Next : Review and update.

  4. Review the changes and select Update policy. If you want to make changes, select Back : Basics.

Delete a policy

You can delete a placement policy and its corresponding DRS rule.

  1. In your Azure VMware Solution private cloud, under Manage, select Placement policies.

  2. For the policy you want to edit, select More (...) and then select Delete.

    Screenshot showing how to delete a placement policy.

  3. Select Delete on the confirmation message.

Monitor the operation of a policy

Use the vSphere Client to monitor the operation of a placement policy's corresponding DRS rule.

As a holder of the cloudadmin role, you can view, but not edit, the DRS rules created by a placement policy on the cluster's Configure tab under VM/Host Rules. It lets you view additional information, such as if the DRS rules are in a conflict state.

Additionally, you can monitor various DRS rule operations, such as recommendations and faults, from the cluster's Monitor tab.

FAQs

Are these the same as DRS affinity rules?

Yes, and no. While vSphere DRS implements the current set of policies, we have simplified the experience. Modifying VM groups and Host groups are a cumbersome operation, especially as hosts are ephemeral in nature and could be replaced in a cloud environment. As hosts are replaced in the vSphere inventory in an on-premises environment, the vSphere admin must modify the host group to ensure that the desired VM-Host placement constraints remain in effect. Placement policies in Azure VMware Solution update the Host groups when a host is rotated or changed. Similarly, if you scale in a cluster, the Host Group is automatically updated, as applicable. This eliminates the overhead of managing the Host Groups for the customer.

As this is an existing functionality available in vCenter, why can't I use it directly?

Azure VMware Solution provides a VMware private cloud in Azure. In this managed VMware infrastructure, Microsoft manages the clusters, hosts, datastores, and distributed virtual switches in the private cloud. At the same time, the tenant is responsible for managing the workloads deployed on the private cloud. As a result, the tenant administering the private cloud does not have the same set of privileges as available to the VMware administrator in an on-premises deployment.

Further, the lack of the desired granularity in the vSphere privileges presents some challenges when managing the placement of the workloads on the private cloud. For example, vSphere DRS rules commonly used on-premises to define affinity and anti-affinity rules can't be used as-is in a VMware Cloud environment, as some of those rules can block day-to-day operation the private cloud. Placement Policies provides a way to define those rules using the Azure VMware Solution portal, thereby circumventing the need to use DRS rules. Coupled with a simplified experience, they also ensure that the rules don't impact the day-to-day infrastructure maintenance and operation activities.

What caveats should I know about?

The VM-Host MUST rules aren't supported because they block maintenance operations.

VM-Host SHOULD rules are preferential rules, where vSphere DRS tries to accommodate the rules to the extent possible. Occasionally, vSphere DRS may vMotion VMs subjected to the VM-Host SHOULD rules to ensure that the workloads get the resources they need. It's a standard vSphere DRS behavior, and the Placement policies feature does not change the underlying vSphere DRS behavior.

If you create conflicting rules, those conflicts may show up on the vCenter, and the newly defined rules may not take effect. It's a standard vSphere DRS behavior, the logs for which can be observed in the vCenter.