Remake of PR 1393

This is the virt-test pertinent part of PR #1393.