Skip to content

Conversation

@hholoubk
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Jan 15, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

❤️ Share

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

Add optional destination VM backup/cleanup functionality to MigrationBase:
- New parameter 'do_destination_vm_backup' (default: no) to enable feature
- Accept optional remote_virsh session for destination host operations
- Check if VM exists on destination before migration
- Fail test if destination VM is running (blocker condition)
- Backup and undefine pre-existing stopped VMs to avoid conflicts
- Use comprehensive undefine options (--nvram, --managed-save, etc.)
- Restore destination VM in cleanup_default()

Update migration_iommu_device test:
- Add setup_remote_virsh_session() helper function
- Create single remote virsh session shared across test operations
- Refactor check_iommu_xml() to reuse remote session (no duplication)
- Add cleanup_default() call in finally block
- Properly close remote session in finally block

This allows migration tests to run on non-clean environments without
depending on destination host state.

AI assisted code and commit. Human reviewed.

Signed-off-by: hholoubk <[email protected]>

migration: refactor base_steps connection params

Refactor MigrationBase to cache destination host credentials and reuse them across methods, and extract destination VM backup/undefine flow into a helper method.

AI assisted code and commit. Human reviewed.

Signed-off-by: hholoubk <[email protected]>

migration: restore pre-existing destination VM from backup

When do_destination_vm_backup is enabled, include destination host info in logs, fail with clearer message if the destination VM is running, and restore a backed-up destination VM by copying its XML file to the destination host before defining it via remote virsh.

AI assisted code and commit. Human reviewed.

Signed-off-by: hholoubk <[email protected]>

migration: skip undefine when destination VM is absent

When destination VM backup is enabled, return early if the VM does not exist on the destination host, and enable debug logging for the existence/running-state checks.

AI assisted code and commit. Human reviewed.

Signed-off-by: hholoubk <[email protected]>
@hholoubk hholoubk force-pushed the migration_dest_vm_cleanup_refactor branch from 206b810 to 8d86f36 Compare January 16, 2026 10:47
Only call destination VM backup/undefine helper when do_destination_vm_backup is enabled, and drop the redundant guard from the helper.

AI assisted code and commit. Human reviewed.

Signed-off-by: hholoubk <[email protected]>
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.

1 participant