From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id EC4911FF0C0 for ; Wed, 18 Nov 2026 12:07:53 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 6D249200A8; Wed, 18 Nov 2026 12:07:19 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH guest-common,ha-manager,manager,docs 0/15] cluster resource scheduling for all guests Date: Wed, 18 Nov 2026 12:05:07 +0100 Message-ID: <20261118110705.595989-1-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795000030165 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.175 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: VAHNMZASVNNHWUYF4652G4T22CKPRRRD X-Message-ID-Hash: VAHNMZASVNNHWUYF4652G4T22CKPRRRD X-MailFrom: t.lamprecht@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: So far only the HA stack can use the balancing of the cluster resource scheduler (CRS), this series makes it more easily available for all guests on demand: - The migrate dialog sorts the target nodes by how well a migration there would balance the cluster load, and preselects the best one. - A new "Rebalance Guests" bulk action opens the bulk migrate dialog with a rebalance proposal, whose targets can be adjusted per guest before migrating. The cluster stat gathering and the scheduler wrapper move into a new library in pve-guest-common, with the HA manager switched to using that too. The new API endpoints only rank nodes and estimate the resulting imbalance. Whether a migration is possible at all is still decided by the existing migrate preconditions. HA-managed guests are only proposed for nodes their HA rules allow. Guests in a positive resource affinity are not proposed, as HA always moves such a group as a whole. The first two ha-manager patches are independent fixes found along the way. A related fix for static mode mispredicting the migration of containers without a CPU limit touches proxmox-resource-scheduling and pve-rs, and will follow as a separate series. Besides the new unit and API tests, I tested this on an actual three-node cluster with HA, including running proposed migrations through bulk migrate, but some more testing would be certainly good to have. Repo (build-)dependencies: pve-manager -> pve-ha-manager -> pve-guest-common pve-guest-common: Thomas Lamprecht (1): scheduling: add cluster resource scheduling library debian/control | 2 + src/Makefile | 4 + src/PVE/ResourceScheduling/Planner.pm | 716 +++++++ src/PVE/ResourceScheduling/Scheduler.pm | 164 ++ src/PVE/ResourceScheduling/Stats.pm | 194 ++ src/tests/Makefile | 21 +- .../resource-scheduling-planner-tests.pl | 1775 +++++++++++++++++ .../resource-scheduling-scheduler-tests.pl | 230 +++ src/tests/resource-scheduling-stats-tests.pl | 260 +++ 9 files changed, 3364 insertions(+), 2 deletions(-) pve-ha-manager: Thomas Lamprecht (5): helpers: block both locations of a migrating negative affinity partner usage: static: count services per node again for scoring fallback config: allow getting motion info of many resources at once env: pve2: delegate cluster stat gathering to scheduling library usage: share one scheduler base between static and dynamic debian/control | 2 + debian/pve-ha-manager.install | 1 + src/PVE/HA/Config.pm | 83 +++++++--- src/PVE/HA/Env/PVE2.pm | 155 ++++------------- src/PVE/HA/Helpers.pm | 4 +- src/PVE/HA/Usage/Dynamic.pm | 145 +--------------- src/PVE/HA/Usage/Makefile | 2 +- src/PVE/HA/Usage/Scheduler.pm | 175 ++++++++++++++++++++ src/PVE/HA/Usage/Static.pm | 157 +----------------- src/test/Makefile | 2 + src/test/test_resource_motion_info.pl | 228 ++++++++++++++++++++++++++ src/test/test_usage_fallback.pl | 77 +++++++++ 12 files changed, 585 insertions(+), 446 deletions(-) pve-manager: Thomas Lamprecht (8): ui: bulk action: translate error title and CT restart warning ui: bulk migrate: show CT restart warning for cluster-wide migration ui: migrate: recheck preconditions if the target changed meanwhile api: cluster: add resource scheduling endpoints ui: migrate: sort target nodes by scheduler recommendation api: bulk migrate: allow a per-guest target node mapping ui: bulk migrate: support per-guest target nodes ui: dc: add a Rebalance Guests bulk action PVE/API2/Cluster.pm | 7 + PVE/API2/Cluster/BulkAction/Guest.pm | 100 ++++- PVE/API2/Cluster/Makefile | 3 +- PVE/API2/Cluster/ResourceScheduling.pm | 413 ++++++++++++++++++++ test/BulkMigrate_test.pl | 204 ++++++++++ test/Makefile | 10 +- test/ResourceScheduling_test.pl | 454 ++++++++++++++++++++++ www/manager6/Makefile | 1 + www/manager6/dc/CmdMenu.js | 21 + www/manager6/dc/Config.js | 16 + www/manager6/form/VMSelectorWithTarget.js | 202 ++++++++++ www/manager6/window/BulkAction.js | 173 ++++++++- www/manager6/window/Migrate.js | 164 ++++++++ 13 files changed, 1752 insertions(+), 16 deletions(-) pve-docs: Thomas Lamprecht (1): pvecm: document balancing the cluster load with migrations ha-manager.adoc | 4 ++++ pvecm.adoc | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) -- 2.47.3