Temporarily Disable WLB to Prevent Unintended VM Migrations During Resource Spikes

book

Article ID: CTX696554

calendar_today

Updated On:

Description

To prevent these migrations, administrators can automate the disabling of WLB during the maintenance window and re-enabling it once the tasks are complete. These steps must be performed on the WLB Virtual Appliance.

Step 1: Create the WLB Control Script on the Appliance

1. Log in to the Workload Balancing Appliance via SSH (using the root credentials).

2. Create the script: /opt/upx/wlb/wlb-status.sh

3. Paste the following code, then ave the script

#!/bin/bash
status=$1
# Retrieve the Pool UUID from the connected Citrix Hypervisor
pool_uuid=$(xe pool-list | grep uuid | awk '{print $5}')

if [ "$status" = "enable" ]; then
  xe pool-param-set uuid=$pool_uuid other-config:WlbConnectionStatus=Enabled wlb-enabled=true
  echo "WLB Connection Status set to Enabled."
elif [ "$status" = "disable" ]; then
  xe pool-param-set uuid=$pool_uuid other-config:WlbConnectionStatus=Disabled wlb-enabled=false
  echo "WLB Connection Status set to Disabled."
else
  echo "Usage: $0 [enable|disable]"
fi

4. Grant execute permissions: chmod +x /opt/upx/wlb/wlb-status.sh

Step 2: Schedule the Automation via Appliance Crontab

Open the crontab on the WLB appliance: crontab -e
Add the following lines to disable WLB and re-enable it (For example: disable at 1:00 AM and re-enable it at 4:00 AM)

0 1 * * * /opt/upx/wlb/wlb-status.sh disable
0 4 * * * /opt/upx/wlb/wlb-status.sh enable

Step 3: Reschedule WLB Internal Maintenance

The WLB appliance has a built-in maintenance job located at /opt/upx/wlb/wlbmaintenance.sh. By default, this runs at 12:05 AM UTC. To avoid conflicts with the new schedule, it is recommended to move this job to run after WLB is re-enabled.

While still in crontab -e, locate the existing maintenance line:  

05 0 * * * /opt/upx/wlb/wlbmaintenance.sh

You can change the time to 4:15 AM (or any time after WLB is enabled):

15 4 * * * /opt/upx/wlb/wlbmaintenance.sh

Issue/Introduction

This KB article provides a solution for preventing unwanted VM migrations triggered by Workload Balancing (WLB) during resource-intensive maintenance windows (e.g., nightly anti-virus scans).

The core of the solution involves SSHing into the WLB Appliance to create a control script that toggles WLB's status between Enabled and Disabled. By using the appliance's crontab, administrators can automate this process—disabling WLB just before the scans begin and re-enabling it once they finish. Additionally, the article advises rescheduling the default WLB maintenance job (wlbmaintenance.sh) to run after the system is re-enabled to ensure task continuity and avoid resource contention.

In environments with Workload Balancing (WLB) enabled, resource-intensive scheduled tasks—such as Antivirus scans or backups—can trigger WLB performance thresholds. This results in "unwanted" VM migrations during the night as WLB attempts to rebalance the pool based on temporary spikes in utilization.