Skip to content

Conversation

@hholoubk
Copy link
Contributor

for testing purposes

Refactor provider infrastructure to use the new recreate_serial_console
parameter instead of manually calling cleanup_serial_console() and
create_serial_console() before wait_for_serial_login().

Modified files:
- provider/save/save_base.py: pre_save_setup() and post_save_check()
- provider/migration/base_steps.py: PrepareVMTest and VerifyTest classes
- provider/migration/migration_base.py: poweroff_vm_on_dest() and do_io_error_on_dest()
- provider/interface/check_points.py: check_vm_network_accessed()

Depends on: avocado-framework/avocado-vt#4248

Signed-off-by: hholoubk <[email protected]>
Refactor all SR-IOV tests to use recreate_serial_console parameter
instead of manually calling cleanup_serial_console() and
create_serial_console() before wait_for_serial_login().

This eliminates code duplication and makes the intent clearer across
all SR-IOV test categories: vIOMMU, VM lifecycle, device plug/unplug,
failover scenarios, and VFIO variant driver tests.

Modified test categories:
- vIOMMU tests (5 files): Device settings, DMA translation, address width, driver reload, hotplug
- VM lifecycle tests (5 files): Suspend/resume, reboot, managedsave, IOMMU+hostdev, exclusive check
- Plug/unplug tests (4 files): Released hostdev, interface/device attach/detach with flags, VFIO variant
- Failover tests (3 files): Migration, lifecycle operations, attach/detach hostdev
- VFIO tests (1 file): Migration with VFIO variant driver

Total: 18 files modified, cleaner code with single-line console recreation.

Depends on: avocado-framework/avocado-vt#4248
Depends on: autotest#6596

Signed-off-by: hholoubk <[email protected]>
Refactor all migration tests to use the recreate_serial_console parameter
instead of manually calling cleanup_serial_console() and
create_serial_console() before wait_for_serial_login().

This simplifies serial console management when switching connection URIs
during migration operations. The pattern is especially useful after
migrating VMs to remote hosts where the serial console needs to be
recreated to match the new connection context.

Modified test categories:
- Memory migration tests: migrate_mem.py
- Network migration tests: migrate_network.py (3 occurrences)
- Migration with panic device: migrate_with_panic_device.py
- Migration with virtiofs: internally/externally launched virtiofs devices (2 files)
- Migration with vTPM: shared_tpm, vtpm_dev, external_tpm (3 files)

All tests now use a cleaner pattern:
  vm.connect_uri = dest_uri
  vm_session = vm.wait_for_serial_login(timeout=240, recreate_serial_console=True)

Total: 8 files modified with 31 fewer lines of console management code.

Depends on: avocado-framework/avocado-vt#4248
Depends on: autotest#6596

Signed-off-by: hholoubk <[email protected]>
Refactor network and interface tests to use the recreate_serial_console
parameter instead of manually calling cleanup_serial_console() and
create_serial_console() before wait_for_serial_login().

This simplifies console management in scenarios where the console needs
to be recreated after state changes such as:
- After libvirtd restart
- After VM save/restore or suspend/resume operations
- After VM start or device hotplug

Modified test files:
- virtual_network/iface_bridge.py: Console recreation after libvirtd restart
- virtual_network/passt/passt_lifecycle.py: Console after restore/resume
- virtual_interface/interface_update_device_negative.py: Console after VM start
- virsh_cmd/domain/virsh_domif_setlink_getlink.py: Console for link state check
- virtio/virtio_page_per_vq.py: Console after device attach

All tests now use a cleaner single-line pattern for console recreation.

Note: iface_hotplug.py was not modified as it creates console without
immediately calling wait_for_serial_login(), which doesn't match the
refactoring pattern.

Total: 5 files modified with 9 fewer lines of console management code.

Depends on: avocado-framework/avocado-vt#4248
Depends on: autotest#6596

Signed-off-by: hholoubk <[email protected]>
Refactor snapshot tests to use the recreate_serial_console parameter
instead of manually calling cleanup_serial_console() and
create_serial_console() before wait_for_serial_login().

This simplifies console management after snapshot revert operations,
which require console recreation since the VM state may have changed.

Modified test files:
- snapshot/revert_snapshot_after_xml_updated.py: Console after VM start/revert
- snapshot/revert_disk_external_snap.py: Console after snapshot revert

Both tests handle console recreation after reverting to snapshots, where
the VM state is restored and the old console session is no longer valid.

Total: 2 files modified with 4 fewer lines of console management code.

Depends on: avocado-framework/avocado-vt#4248
Depends on: autotest#6596

Signed-off-by: hholoubk <[email protected]>
Refactor virtio test to use the recreate_serial_console parameter
instead of manually calling cleanup_serial_console() and
create_serial_console() before wait_for_serial_login().

This simplifies console management after VM start and device hotplug
operations in virtio page_per_vq testing.

Modified test file:
- virtio/virtio_page_per_vq.py: Console after VM start/device hotplug

The test handles console recreation after VM initialization where the
console needs to be properly set up for testing virtio device attributes.

Total: 1 file modified with 2 fewer lines of console management code.

Depends on: avocado-framework/avocado-vt#4248
Depends on: autotest#6596

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

Refactor migration with copy storage tests to use the recreate_serial_console
parameter instead of manually calling cleanup_serial_console() and
create_serial_console() before wait_for_serial_login().

This simplifies console management when connecting to the migrated VM on the
destination host after switching the connection URI.

Modified test files:
- migration_with_copy_storage/migration_with_backingchain.py: Console to remote host
- migration_with_copy_storage/disk_io_load_in_vm.py: Console to remote host after migration

Both tests handle console recreation when switching from source to destination
host connection, where the old console must be cleaned up and recreated with
the new URI.

Total: 2 files modified with 4 fewer lines of console management code.

Depends on: avocado-framework/avocado-vt#4248
Depends on: autotest#6596

Signed-off-by: hholoubk <[email protected]>
Refactor nwfilter binding list test to use the recreate_serial_console
parameter instead of manually calling cleanup_serial_console() and
create_serial_console() before wait_for_serial_login().

This simplifies console management before interface detach operations.

Modified test file:
- nwfilter/nwfilter_binding_list.py: Console recreation before interface detach
  (also fixed bug: .close -> .close())

Total: 1 file modified with 2 fewer lines of console management code.

Depends on: avocado-framework/avocado-vt#4248
Depends on: autotest#6596

Signed-off-by: hholoubk <[email protected]>
Refactor BIOS boot order tests to use the recreate_serial_console parameter
instead of manually calling cleanup_serial_console() and
create_serial_console() before wait_for_serial_login().

This simplifies console management after VM boot operations, ensuring
proper console state for various boot scenarios including OVMF and SeaBIOS.

Modified test files:
- bios/boot_order_ovmf.py: Console after VM start for OVMF boot testing
- bios/boot_order_seabios.py: Console after VM start for SeaBIOS boot testing

Both tests handle console recreation after VM start operations where the
console needs to be reset to properly capture boot messages and login prompts.

Total: 2 files modified with 9 fewer lines of console management code.

Depends on: avocado-framework/avocado-vt#4248
Depends on: autotest#6596

Signed-off-by: hholoubk <[email protected]>
…ole-migration', 'refactor-serial-console-network', 'refactor-serial-console-snapshot', 'refactor-serial-console-bios', 'refactor-serial-console-migration-storage', 'refactor-serial-console-virtio' and 'refactor-serial-console-misc' into test-all-serial-console-changes
@coderabbitai
Copy link

coderabbitai bot commented Oct 13, 2025

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.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

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