Skip to content

Conversation

@meinaLi
Copy link
Contributor

@meinaLi meinaLi commented Nov 28, 2025

Automate case:
RHEL-200524: Migrate VM with a vhostuser disk

Summary by CodeRabbit

  • Tests
    • Added an end-to-end test (config + implementation) validating VM migration with a vhost-user disk, including orchestration of storage services on source and destination, VM lifecycle management, migration execution, post-migration read/write verification of the disk, cleanup of test artifacts, and a precopy variant.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 28, 2025

Walkthrough

Adds a new libvirt migration test configuration file libvirt/tests/cfg/migration/migration_with_disk/migration_with_vhostuser.cfg and a new Python test module libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py. The config declares migration parameters, storage/disk attributes for a vhost-user disk and a test variant. The Python module implements end-to-end test logic: create backend images, start qemu-storage-daemon vhost-user services on source and remote, set SELinux/mmap settings, modify VM XML to attach a vhost-user disk, start and verify the VM, perform migration, switch the libvirt connection to the destination, re-establish console, validate disk accessibility and read/write after migration, and perform cleanup of services, sockets, images, and VM state.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Heterogeneous changes: new config plus a non-trivial Python test with multi-host orchestration and dense logic.
  • Areas needing extra attention:
    • start_vhost_sock_service_in_source and start_vhost_sock_service_in_remote: command construction, permissions, SELinux context and mmap handling, and error paths.
    • Remote execution and remote service lifecycle (identification, termination).
    • VM XML manipulation: disk insertion/removal, backups, and restoration correctness.
    • Migration orchestration: connection switching, virsh/serial console reattachment, and VM state transitions.
    • Cleanup logic robustness to avoid leftover daemons, sockets, or image files.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a migration test case for virtual machines with vhostuser disks, which directly matches the changeset contents.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 822da95 and 805abd7.

📒 Files selected for processing (2)
  • libvirt/tests/cfg/migration/migration_with_disk/migration_with_vhostuser.cfg (1 hunks)
  • libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • libvirt/tests/cfg/migration/migration_with_disk/migration_with_vhostuser.cfg
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-24T08:01:27.899Z
Learnt from: hholoubk
Repo: autotest/tp-libvirt PR: 6579
File: libvirt/tests/src/sriov/vIOMMU/iommu_device_lifecycle.py:95-97
Timestamp: 2025-09-24T08:01:27.899Z
Learning: In the libvirt test framework used in tp-libvirt, VM cleanup including destroying running VMs is handled by the teardown method (test_obj.teardown_iommu_test()) called in the finally block, so explicit VM destroy calls on timeout are not necessary according to the maintainers.

Applied to files:

  • libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py
📚 Learning: 2025-11-18T01:20:50.891Z
Learnt from: qiankehan
Repo: autotest/tp-libvirt PR: 6654
File: libvirt/tests/src/virtual_network/qemu/boot_with_multiqueue.py:56-58
Timestamp: 2025-11-18T01:20:50.891Z
Learning: In the tp-libvirt project, when calling session command methods and the status code is not needed, prefer using `session.cmd_output()` over `session.cmd_status_output()` to avoid unused variables.

Applied to files:

  • libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py
🪛 Ruff (0.14.6)
libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py

30-30: Function call with shell=True parameter identified, security issue

(S604)


32-32: Function call with shell=True parameter identified, security issue

(S604)


35-35: Function call with shell=True parameter identified, security issue

(S604)


37-37: Function call with shell=True parameter identified, security issue

(S604)


77-77: Probable insecure usage of temporary file or directory: "/tmp/vhost.sock"

(S108)


168-168: Function call with shell=True parameter identified, security issue

(S604)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Python 3.11
  • GitHub Check: Python 3.12
  • GitHub Check: Python 3.9
  • GitHub Check: Python 3.8
🔇 Additional comments (4)
libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py (4)

1-16: LGTM!

Imports are appropriate and ast is correctly imported for safe literal_eval usage.


40-57: LGTM, with SELinux note.

The function is well-structured for remote setup. The same SELinux boolean restoration concern from the source side applies here (line 56). Consider capturing and restoring the original value on the remote host as well.


114-149: LGTM!

The verification logic is well-structured with proper resource management:

  • Try/finally ensures the VM session is closed
  • Connection URI is properly backed up and restored
  • Device accessibility is verified with both lsblk and write test
  • Default migration verification is correctly invoked at the end

177-197: LGTM!

The main execution flow is well-structured:

  • Feature support check at the start
  • Proper VM and XML backup initialization
  • MigrationBase object used consistently with the framework patterns
  • Try/finally ensures cleanup always runs

Based on the learnings, VM cleanup is handled by the teardown method, and the explicit destroy in cleanup_test provides additional safety.


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

@meinaLi
Copy link
Contributor Author

meinaLi commented Nov 28, 2025

# avocado run --vt-type libvirt --vt-omit-data-loss --vt-machine-type q35 migration.migration_with_disk.migration_with_vhostuser
JOB ID     : 44becec4f5b031d45e4d0c6517aa938ddd328ab6
JOB LOG    : /var/log/avocado/job-results/job-2025-11-28T01.32-44becec/job.log
 (1/1) type_specific.io-github-autotest-libvirt.migration.migration_with_disk.migration_with_vhostuser.with_precopy: STARTED
 (1/1) type_specific.io-github-autotest-libvirt.migration.migration_with_disk.migration_with_vhostuser.with_precopy: PASS (191.86 s)
RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /var/log/avocado/job-results/job-2025-11-28T01.32-44becec/results.html
JOB TIME   : 193.89 s

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py (3)

51-54: Consider using consistent image creation method.

The source host uses libvirt.create_local_disk("file", ...) while the remote host uses dd if=/dev/zero. While both work, using consistent methods improves maintainability.


113-115: Strengthen vhostuser disk validation.

The current check only verifies the string "vhostuser" exists in the XML dump. Consider validating the specific disk configuration (target device, socket path) for more robust verification.

-        # Check if vhostuser disk is accessible in VM
-        if "vhostuser" not in virsh.dumpxml(vm_name).stdout_text:
-            test.fail("Check vhostuser disk in VM failed")
+        # Check if vhostuser disk is present in VM configuration
+        vmxml_check = vm_xml.VMXML.new_from_dumpxml(vm_name)
+        disk_list = vmxml_check.get_disk_all()
+        vhostuser_found = any(d.get('type') == 'vhostuser' for d in disk_list.values())
+        if not vhostuser_found:
+            test.fail("Check vhostuser disk in VM failed")

88-94: Consider more robust service readiness check.

The sleep 3 at the end is a timing-based approach to wait for the daemon to be ready. For more reliable tests, consider checking for socket file existence or service status instead of a fixed sleep.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cbbb993 and d3ec636.

📒 Files selected for processing (2)
  • libvirt/tests/cfg/migration/migration_with_disk/migration_with_vhostuser.cfg (1 hunks)
  • libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.14.6)
libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py

31-31: Function call with shell=True parameter identified, security issue

(S604)


33-33: Function call with shell=True parameter identified, security issue

(S604)


36-36: Function call with shell=True parameter identified, security issue

(S604)


38-38: Function call with shell=True parameter identified, security issue

(S604)


81-81: Probable insecure usage of temporary file or directory: "/tmp/vhost.sock"

(S108)


84-84: Local variable device_target is assigned to but never used

Remove assignment to unused variable device_target

(F841)


85-85: Use of possibly insecure function; consider using ast.literal_eval

(S307)


175-175: Function call with shell=True parameter identified, security issue

(S604)


180-180: Function call with shell=True parameter identified, security issue

(S604)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Python 3.11
  • GitHub Check: Python 3.12
  • GitHub Check: Python 3.8
  • GitHub Check: Python 3.9
🔇 Additional comments (5)
libvirt/tests/cfg/migration/migration_with_disk/migration_with_vhostuser.cfg (2)

34-35: Empty variant placeholder.

The with_precopy variant is defined but contains no variant-specific parameters. If precopy is the only migration mode being tested, this is acceptable as a placeholder for future postcopy or other variants.


29-29: Based on my investigation, I found that:

  1. libvirt's memory backing XML element: The correct XML element is <memoryBacking> with subelements like <source type="memfd"/> and <access mode="shared"/> — matching the structure in line 29.

  2. Limitation: I cannot access the repository to verify the exact key mapping layer (how "mb" is converted to XML), as the repository clone failed.

The structure of the vm_attrs appears consistent with libvirt's memoryBacking configuration, but without access to the framework's code that processes vm_attrs, I cannot definitively confirm whether "mb" is the correct key convention used by the testing framework.


Verify the key mapping in vm_xml processing code.

The vm_attrs uses "mb" for memory backing configuration. While the internal structure (source_type, access_mode) matches libvirt's <memoryBacking> subelements, direct codebase verification is needed to confirm that "mb" is the correct key recognized by the testing framework's XML generator.

libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py (3)

20-39: LGTM with minor observation.

The function correctly sets up the vhost socket service on the source host. The use of shell=True is acceptable in this test framework context where command strings contain complex shell constructs.


156-187: LGTM!

The cleanup function properly handles all resources: VM destruction, XML restoration, connection cleanup, and file/service cleanup on both local and remote hosts. The use of ignore_status=True ensures cleanup continues even if individual steps fail.


189-211: LGTM!

The main execution flow follows good practices: version check, variable initialization, XML backup, and a try/finally block ensuring cleanup runs regardless of test outcome.

@meinaLi meinaLi force-pushed the vhostuser_disk_migration branch from d3ec636 to 8ca0104 Compare November 28, 2025 06:59
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py (1)

80-80: Consider using a scoped, non‑/tmp socket path

Using a fixed /tmp/vhost.sock risks collisions or stale leftovers because /tmp is world‑writable and shared across processes/tests. To keep things isolated, consider deriving a unique path (e.g. include vm_name, PID, or a UUID) under a test‑specific directory, such as something based on data_dir.get_data_dir() or another per‑test temp dir.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d3ec636 and 8ca0104.

📒 Files selected for processing (2)
  • libvirt/tests/cfg/migration/migration_with_disk/migration_with_vhostuser.cfg (1 hunks)
  • libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • libvirt/tests/cfg/migration/migration_with_disk/migration_with_vhostuser.cfg
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-24T08:01:27.899Z
Learnt from: hholoubk
Repo: autotest/tp-libvirt PR: 6579
File: libvirt/tests/src/sriov/vIOMMU/iommu_device_lifecycle.py:95-97
Timestamp: 2025-09-24T08:01:27.899Z
Learning: In the libvirt test framework used in tp-libvirt, VM cleanup including destroying running VMs is handled by the teardown method (test_obj.teardown_iommu_test()) called in the finally block, so explicit VM destroy calls on timeout are not necessary according to the maintainers.

Applied to files:

  • libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py
🪛 Ruff (0.14.6)
libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py

30-30: Function call with shell=True parameter identified, security issue

(S604)


32-32: Function call with shell=True parameter identified, security issue

(S604)


35-35: Function call with shell=True parameter identified, security issue

(S604)


37-37: Function call with shell=True parameter identified, security issue

(S604)


80-80: Probable insecure usage of temporary file or directory: "/tmp/vhost.sock"

(S108)


173-173: Function call with shell=True parameter identified, security issue

(S604)


178-178: Function call with shell=True parameter identified, security issue

(S604)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Python 3.8
  • GitHub Check: Python 3.9
  • GitHub Check: Python 3.11
  • GitHub Check: Python 3.12
🔇 Additional comments (3)
libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py (3)

72-83: Setup flow and parameter parsing look consistent and safe

Using ast.literal_eval for disk_dict and vm_attrs is much safer than eval, and the VM XML manipulation (setup_attrs, create_vm_device_by_type, add_device, sync) matches existing tp‑libvirt patterns. The initial boot/login plus vhostuser presence check via virsh.dumpxml provides a reasonable pre‑migration sanity gate.

Also applies to: 100-110


124-148: Post‑migration in‑guest verification is solid

Switching vm.connect_uri to the destination, recreating the serial console, checking lsblk for device_target, and then doing a dd_data_to_vm_disk write are good end‑to‑end checks that the vhostuser disk survives migration and remains usable. The finally block closing vm_session and restoring vm.connect_uri keeps the connection handling tidy.


154-185: Overall test orchestration and cleanup are well‑structured

The run function’s structure—setup_test()run_migration()verify_test() with cleanup_test() in finally—aligns with other migration tests. Backing up the inactive XML and restoring it in cleanup, plus guarding vm.destroy() with vm.is_alive(), should leave the VM definition in a clean state after the test.

Once the service lifecycle points above are addressed, the test looks ready to go.

Also applies to: 187-208

Comment on lines +86 to +89
start_sock_service_cmd = (
'systemd-run --uid qemu --gid qemu /usr/bin/qemu-storage-daemon'
' --blockdev \'{"driver":"file","filename":"%s","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}\''
' --blockdev \'{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}\''
' --export vhost-user-blk,id=vhost-user-blk0,node-name=libvirt-1-format,addr.type=unix,addr.path=%s,writable=on'
' --chardev stdio,mux=on,id=char0; sleep 3'
% (image_path, sock_path))
Copy link

@coderabbitai coderabbitai bot Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Tighten qemu‑storage‑daemon lifecycle management (systemd‑run output + killall)

Two related points here:

  1. Service ID from systemd-run
    start_vhost_sock_service_in_source / _in_remote capture the raw stdout of systemd-run as vsock_service_id / remote_vsock_service_id, then later call systemctl stop {id}. systemd-run typically prints a sentence like Running as unit: foo.service, not just the unit name, so passing that whole string to systemctl stop is fragile and likely a no‑op. You either need to:

    • Specify a known --unit=<name> in the systemd-run command and use that name directly for systemctl stop, or
    • Parse the unit name out of stdout before storing it.
  2. Global killall qemu-storage-daemon on both hosts
    The pidof qemu-storage-daemon && killall qemu-storage-daemon cleanup on source and remote will terminate all qemu-storage-daemon instances, not just the one this test started. That can interfere with other tests or any legitimate services using qemu‑storage‑daemon on the same hosts.

It would be safer to manage just the service(s) you start (via explicit --unit names or PIDs) and avoid broad killall unless you know the environment is completely dedicated.

Also applies to: 95-98, 166-170, 173-178

🤖 Prompt for AI Agents
libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py
around lines 86-92 (and similarly 95-98, 166-170, 173-178): the test starts
qemu-storage-daemon with systemd-run and later stops it by passing the raw
systemd-run stdout to systemctl and by running global killall; change the start
command to include an explicit --unit=<unique_name> (or capture and parse the
unit name from systemd-run stdout) and store that unit name so subsequent
systemctl stop uses only that unit, and stop using killall qemu-storage-daemon —
instead record the daemon PID(s) you start (or rely on the named systemd unit)
and only kill/stop those specific PIDs/units during cleanup to avoid terminating
other processes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've adjusted this part, please check.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the current state of the vhostuser migration test file to see the adjustments
cat libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py

Length of output: 7424


@meinaLi, I appreciate the effort, but the core issue isn't fully resolved yet. While you removed the broken systemctl stop logic (which is good), the cleanup still uses pkill -f qemu-storage-daemon, which has the same problem as the original killall qemu-storage-daemon.

The problem: Both killall and pkill -f qemu-storage-daemon will terminate all qemu-storage-daemon processes on the host—not just the ones your test started. This can break other concurrent tests or legitimate services.

Recommended solution (choose one):

Option 1: Use explicit systemd unit names (cleanest approach)

# In the command construction (line ~86):
unit_name = f"vhost-test-{vm_name}-{int(time.time())}"  # unique unit name
start_sock_service_cmd = (
    f'systemd-run --unit={unit_name} --uid qemu --gid qemu /usr/bin/qemu-storage-daemon'
    ' --blockdev \'{"driver":"file","filename":"%s","node-name":"libvirt-1-storage",...}\''
    ...
)

# Store the unit_name in setup_test (return from start_vhost_* functions)
# Then in cleanup_test:
process.run(f"systemctl stop {unit_name}", ignore_status=True, shell=True)
remote.run_remote_cmd(f"systemctl stop {remote_unit_name}", params, ignore_status=True)

Option 2: Track PIDs
Capture the PID from the systemd-run output or the qemu-storage-daemon process itself, then kill only that specific PID during cleanup.

Would you like me to provide a more detailed code example for either approach?


🧠 Learnings used
Learnt from: hholoubk
Repo: autotest/tp-libvirt PR: 6579
File: libvirt/tests/src/sriov/vIOMMU/iommu_device_lifecycle.py:95-97
Timestamp: 2025-09-24T08:01:27.899Z
Learning: In the libvirt test framework used in tp-libvirt, VM cleanup including destroying running VMs is handled by the teardown method (test_obj.teardown_iommu_test()) called in the finally block, so explicit VM destroy calls on timeout are not necessary according to the maintainers.

@meinaLi meinaLi force-pushed the vhostuser_disk_migration branch from 8ca0104 to 822da95 Compare November 28, 2025 08:11
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py (2)

27-37: SELinux boolean domain_can_mmap_files is changed persistently on both hosts without restore

Both locally (Line 36–37) and remotely (Line 57–58) you run setsebool domain_can_mmap_files 1 -P, which permanently flips this SELinux boolean for the entire system and survives reboots. The test never restores the previous value, so it leaves a host‑wide configuration change behind and may affect other tests or users.

Consider one of the following instead:

  • Treat domain_can_mmap_files=on as an environmental precondition and document it in the test/config, removing the setsebool calls from the test, or
  • Capture the original value via getsebool domain_can_mmap_files on source/remote and restore it in cleanup_test (or a higher‑level teardown) so the host returns to its prior state.

As written this remains a major environment side‑effect.

Also applies to: 49-58


164-174: pkill -f qemu-storage-daemon kills all daemons on both hosts

In cleanup_test, the following commands:

  • Line 165: remote.run_remote_cmd("pkill -f qemu-storage-daemon", ...)
  • Line 169: process.run("pkill -f qemu-storage-daemon", ...)

will terminate every qemu-storage-daemon process on the remote and local hosts, not just the instance(s) started by this test. This can interfere with parallel tests or any other services using qemu‑storage‑daemon, which is the same concern previously raised for killall.

Since you already start the daemon via systemd-run, a more targeted approach would be to:

  • Give the transient unit an explicit, unique name via --unit=<name> in start_sock_service_cmd, and
  • In cleanup_test, stop only that unit on each host, e.g. systemctl stop <name> (with ignore_status=True), then drop the pkill calls entirely.

That keeps the cleanup scoped strictly to what this test started instead of indiscriminately killing all daemons.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8ca0104 and 822da95.

📒 Files selected for processing (2)
  • libvirt/tests/cfg/migration/migration_with_disk/migration_with_vhostuser.cfg (1 hunks)
  • libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • libvirt/tests/cfg/migration/migration_with_disk/migration_with_vhostuser.cfg
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-24T08:01:27.899Z
Learnt from: hholoubk
Repo: autotest/tp-libvirt PR: 6579
File: libvirt/tests/src/sriov/vIOMMU/iommu_device_lifecycle.py:95-97
Timestamp: 2025-09-24T08:01:27.899Z
Learning: In the libvirt test framework used in tp-libvirt, VM cleanup including destroying running VMs is handled by the teardown method (test_obj.teardown_iommu_test()) called in the finally block, so explicit VM destroy calls on timeout are not necessary according to the maintainers.

Applied to files:

  • libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py
🧬 Code graph analysis (1)
libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py (1)
libvirt/tests/src/migration/migrate_vm.py (1)
  • run_remote_cmd (759-776)
🪛 Ruff (0.14.6)
libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py

30-30: Function call with shell=True parameter identified, security issue

(S604)


32-32: Local variable cmd_output is assigned to but never used

Remove assignment to unused variable cmd_output

(F841)


32-32: Function call with shell=True parameter identified, security issue

(S604)


35-35: Function call with shell=True parameter identified, security issue

(S604)


37-37: Function call with shell=True parameter identified, security issue

(S604)


55-55: Local variable remote_vsock_service_id is assigned to but never used

Remove assignment to unused variable remote_vsock_service_id

(F841)


78-78: Probable insecure usage of temporary file or directory: "/tmp/vhost.sock"

(S108)


169-169: Function call with shell=True parameter identified, security issue

(S604)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Python 3.12
  • GitHub Check: Python 3.8
  • GitHub Check: Python 3.11
  • GitHub Check: Python 3.9
🔇 Additional comments (1)
libvirt/tests/src/migration/migration_with_disk/migration_with_vhostuser.py (1)

61-151: Overall migration flow and VM‑side verification look solid

The high‑level orchestration in run()setup_test to configure the vhost-user backend and disk, migration_obj.run_migration(), verify_test to switch to the destination and exercise the disk via lsblk + dd_data_to_vm_disk, and migration_obj.verify_default()—is coherent and matches existing migration patterns in tp-libvirt. The use of ast.literal_eval for disk_dict and vm_attrs, plus serial console login on the destination, is a nice touch for safety and robustness.

Aside from the SELinux/daemon‑lifecycle concerns noted elsewhere, the core test logic reads correctly.

Also applies to: 178-197

Automate case:
RHEL-200524: Migrate VM with a vhostuser disk

Signed-off-by: Meina Li <meili@redhat.com>
@meinaLi meinaLi force-pushed the vhostuser_disk_migration branch from 822da95 to 805abd7 Compare November 28, 2025 08:25
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