Skip to content

Commit

Permalink
utils/qmp-query-cpu-model-expansion.sh: add env machineOpt,cpuOpt
Browse files Browse the repository at this point in the history
I seem to know why kiss-vm fails to install Windows while using
virt-install-5: the hyper-v feature enabled by virt-install-5 by
default is overridden by the qemucpu setting in kiss-vm.

will fix that later

Signed-off-by: Jianhong Yin <[email protected]>
  • Loading branch information
tcler committed Jan 5, 2025
1 parent 9f6caab commit efccffa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion kiss-vm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ orig_disable_ipv6=$(/sbin/sysctl -n net.ipv6.conf.all.disable_ipv6 2>/dev/null)
#workaround for creating Windows VM fail with virt-install-5.0
[[ "$(virt-install --version 2>/dev/null)" = 5.0* ]] && {
virtinstHypervList=$(virt-install --features=?|awk '/hyperv/{print $1}')
qemuHyvFalseList=$(qmp-query-cpu-model-expansion.sh | sed -rn '/ *"hv-(.+)": false,/{s//hyperv.\1.state/;p}')
qemuHyvFalseList=$(cpuOpt=host qmp-query-cpu-model-expansion.sh | sed -rn '/ *"hv-(.+)": false,/{s//hyperv.\1.state/;p}')
hyvofflist=$(for hyvf in $qemuHyvFalseList; do grep -q ${hyvf} <<<"${virtinstHypervList}" && echo ${hyvf}=off; done | paste -s -d,)
VIRT_INSTALL_OPTS+=("--features=$hyvofflist")
}
Expand Down
5 changes: 3 additions & 2 deletions utils/qmp-query-cpu-model-expansion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
HostARCH=$(uname -m)
QEMU_KVM=$(PATH=/usr/libexec:$PATH command -v qemu-kvm 2>/dev/null)

machineOpt="-M q35,accel=kvm"
cpuOpt="${cpuOpt:-host,migratable=on,hv-time=on,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x1fff,hv-vpindex=on,hv-runtime=on,hv-synic=on,hv-stimer=on,hv-frequencies=on,hv-tlbflush=on,hv-ipi=on,hv-avic=on}"
machineOpt="${machineOpt:-q35,accel=kvm}"
sessionName=qmpQueryCpuModel-$$
unixSocketPath=/tmp/${sessionName}.unix
qmpQueryCpuModelExpation() {
Expand All @@ -25,7 +26,7 @@ qmpQueryCpuModelExpation() {
viewCmd=cat
[[ -t 1 || ! -p /dev/stdout ]] && viewCmd=less
$viewCmd < <(
tmux new -s ${sessionName} -d ${QEMU_KVM} ${machineOpt} -nographic -qmp unix:${unixSocketPath},server,nowait
tmux new -s ${sessionName} -d ${QEMU_KVM} -M ${machineOpt} -cpu ${cpuOpt} -nographic -qmp unix:${unixSocketPath},server,nowait
qmpQueryCpuModelExpation ${unixSocketPath}
tmux kill-session -t ${sessionName}
)

0 comments on commit efccffa

Please sign in to comment.