qemu-server has a new phase 'post-pci-prepare' that is called for vms with pci passthrough for each device prepared.
add that to the example hookscript and explain when it's called and it's parameters with a comment. Signed-off-by: Dominik Csapak <[email protected]> --- changes from v1: * adapt to the changes from positional parameters to environment variables examples/guest-example-hookscript.pl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/examples/guest-example-hookscript.pl b/examples/guest-example-hookscript.pl index 1cce2e3..a5a50d5 100755 --- a/examples/guest-example-hookscript.pl +++ b/examples/guest-example-hookscript.pl @@ -38,6 +38,31 @@ if ($phase eq 'pre-start') { print "$vmid started successfully.\n"; +} elsif ($phase eq 'post-pci-prepare') { + + # Only called for virtual machines, not containers. + # + # This phase will be called for each pci device that is passed through, + # after it was prepared by the PVE stack. In other words when either + # * the mdev/vGPU was created + # * the driver was changed to vfio-pci and the device was reset + # + # This phase has 3 additional parameters given via the environment + + # the id from the config, e.g. 'hostpci0' + my $hostpci_x = $ENV{ID}; + + # the pciid of the passed through device or the underlying device in case of an mdev/vGPU + # e.g. '0000:01:00.0' + my $pciid = $ENV{PCIID}; + + # the uuid of the mediated device if it was one, + # e.g. '00000001-0000-0000-0000-000000008006' + my $mdev_uuid = $ENV{MDEV_UUID}; + + print "Prepared PCI device for $hostpci_x with pciid: $pciid.\n"; + print "It is a mediated device with UUID: $mdev_uuid\n" if $mdev_uuid; + } elsif ($phase eq 'pre-stop') { # Third phase 'pre-stop' will be executed before stopping the guest -- 2.47.3 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
