Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

How to Enable and Configure vMotion Application Notification Feature for a VM in vSphere

  • February 20, 2024
  • 10 min read
IT and Virtualization Consultant. Vladan is the founder, and executive editor of the ESX Virtualization Blog at vladan.fr. He is a VMware VCAP-DCA and VCAP-DCD, and has been a vExpert from 2009 to 2023.
IT and Virtualization Consultant. Vladan is the founder, and executive editor of the ESX Virtualization Blog at vladan.fr. He is a VMware VCAP-DCA and VCAP-DCD, and has been a vExpert from 2009 to 2023.

As you might know, certain applications cannot tolerate stuns that happens during vSphere vMotion. (Quick Note: stun is a time when vSphere “freezes” a VM to transfer the last bits of that VM, to the destination host. To say that simply.). Depending of the nature of the application, it might throw an error, if too sensitive. However, applications can prepare for such a migration event. For example, the app can gracefully stop services, Database, quiescing the application, performing a failover in the case of a clustered application or other operations.

Yes, one of the most popular features in vSphere is vMotion that allows you to seamlessly migrate and move almost any virtual machine (VM) without any impact to the VM and applications running within. With latest announce about VSAN MAX architecture which can scale to multiple Petabytes per cluster we no longer have to worry about hardware performance, but can more pay attention to applications running in our VMs.

However, there are some cases where using vMotion may cause a brief service interruption for certain applications that are very sensitive to latency, clustered, or distributed.

To address this challenge, vSphere 8 introduces the vMotion Application Notification Feature, which enables applications to be notified of impending vMotion tasks and prepare for them accordingly. This can improve the interoperability and availability of these applications with vMotion.

In this blog post, we will walk you through how to enable and configure the vMotion Application Notification Feature for a VM in vSphere 8.

Prerequisites

Before you begin, make sure you have the following:

  • A vSphere 8 environment with at least two ESXi hosts and a vCenter Server.
  • A VM running a supported guest operating system and VMware Tools.
  • An application that can handle vMotion notifications and perform the necessary actions to prepare for migration.
  • Access to the vSphere Client and the vSphere Web Services API.

Step 1: Set the VM configuration setting

The first step is to set the VM configuration setting vmOpNotificationToAppEnabled to True. This setting enables the vMotion Application Notification Feature for the VM and allows it to receive vMotion notifications from the ESXi host. You can set this setting using the vSphere Client or the vSphere Web Services API.

To set the setting using the vSphere Client, follow these steps:

  • In the vSphere Client, select the VM and click Configure.
  • Under Settings, click VM Options.
  • Under Advanced, click Edit Configuration.
  • Click Add Configuration Params and enter vmOpNotificationToAppEnabled as the key and True as the value.
  • Click OK to save the changes.

VM configuration setting

To set the setting using the vSphere Web Services API, follow these steps:

  • Use the RetrieveProperties method to get the configSpec property of the VM.
  • Use the ReconfigVM_Task method to set the vmOpNotificationToAppEnabled setting to True in the configSpec property.
  • See the [vSphere Web Services API reference documentation] for more details on how to use these methods.

Step 2: Configure the host-level timeout

The next step is to configure the host-level timeout for vMotion notifications. This setting determines how long the ESXi host will wait for the application to acknowledge the vMotion notification and prepare for migration. The default value is 0, which means the host will not wait and proceed with the vMotion immediately. You can set a value greater than 0 to give the application some time to respond. The value is in seconds, so for example, to set a timeout of 5 minutes, use a value of 300. You can configure this setting using the vSphere Web Services API.

To configure the setting using the vSphere Web Services API, follow these steps:

  • Use the ConfigManager property of the ESXi host to access the AdvancedOptionManager.
  • Use the UpdateOptions method to set the vmOpNotificationToApp.Timeout setting to the desired value.
  • See the [vSphere Web Services API reference documentation] for more details on how to use these methods.

Step 3: Register the application for vMotion notifications

The final step is to register the application for vMotion notifications using VMware Tools. This step requires the application to use the vmtoolsd command line utility to register and unregister for notifications. The application can also use this utility to send acknowledgements and responses to the ESXi host.

To register the application for vMotion notifications, follow these steps:

In the guest operating system of the VM, run the following command:

vmtoolsd –cmd “vm-operation-notification.register”

The application will receive a registration ID that it can use to unregister later.

Step 4: Unregister the application from vMotion notifications

To unregister the application from vMotion notifications, follow these steps:

In the guest operating system of the VM, run the following command:

vmtoolsd –cmd “vm-operation-notification.unregister <registration ID>”

The application will no longer receive vMotion notifications from the ESXi host.

vMotion notifications

There is an example video how the notification feature works on VMware site here.

Source: VMware Documentation

Final Words

In this blog post, we have shown you how to enable and configure the vMotion Application Notification Feature for a VM in vSphere 8. This feature can help you improve the interoperability and availability of your applications with vMotion, especially for those that are sensitive to latency, clustered, or distributed. We hope you find this feature useful and we welcome your feedback and suggestions.

vSphere 8 is the latest version of VMware’s enterprise workload platform that brings the benefits of cloud to on-premises workloads. It combines industry-leading cloud infrastructure technology with DPU and GPU-based acceleration to boost workload performance. vSphere 8 also introduces the Distributed Services Engine, a new feature that unlocks the power of Data Processing Units (DPUs) for hardware accelerated data processing to improve infrastructure performance, security, and management.

Found Vladan’s article helpful? Looking for a reliable, high-performance, and cost-effective shared storage solution for your production cluster?
Dmytro Malynka
Dmytro Malynka StarWind Virtual SAN Product Manager
We’ve got you covered! StarWind Virtual SAN (VSAN) is specifically designed to provide highly-available shared storage for Hyper-V, vSphere, and KVM clusters. With StarWind VSAN, simplicity is key: utilize the local disks of your hypervisor hosts and create shared HA storage for your VMs. Interested in learning more? Book a short StarWind VSAN demo now and see it in action!