[LTP] tst_virt: Add fallback KVM detection via virtio block devices

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Wed May 6 17:07:53 CEST 2026


Hi Darren,

On 2026-05-02, Darren Chang wrote:
> tst_virt: Add fallback KVM detection via virtio block devices

> +       /* * Fallback check for KVM:
> +        * Android's ueventd creates block devices in /dev/block/
> +        * instead of the standard Linux /dev/, so we check both.
> +        */

Malformed comment block. The `/*` opener must be on its own line with no
text. Use:

	/*
	 * Fallback check for KVM:
	 * ...
	 */

> +       if (!found) {
> +               if (access("/dev/vda", F_OK) == 0 ||
> +                       access("/sys/block/vda", F_OK) == 0 ||
> +                       access("/dev/block/vda", F_OK) == 0) {
> +                       found = 1;
> +               }
> +       }

Virtio block devices are not KVM-exclusive. Hyper-V and VMware guests with
virtio drivers also expose /dev/vda, so this will produce false positives.
Either narrow the detection (e.g. check /sys/class/dmi/id/product_name for
QEMU/KVM) or explicitly document this as a best-effort heuristic.

---
Note:

Our agent completed the review of the patch. The full review can be
found at: (not available)

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list