From 24acbe09364f82134ff773b785d26a79631bbb88 Mon Sep 17 00:00:00 2001 From: "yaohua.wu" Date: Fri, 22 May 2026 11:22:28 +0800 Subject: [PATCH] [header]: add VM migrate host-constraint extension point Introduce VmMigrateHostConstraintExtensionPoint so that components can report VMs pinned to their current host by passthrough devices. 1. Why is this change necessary? DRS automatic load balancing kept generating migration tasks for VMs that hold passthrough devices (physical PCI / dGPU / mdev). Such VMs cannot be live-migrated, so every advised migration was bound to fail. DRS had no way to learn which VMs are pinned to their host. 2. How does it address the problem? A new extension point, VmMigrateHostConstraintExtensionPoint, lets device-owning components report the subset of candidate VMs that cannot be migrated off their current host. DRS queries it before building migration advice. VF / vDPA NIC devices are intentionally excluded since they support migration. 3. Are there any side effects? None. The interface only adds a new query extension point and does not change existing behavior on its own. # Summary of changes (by module): - header: add VmMigrateHostConstraintExtensionPoint interface Related: ZSTAC-85208 Change-Id: Ia303bf54f47fdd54a2814d7e6b298c541f4cf4bf --- ...VmMigrateHostConstraintExtensionPoint.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 header/src/main/java/org/zstack/header/vm/VmMigrateHostConstraintExtensionPoint.java diff --git a/header/src/main/java/org/zstack/header/vm/VmMigrateHostConstraintExtensionPoint.java b/header/src/main/java/org/zstack/header/vm/VmMigrateHostConstraintExtensionPoint.java new file mode 100644 index 00000000000..5a212c5a6fd --- /dev/null +++ b/header/src/main/java/org/zstack/header/vm/VmMigrateHostConstraintExtensionPoint.java @@ -0,0 +1,23 @@ +package org.zstack.header.vm; + +import java.util.List; + +/** + * Reports VMs that are pinned to their current host and cannot be + * live-migrated because of attached passthrough devices, such as physical + * PCI passthrough devices, dGPU and mediated (mdev) devices. + * + * It is queried by DRS scheduling so that automatic load balancing skips + * such VMs instead of generating migration tasks that are bound to fail. + * + * VF / vDPA NIC devices do NOT pin a VM to its host (they have dedicated + * migration support) and therefore must NOT be reported here. + */ +public interface VmMigrateHostConstraintExtensionPoint { + /** + * @param candidateVmUuids VM uuids being considered for migration + * @return the subset of candidateVmUuids that cannot be migrated off + * their current host because of attached passthrough devices + */ + List getHostBoundVmUuids(List candidateVmUuids); +}