virsh-patcher icon indicating copy to clipboard operation
virsh-patcher copied to clipboard

Utility to apply common patches to libvirtd domain definitions.

Virsh Patcher

Simple utility to apply common changes to libvirtd guests.

Changes will not be applied if the guest is running.

Supported Fixes

  • Error 43 for Nvidia GPUs
  • Hugepages memory backing
  • host-passthrough CPU type.

Installation

Arch Linux

Install virshpatcher from the AUR.

Debian / Ubuntu

sudo apt-get install python-libvirt
sudo pip install -U https://github.com/PassthroughPOST/virsh-patcher/archive/master.zip

Fedora

$ sudo dnf install libvirt-python
$ sudo pip install -U https://github.com/PassthroughPOST/virsh-patcher/archive/master.zip

Other Distributions

The libvirt-python package is a dependency. This can be either installed by you distributions package manager, or via pip. In the latter case, libvirt-dev is required.

Usage

$ virshpatcher --error43 --hugepages --host-passthrough win10-guest
$ virshpatcher --help
usage: virshpatcher [--connect URI] [--error43] [--hugepages]
                    [--host-passthrough] [--patch PATCH] [--help]
                    [--vendor-id ab1234567890] [--random-vendor-id]
                    [DOMAIN [DOMAIN ...]]

libvirtd xml patcher

positional arguments:
  DOMAIN

optional arguments:
  --connect URI, -c URI
                        hypervisor connection URI
  --error43             Add fixes for 'error43' with nvidia devices.
  --hugepages           Make guest use hugepages.
  --host-passthrough    Make guest CPU model `host_passthrough`.
  --patch PATCH, -p PATCH
                        `XMLPatcher` class path
  --help, -h            This help text
  --vendor-id ab1234567890
                        Vendor ID for E43 patch.
  --random-vendor-id    Set a random Vendor ID.

Future Improvements

  • Add ability to connect PCI devices to guest (By name/pattern/id?)
  • Interactive (?)
  • More tests.