Skip to content

Comments

<fix>[compute]: respect vm.migrationQuantity during host maintenance#3374

Open
zstack-robot-1 wants to merge 1 commit into5.5.12from
sync/ye.zou/fix/ZSTAC-81354
Open

<fix>[compute]: respect vm.migrationQuantity during host maintenance#3374
zstack-robot-1 wants to merge 1 commit into5.5.12from
sync/ye.zou/fix/ZSTAC-81354

Conversation

@zstack-robot-1
Copy link
Collaborator

Root Cause

In HostBase.maintenanceHook(), when any OrderVmBeforeMigrationDuringHostMaintenanceExtensionPoint returns an ordered VM list, migrateQuantity was unconditionally forced to 1 (line 416). Since HaManagerImpl always returns non-null (even when no VMs have HA tags), the user-configured vm.migrationQuantity global config was never effective during host maintenance mode.

Solution

Remove the migrateQuantity = 1 override. The VM ordering is preserved by list position — HA VMs remain at the front of the list. The While loop processes items in order with the user-configured concurrency level, so HA VMs are still prioritized in early batches.

Testing

  • Compile verified: mvn compile -pl compute -am -Dmaven.test.skip
  • Logic review: While.step(callback, migrateQuantity) processes N items concurrently from the ordered list, preserving priority ordering

Jira

Resolves: ZSTAC-81354

Note: Companion MR in premium repo (HaManagerImpl returns null when no HA tags exist).

sync from gitlab !9209

Resolves: ZSTAC-81354

Change-Id: Iff2131b3a878444fa27641f24dd727fe4fa176fb
@coderabbitai
Copy link

coderabbitai bot commented Feb 19, 2026

No actionable comments were generated in the recent review. 🎉


走览

移除了在扩展点提供VM顺序时强制将migrateQuantity设置为1的赋值逻辑。代码现在保留现有的migrateQuantity值,仅记录有序的VM列表和当前迁移数量,而非强制单个迁移量。

变更

内聚组 / 文件(s) 摘要
VM迁移数量逻辑
compute/src/main/java/org/zstack/compute/host/HostBase.java
移除强制migrateQuantity = 1的赋值,改为保留现有数量值并记录有序VM列表。

代码审查工作量

🎯 1 (Trivial) | ⏱️ ~3 分钟

🐰 一份改动小而精,
移除强制是本义,
迁移量得保本真,
顺序记录显风云,
代码简洁更通透!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed 标题清晰总结了主要变更内容,遵循规定的格式 [scope]: ,长度68字符(≤72),完全相关且描述性强。
Description check ✅ Passed 描述详细阐述了根本原因、解决方案、测试验证和相关 Jira 号,与代码变更直接相关且信息充分。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sync/ye.zou/fix/ZSTAC-81354

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants