libvirt hooks not working


Recommended Posts

Hi,

 

as we have libvirt 6.5, shouldnt it be possible to use hook scripts ?

 

i created the folder /etc/libvirt/hooks/qemu.d/ where the scripts should be executed ordered by name (i only need 1)

 

so in my case i added a script work_gvt.sh, chmod +x, with the following content (also a test output which also doesnt get executed)

 

#!/bin/bash

echo "Testrun" > /mnt/cache/testrun.txt

if [ $# -ge 3 ]; then
    if [ $1 = "Work_gvt" -a $2 = "prepare" -a $3 = "begin" ]; then
        echo "Creating vgpu"
        echo ee0036c0-8e21-40b2-9f33-8d5c5f6f5f93 > "/sys/devices/pci0000:00/0000:00:02.0/mdev_supported_types/i915-GVTg_V5_8/create"
    elif [ $1 = "Work_gvt" -a $2 = "release" -a $3 = "end" ]; then
        echo "removing vgpu"
        echo 1 > "/sys/devices/pci0000:00/0000:00:02.0/ee0036c0-8e21-40b2-9f33-8d5c5f6f5f93/remove"
    fi
fi

 

so question is, only possible to modify the limetech qemu file to initiate things ... which shouldnt be the goal i d guess.

Edited by alturismo
Link to comment
  • 3 months later...

Hi @alturismo working with ljm42 & ich777  on a new suggested hooks file, this my current prototype suggested directory structure.

 

root@computenode:/etc/libvirt/hooks# tree
.
├── qemu
├── qemu.d
│   ├── #all
│   │   ├── prepare
│   │   │   └── USB_Manager
│   │   ├── start
│   │   │   └── VM_Manager
│   │   └── stopped
│   │       └── USB_Manager -> /etc/libvirt/hooks/qemu.d/#all/prepare/USB_Manager
│   ├── Ubuntu
│   │   ├── start
│   │   └── stopped
│   │       └── gvt
│   └── Windows 10 test4
│       ├── prepare
│       │   └── gvt
│       └── release
│           └── gvt
├── qemu.old
├── qemu.orig
└── qemu_hook_version

 

 

Link to comment
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.