Add some virtinst improvements

Add qemu guest agent channel, set video to virtio, handle other options
at the end of the command.
This commit is contained in:
Anthony Rose 2023-01-19 09:09:00 +00:00
parent 483326c231
commit f064349727

View file

@ -382,39 +382,32 @@ virtinst () {
_acp_vm_root="$HOME/virt/images" _acp_vm_root="$HOME/virt/images"
_acp_vm_session=qemu:///session _acp_vm_session=qemu:///session
if [ "$1" = "--help" ] case "$1" in
then "--help" | -*)
echo "Usage: virtinst vmname cdrom" >&2 echo "Usage: virtinst vmname --cdrom install.iso [other virt-install options]" >&2
return return
fi ;;
if [ $# -ne 2 ] *)
then ;;
virtinst --help esac
return
fi
_acp_vm_name=$1 _acp_vm_name=$1
if [ "$2" = "--import" ]
then
_acp_vm_cdrom="--import"
else
_acp_vm_cdrom="--cdrom $2"
fi
virt-install --connect $_acp_vm_session \ virt-install --connect $_acp_vm_session \
--name $_acp_vm_name \
--osinfo linux2020 \ --osinfo linux2020 \
--boot uefi \ --boot uefi \
$_acp_vm_cdrom \ --cpu host-passthrough \
--disk $_acp_vm_root/${_acp_vm_name}.qcow2,size=20 \ --disk $_acp_vm_root/${_acp_vm_name}.qcow2,size=20 \
--graphics vnc \ --graphics vnc \
--console pty,target.type=virtio \ --console pty,target.type=virtio \
--autoconsole none --channel unix,target.type=virtio,target.name=org.qemu.guest_agent.0 \
--video virtio \
--autoconsole none \
--name $*
unset _acp_vm_name unset _acp_vm_name
unset _acp_vm_root
unset _acp_vm_cdrom
unset _acp_vm_session unset _acp_vm_session
unset _acp_vm_root
} }
if [ -r "$XDG_CONFIG_HOME/profile.local" ] if [ -r "$XDG_CONFIG_HOME/profile.local" ]