test(xfs): add migration tests for VMs with XFS v4 filesystem#503
test(xfs): add migration tests for VMs with XFS v4 filesystem#503Chenli-Hu wants to merge 1 commit into
Conversation
|
Warning Review limit reached
More reviews will be available in 27 minutes and 58 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (9)
WalkthroughAdds XFS compatibility wiring for plan creation, SSH command helpers, XFS test configuration, and warm/cold migration test flows with XFS verification. ChangesXFS Migration Support
Sequence Diagram(s)sequenceDiagram
participant Test as XFS migration test
participant MTV as create_plan_resource
participant Mig as execute_migration
participant Verify as check_vm_command_output
participant Validate as check_vms
Test->>MTV: create StorageMap, NetworkMap, Plan
Test->>Mig: execute migration with xfs_compatibility enabled
Test->>Verify: run xfs_info and check output
Test->>Validate: validate migrated VMs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@utilities/utils.py`:
- Around line 305-315: The code currently mutates the input list via
networks.remove(...) and networks.insert(...), which can leak order across
callers; instead construct and return a new list so the original networks
argument is not modified: after finding pod_net (the result of next(...)), build
a new list with pod_net first followed by all other entries filtered out (use
networks and custom_pod_network to filter), and return that new list; keep the
existing ValueError behavior when pod_net is None and reference the same symbols
(pod_net, networks, custom_pod_network) so the change is localized.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 02b43eca-2a31-467e-b8e6-358366e4a560
📒 Files selected for processing (4)
tests/tests_config/config.pytests/warm/test_warm_migration_comprehensive.pyutilities/mtv_migration.pyutilities/utils.py
|
Hi @krcmarik , please help to review, thank you! 1)Migrate cloned xfs VM only 2)Migrate both cloned mtv-win2022-ip-3disks and cloned mtv-feature-rhel7-xfs tests/warm/test_warm_migration_comprehensive.py::TestWarmMigrationComprehensive::test_create_storagemap[comprehensive-warm-xfs] PASSED tests/warm/test_warm_migration_comprehensive.py::TestWarmMigrationComprehensive::test_create_networkmap[comprehensive-warm-xfs] PASSED tests/warm/test_warm_migration_comprehensive.py::TestWarmMigrationComprehensive::test_create_plan[comprehensive-warm-xfs] PASSED tests/warm/test_warm_migration_comprehensive.py::TestWarmMigrationComprehensive::test_migrate_vms[comprehensive-warm-xfs] PASSED tests/warm/test_warm_migration_comprehensive.py::TestWarmMigrationComprehensive::test_check_vms[comprehensive-warm-xfs] PASSED |
|
/verified |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/warm/test_warm_migration_comprehensive.py`:
- Line 193: The test currently enables preserve_static_ips by default via
prepared_plan.get("preserve_static_ips", True), which implicitly turns the
feature on for plans that never declared it; change this to read the flag
without a default so missing keys are treated as absent (e.g., use
prepared_plan["preserve_static_ips"] or otherwise pass the explicit value from
the test fixture) to avoid silently enabling static-IP validation paths—update
the call site that sets preserve_static_ips to stop using .get(..., True) and
instead require an explicit value from prepared_plan.
In `@utilities/mtv_migration.py`:
- Around line 146-147: You've added a new positional parameter xfs_compatibility
before target_power_state which breaks existing positional callers; change the
function signature to keep existing positional binding by either moving
xfs_compatibility after target_power_state or make it keyword-only (e.g., put
"*, xfs_compatibility: bool = False" after target_power_state) so old callers
still bind target_power_state correctly, and then update any call sites/tests
that intentionally pass xfs_compatibility positionally to use the keyword form.
In `@utilities/post_migration.py`:
- Around line 1257-1276: The code resolves destination_vm_name but still uses
vm_name when creating the SSH connection and logging; update usages to target
the migrated VM by replacing vm_name with destination_vm_name in
vm_ssh_connections.create and in the LOGGER.info message (leave
get_ssh_credentials_from_provider_config(source_provider_data, source_vm_data)
and the win_os check as-is so credentials and OS checks still come from
source_vm_data). Ensure vm_ssh_connections.create(...) is called with
vm_name=destination_vm_name and corresponding log text reflects the destination
VM.
In `@utilities/utils.py`:
- Around line 258-259: The current call to _reorder_networks_by_pod_network can
raise a ValueError when custom_pod_network is missing even though pod_only=True
makes reordering unnecessary; update the condition around the call so it only
runs when custom_pod_network is truthy AND pod_only is False (i.e., guard the
call with "if custom_pod_network and not pod_only") to skip reordering in
pod_only mode; reference symbols: custom_pod_network, pod_only,
_reorder_networks_by_pod_network, networks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4da22c4c-e415-4cb9-abe3-75542d1da274
📒 Files selected for processing (5)
tests/tests_config/config.pytests/warm/test_warm_migration_comprehensive.pyutilities/mtv_migration.pyutilities/post_migration.pyutilities/utils.py
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@utilities/post_migration.py`:
- Around line 1475-1488: The XFS check calls check_vm_command_output whenever
plan.get("xfs_compatibility") is true, causing failures if the destination VM is
powered off; update the condition to also verify the destination VM is powered
on (e.g., vm.get("power_state") == "on" or an existing vm_powered_on flag) and
only run check_vm_command_output when vm_ssh_connections and
plan.get("xfs_compatibility") are true AND the VM is powered on, keeping the
existing try/except and res[vm_name].append(...) behavior for error reporting.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 9e1102a9-cf8a-4744-9f84-80712626103e
📒 Files selected for processing (6)
tests/tests_config/config.pytests/warm/test_warm_migration_comprehensive.pyutilities/mtv_migration.pyutilities/post_migration.pyutilities/utils.pyutilities/vmware_guest_operations.py
Code Review by Qodo
1. source_vms_data defaulted to {}
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@utilities/post_migration.py`:
- Around line 1321-1333: The code is silently defaulting source_vm_data to {}
and assuming ssh_conn.rrmngmnt_host exists which leads to opaque failures;
update the logic around source_vm_data,
get_ssh_credentials_from_provider_config, and ssh_conn usage to fail fast:
explicitly check if plan.get("source_vms_data") is None or if source_vm_data is
missing for vm_name and raise a clear ValueError naming vm_name and plan key,
validate that get_ssh_credentials_from_provider_config returned non-None
ssh_username/ssh_password and raise a descriptive error if missing, and before
using ssh_conn.rrmngmnt_host validate ssh_conn is not None and that
ssh_conn.rrmngmnt_host is present (raise a clear exception referencing
destination_vm_name and ssh_conn) so callers get actionable setup errors instead
of opaque attribute errors.
In `@utilities/vmware_guest_operations.py`:
- Around line 222-224: The awk program is written with double braces so it’s
passed literally and returns empty values; update the shell command strings that
set dev and method (the lines constructing "dev=$(nmcli -f GENERAL.DEVICES ... |
awk -F: '{{print $2}}' ..." and "method=$(nmcli -f ipv4.method ... | awk -F:
'{{print $2}}' ...)") to use single-brace awk syntax ({print $2}) so dev and
method are extracted correctly; ensure both occurrences are fixed and keep the
surrounding nmcli/test/xargs pipeline intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 193fb40a-71bf-4373-b22a-67de42ab42f0
📒 Files selected for processing (6)
tests/tests_config/config.pytests/warm/test_warm_migration_comprehensive.pyutilities/mtv_migration.pyutilities/post_migration.pyutilities/utils.pyutilities/vmware_guest_operations.py
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/cold/test_cold_migration_xfs.py`:
- Around line 162-164: The cold migration test is directly indexing optional
plan flags, which can raise a KeyError when they are omitted. Update the
argument setup in the test that uses prepared_plan so warm_migration and
xfs_compatibility are read with prepared_plan.get(..., False), while keeping
preserve_static_ips as a required direct access. Use the existing prepared_plan
usage in the migration test to locate the change.
In `@tests/tests_config/config.py`:
- Around line 720-724: The warm XFS migration test is reading the wrong config
key, causing a KeyError before the check runs. Update the test logic in
test_warm_migration_xfs to use the existing xfs_check configuration key that
matches the dict in config.py, and make sure the xfs_info validation compares
against the configured expected_output value instead of xfs_v4.
In `@tests/warm/test_warm_migration_xfs.py`:
- Around line 165-166: The test is reading optional plan flags with direct
subscripts, which makes it fragile if those keys are missing. Update the
`create_plan_resource` call in `test_warm_migration_xfs` to fetch
`warm_migration` and `xfs_compatibility` via `prepared_plan.get(..., False)`
instead of indexing into `prepared_plan`, keeping the test aligned with the
default behavior in `create_plan_resource`.
- Around line 208-222: The XFS warm migration test is reading the wrong config
key in `test_warm_migration_xfs` when building the `check_vm_command_output`
call. Update the `xfs_check` usage in this test to match the config schema used
by the XFS test definitions, and reference the documented `expected_output`
field instead of `xfs_v4`. Keep the existing `xfs_check`,
`check_vm_command_output`, and `prepared_plan` flow intact while correcting the
key access.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: b8f30914-5a86-4fbb-826f-6482e9a46e36
📒 Files selected for processing (8)
AGENTS.mdtests/cold/test_cold_migration_xfs.pytests/tests_config/config.pytests/warm/test_warm_migration_xfs.pyutilities/mtv_migration.pyutilities/post_migration.pyutilities/shared_disk.pyutilities/ssh_utils.py
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/tests_config/config.py`:
- Around line 737-741: The xfs_check configuration uses an invalid mount_point
value, causing xfs_info to receive a non-existent path. Update the xfs_check
entry in config.py so mount_point points to the correct device node or mounted
directory, using the xfs_check symbol to locate the setting and replacing /sdb1
with a valid /dev/... path such as /dev/sdb1.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 80135ece-d7c4-4920-9ee4-c8af41b36e60
📒 Files selected for processing (8)
AGENTS.mdtests/cold/test_cold_migration_xfs.pytests/tests_config/config.pytests/warm/test_warm_migration_xfs.pyutilities/mtv_migration.pyutilities/post_migration.pyutilities/shared_disk.pyutilities/ssh_utils.py
|
/verified |
|
Tested the latest code changes with both XFS and shared disk scenarios: uv run pytest -vv -m "tier1" -k "xfs" => PASSEDuv run pytest -vv -m "shared_disk" -k "shared-disk-rhel" => PASSED============================= test session starts ============================== tests/shared_disk/test_shared_disk_rhel_migration.py::TestSharedDiskRhelMigration::test_create_storagemap[shared-disk-rhel] PASSED tests/shared_disk/test_shared_disk_rhel_migration.py::TestSharedDiskRhelMigration::test_create_networkmap[shared-disk-rhel] PASSED tests/shared_disk/test_shared_disk_rhel_migration.py::TestSharedDiskRhelMigration::test_create_plan[shared-disk-rhel] PASSED tests/shared_disk/test_shared_disk_rhel_migration.py::TestSharedDiskRhelMigration::test_migrate_vms[shared-disk-rhel] PASSED tests/shared_disk/test_shared_disk_rhel_migration.py::TestSharedDiskRhelMigration::test_verify_shared_disk_data[shared-disk-rhel] PASSED tests/shared_disk/test_shared_disk_rhel_migration.py::TestSharedDiskRhelMigration::test_check_vms[shared-disk-rhel] PASSED |
myakove
left a comment
There was a problem hiding this comment.
Code Review
Found 3 issue(s) in this PR:
💡 Suggestions (3)
| File | Line | Issue |
|---|---|---|
tests/cold/test_cold_migration_xfs.py |
163 | target_power_state configured but not passed to create_plan_resource() |
utilities/post_migration.py |
31 | Unused runtime import: GuestCommandError |
utilities/ssh_utils.py |
45 | Docstring Raises section omits ConnectionError |
Review generated by pi
|
/verified |
myakove
left a comment
There was a problem hiding this comment.
Code Review
Found 2 issue(s) in this PR:
💡 Suggestions (2)
| File | Line | Issue |
|---|---|---|
AGENTS.md |
812 | Test method naming paragraph missing XFS pattern |
AGENTS.md |
953 | README marker table missing vsphere |
Review generated by pi
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@AGENTS.md`:
- Around line 861-868: Update the Test Verification Configuration docs so the
xfs_check section reflects that xfs_check itself is optional, but command,
mount_point, and expected_output are required whenever xfs_check is present. Use
the test_verify_xfs_version behavior and the xfs_check keys as the guide, and
rewrite the table wording to make these fields conditionally required instead of
fully optional.
In `@tests/cold/test_cold_migration_xfs.py`:
- Around line 153-165: Restore the missing preserve_static_ips argument when
calling create_plan_resource() in the cold migration XFS test setup. The Plan CR
builder still accepts this field and the scenario depends on it, so pass
prepared_plan["preserve_static_ips"] alongside the existing parameters to keep
networking behavior aligned with the test case and preserve the later
SSH/check_vms validation flow.
In `@tests/warm/test_warm_migration_xfs.py`:
- Around line 57-58: The new dict[str, Any] annotations in the warm migration
test need an explicit justification or narrower types. Update the first relevant
declaration in test_warm_migration_xfs.py, near the prepared_plan and
fixture_store parameters, to add a short inline or nearby comment explaining
that these test payloads are intentionally schema-flexible and
scenario-dependent; if the structure is fixed, replace Any with a concrete
mapping type instead. Keep the explanation close to the first occurrence so
later dict[str, Any] usages are clearly intentional.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: d347aca1-a8bd-4b16-b3c4-d8833b95654a
📒 Files selected for processing (9)
AGENTS.mdREADME.mdtests/cold/test_cold_migration_xfs.pytests/tests_config/config.pytests/warm/test_warm_migration_xfs.pyutilities/mtv_migration.pyutilities/post_migration.pyutilities/shared_disk.pyutilities/ssh_utils.py
Signed-off-by: Chenli Hu <chhu@redhat.com>
|
/verified |
myakove
left a comment
There was a problem hiding this comment.
Code Review
Found 1 issue(s) in this PR:
💡 Suggestions (1)
| File | Line | Issue |
|---|---|---|
utilities/ssh_utils.py |
48 | [SUGGESTION] run_cmd_in_vm validates rrmngmnt_host but not `rrmngmnt_use |
Review generated by pi
| ConnectionError: If SSH connection is not established. | ||
| GuestCommandError: If the command fails (non-zero return code). | ||
| """ | ||
| if ssh_conn.rrmngmnt_host is None: |
There was a problem hiding this comment.
[SUGGESTION] run_cmd_in_vm validates rrmngmnt_host but not rrmngmnt_user or local_port.
This function was promoted from private (_run_cmd_on_vm) to public. It validates rrmngmnt_host is None but doesn't check rrmngmnt_user or local_port. If connection state is inconsistent:
executor(user=None)uses rrmngmnt's default user (wrong auth)executor.port = Nonecould fall back to port 22 on localhost — executing on the host instead of the VM
Fix: Extend guard:
if ssh_conn.rrmngmnt_host is None or ssh_conn.rrmngmnt_user is None or ssh_conn.local_port is None:
raise ConnectionError(f"{description}: SSH connection is not fully established")
Summary by CodeRabbit