Refactor ignore_msrs_alert to make in non-blocking

This commit is contained in:
Martin Wimpress 2021-10-21 00:03:35 +01:00 committed by Martin Wimpress
parent 119e4dd7ad
commit e493112688

View File

@ -15,44 +15,20 @@ function ask_option_msrs() {
fi fi
} }
function ask_persist_msrs() {
ignore_msrs=$(cat /sys/module/kvm/parameters/ignore_msrs)
#Skip if already persisted, assuming initramfs rebuilt
grep -lq 'ignore_msrs=Y' /etc/modprobe.d/kvm.conf >/dev/null 2>&1 || \
if [ ${ignore_msrs} = "Y" ]; then
echo
echo "To make setting ignore_msrs a more persistant solution you may run the following:"
echo 'echo "options kvm ignore_msrs=Y" | sudo tee -a /etc/modprobe.d/kvm.conf && sudo update-initramfs -k all -u'
echo
while true ; do
read -p "Do you wish to set ignore_msrs at boot? (y/N)" bootrsp
case $bootrsp:0:1 in
[yY]* ) echo "options kvm ignore_msrs=Y" | sudo tee -a /etc/modprobe.d/kvm.conf && sudo update-initramfs -k all -u ; break;;
* ) break ;;
esac
done
fi
}
function ignore_msrs_alert() { function ignore_msrs_alert() {
ignore_msrs=$(cat /sys/module/kvm/parameters/ignore_msrs) local ignore_msrs=""
if [ -e /sys/module/kvm/parameters/ignore_msrs ]; then
if [ ${ignore_msrs} = "N" ]; then ignore_msrs=$(cat /sys/module/kvm/parameters/ignore_msrs)
# Some macos and windows installations need this to successfully boot if [ "${ignore_msrs}" == "N" ]; then
echo ' echo " - MSR: WARNING! Ignoring unhandled Model-Specific Registers is disabled."
If you experience issues booting macos or windows like those mentioned in echo
echo " echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs"
https://github.com/wimpysworld/quickemu/issues/88 echo
echo " If you are unable to run macOS or Windows VMs then run the above 👆"
then you can try the provided solution as a temporary fix by executing: echo " This will enable ignoring of unhandled MSRs until you reboot the host."
echo " You can make this change permenant by running: 'quickemu --ignore-msrs-always'"
"echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs"' fi
echo -n "I can do that for you now. " ; ask_option_msrs
fi fi
ask_persist_msrs
} }
function disk_delete() { function disk_delete() {