Created
January 20, 2020 22:34
-
-
Save JJRcop/e1b8dac1b4a353e07d0062f5106d2dda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Launches one-time modified domain with video switched to VGA and VGA passthrough removed | |
# Requires libvirt and virtinst | |
# Assumes you have VGA passthrough with a display server attached, with video device likely set to 'none' | |
# Your domain name | |
DOMAIN="mydomain" | |
# Set to qxl if you wish | |
NEW_VIDEO="vga" | |
# your passed through VGA card devices findable by virt-xml | |
VGA_DEVICES="27:00.0 27:00.1" | |
virt-xml --edit --video model.type=${2:-$NEW_VIDEO} --connect qemu:///system ${1:-$DOMAIN} --print-xml > /tmp/custom-virsh-create_novfio.xml | |
for DEVICE in ${3:-$VGA_DEVICES} | |
do virt-xml --remove-device --hostdev $DEVICE --print-xml < /tmp/custom-virsh-create_novfio.xml > /tmp/custom-virsh-create_remove-$DEVICE.xml | |
cat /tmp/custom-virsh-create_remove-$DEVICE.xml > /tmp/custom-virsh-create_novfio.xml | |
rm /tmp/custom-virsh-create_remove-$DEVICE.xml | |
done | |
virsh --connect qemu:///system create /tmp/custom-virsh-create_novfio.xml | |
rm /tmp/custom-virsh-create_novfio.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment