Skip to content

Add libvirt/KVM VM scripts for Linux x86_64 testing#5

Merged
edcdavid merged 3 commits into
mainfrom
linux-x86-host
Jun 26, 2026
Merged

Add libvirt/KVM VM scripts for Linux x86_64 testing#5
edcdavid merged 3 commits into
mainfrom
linux-x86-host

Conversation

@edcdavid

@edcdavid edcdavid commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add scripts/setup-libvirt-ubuntu.sh — creates a libvirt/KVM VM with DKMS modules installed and loaded, adds an SSH config entry
  • Add scripts/test-libvirt-ubuntu.sh — full VM lifecycle: create, install DKMS, smoke tests, ptp-operator e2e tests
  • Scripts run without root when the user is in the libvirt and kvm groups (only sudo for starting libvirtd if needed)
  • Update README with libvirt/KVM setup and test-running instructions

Running ptp-operator tests

cd ptp-operator/scripts
./run-on-vm.sh --dkms --mode oc,bc,dualnicbc,dualnicbcha,dualfollower <VM_IP> | tee logs.txt

Test plan

  • Run ./scripts/setup-libvirt-ubuntu.sh on an x86_64 Linux host as a non-root user in the libvirt group
  • SSH into the VM and verify DKMS modules are loaded
  • Run ptp-operator tests with ./run-on-vm.sh --dkms
  • Verify --cleanup removes the VM

Assisted-By: Cursor

Add setup and test scripts for running netdevsim DKMS smoke tests and
ptp-operator e2e tests inside libvirt/KVM VMs on Linux x86_64 hosts.

Scripts:
- setup-libvirt-ubuntu.sh: create VM, install DKMS, add SSH config
- test-libvirt-ubuntu.sh: full lifecycle including ptp-operator tests

Update README with libvirt setup docs and test instructions:
  ./run-on-vm.sh --dkms --mode oc,bc,dualnicbc,dualnicbcha,dualfollower <VM_IP>
edcdavid added 2 commits June 25, 2026 14:53
Use LIBVIRT_DEFAULT_URI=qemu:///system so virsh/virt-install connect to
the system daemon via polkit instead of requiring root. Only sudo is
used for starting libvirtd if it is not already running. The script now
checks for libvirt and kvm group membership and gives actionable errors.
- Store qcow2 disk and cloud-init ISO in ~/.local/share/netdevsim-dkms/
  so the VM survives script exit
- Use LIBVIRT_DEFAULT_URI=qemu:///system with polkit instead of root
- Detect QEMU user (libvirt-qemu/qemu) and check ACL permissions
- No sudo calls; script exits with actionable fix commands instead
- Update README with group membership and ACL setup instructions
@lack

lack commented Jun 26, 2026

Copy link
Copy Markdown

Worked great for me under Fedora-43, thank you!

@edcdavid edcdavid merged commit abfbd8a into main Jun 26, 2026
10 of 13 checks passed
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.

2 participants