vSphere vMotion Notifications

vSphere vMotion is easily one of the best features in vSphere and virtualization in-general, and often taken for granted. It allows for almost all virtual machines to be seamlessly migrated and moved without any impact whatsoever to the virtual machine and applications running within. What about those very few cases where using vSphere vMotion may impact an application? Applications that are very sensitive to latency, applications that are clustered and span multiple virtual machines and distributed databases, just to name a few examples.

With vMotion notifications, these applications can have improved interoperability with vSphere vMotion.

Reduce Outages by Preparing Applications for Migration

As mentioned, certain applications cannot tolerate the stuns associated with vSphere vMotion. These applications can be written to be migration aware to improve their interoperability with vSphere vMotion. Applications can prepare for a migration event. This could be gracefully stopping services, quiescing the application, performing a failover in the case of a clustered application or other operations. The application can delay the start of the migration up until the configured timeout but cannot decline or prevent the migration from occurring.

vMotion Notification Animation

Fig 1 shows an animation of the vMotion notification process.

Applications register, using VMware Tools, and can be notified of impending vMotion tasks. A notification is received by the application indicating that the VM will be migrated. The Application can respond to this notification as desired. The application sends an acknowledgement that the migration can proceed. The VM is migrated using vSphere vMotion. A migration end notification is received by the application, and it can respond as needed based on the preparation work performed before the migration.

Activate vMotion Notifications for Applications

vMotion notifications is not activated by default and must be configured on a per-VM basis. VMs configured for vMotion notifications are excluded from vSphere DRS automatic migrations for resource balancing but are included if a host is placed into maintenance mode.

Set Virtual Machine configuration setting

In the virtual machine, an advanced setting vmOpNotificationToAppEnabled must be set to a value of True.

vMotion Notification VM Settings

Fig 2 shows virtual machine advanced settings.

Configure host level timeout

The host-level timeout is configured using the vSphere APIs and the advanced setting vmOpNotificationToApp.Timeout with a value greater than 0. The value configured is in seconds.

For example, to set a timeout of 5 minutes, use a value of 300.

Use the ConfigManager APIs to set a value to this configuration property. See the vSphere Web Services API reference documentation.

Register for notifications

Applications use the VMware Tools vmtoolsd command line utility to register for notifications.

The available vmtoolsd commands are:

  • vm-operation-notification.register
  • vm-operation-notification.unregister
  • vm-operation-notification.list
  • vm-operation-notification.check-for-event
  • vm-operation-notification.ack-event

For example, to register for notifications the following command syntax is used

vmtoolsd --cmd "vm-operation-notification.register {"appName": ”demo", "notificationTypes": ["sla-miss"]} ”

Requirements

vSphere vMotion notifications requires vSphere to be running version 8 and VMs to be using hardware version 20. For the guest operating system, VMware Tools, or Open VM Tools, must be installed and running a minimum of version 11.0.

However, we do recommend running the latest version of VMware Tools, especially when running the latest virtual hardware version.

Demo

In this demo video, we will observe how vMotion notifications can delay a vMotion event allowing an application to prepare for the migration.

 

Learn More

Resources

Filter Tags

ESXi 8 vCenter Server 8 vSphere 8 vMotion Document