Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rajujith/4cc3f17379b63e86f73b041f2be75528 to your computer and use it in GitHub Desktop.
Save rajujith/4cc3f17379b63e86f73b041f2be75528 to your computer and use it in GitHub Desktop.
enable GPU passthrough on cloudstack KVM with extraconfig
On global configuration set enable.additional.vm.configuration =true
set paramaters name: allow.additional.vm.configuration.list.kvm
value: devices,hostdev,driver,source,address,alias
update instance with the extraconfig:
sample XML:
<devices>
<hostdev mode='subsystem' type='pci' managed='yes'>
<driver name='vfio'/>
<source>
<address domain='0x0000' bus='0x61' slot='0x00' function='0x0'/>
</source>
<alias name='nvidia0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x00' function='0x0'/>
</hostdev>
<hostdev mode='subsystem' type='pci' managed='yes'>
<driver name='vfio'/>
<source>
<address domain='0x0000' bus='0x62' slot='0x00' function='0x0'/>
</source>
<alias name='nvidia1'/>
<address type='pci' domain='ex0000' bus='0x00' slot='ex00' function='0x1'/>
</hostdev>
</devices >
CMK with URL encoded XML:
update virtualmachine id=fb381aeb-bf31-4011-98d9-c1556f984c70 extraconfig=%3Cdevices%3E%20%0A%09%3Chostdev%20mode%3D%27subsystem%27%20type%3D%27pci%27%20managed%3D%27yes%27%3E%0A%20%09%09%3Cdriver%20name%3D%27vfio%27%2F%3E%20%0A%20%09%09%3Csource%3E%20%0A%20%09%09%3Caddress%20domain%3D%270x0000%27%20bus%3D%270x61%27%20slot%3D%270x00%27%20function%3D%270x0%27%2F%3E%20%0A%20%09%09%3C%2Fsource%3E%20%0A%20%09%09%3Calias%20name%3D%27nvidia0%27%2F%3E%20%0A%20%09%09%3Caddress%20type%3D%27pci%27%20domain%3D%270x0000%27%20bus%3D%270x00%27%20slot%3D%270x00%27%20function%3D%270x0%27%2F%3E%20%0A%09%3C%2Fhostdev%3E%20%0A%09%3Chostdev%20mode%3D%27subsystem%27%20type%3D%27pci%27%20managed%3D%27yes%27%3E%0A%20%09%09%3Cdriver%20name%3D%27vfio%27%2F%3E%0A%20%09%09%3Csource%3E%0A%20%09%09%09%3Caddress%20domain%3D%270x0000%27%20bus%3D%270x62%27%20slot%3D%270x00%27%20function%3D%270x0%27%2F%3E%0A%20%09%09%20%3C%2Fsource%3E%0A%20%09%09%20%3Calias%20name%3D%27nvidia1%27%2F%3E%0A%20%09%09%20%3Caddress%20type%3D%27pci%27%20domain%3D%27ex0000%27%20bus%3D%270x00%27%20slot%3D%27ex00%27%20function%3D%270x1%27%2F%3E%20%0A%09%3C%2Fhostdev%3E%0A%3C%2Fdevices%20%3E%20
Reference:
[1] https://lab.piszki.pl/cloudstack-kvm-and-running-vm-with-vgpu/
[2] https://www.shapeblue.com/cloudstack-feature-first-look-enable-sending-of-arbitrary-configuration-data-to-vms/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment