From 58189e6be2ce96fe1341f28bab45663c9636472e33be6583dcbd5ab53800633f Mon Sep 17 00:00:00 2001 From: Bruce Rogers Date: Wed, 13 Jan 2021 22:38:56 +0000 Subject: [PATCH] Accepting request 862991 from home:bfrogers:branches:Virtualization - Convert qemu-kvm from a script to a symlink. This method of invoking the QEMU emulator has been deprecated for some time, but is still provided. It has as it's origins a version of QEMU which had KVM acceleration enabled by default. In it's recent incarnation it is a script which adds '-machine accel=kvm' to the beginning of the list of command line options passed to the emulator. This method collides with the now preferred method of specifying acceleration options by using -accel. qemu-kvm is now changed to simply be a symlink to the same QEMU binary which the prior script exec'd. This new approach takes advantage of a built in QEMU feature where if QEMU is invoked using a program name ending in 'kvm', KVM emulation is enabled. This approach is better in that it is more compatible with any other command line option that may be added for specifying acceleration (not that you should do that). For those who have taken advantage of the fact that you can add additional command line options to the qemu-kvm script, or doing other things in that script you will just need to create an alternate script "emulator" to achieve the same. It's possible that there may be some very subtle behavioral difference in the switch from a script to a symlink, but given that qemu-kvm is a deprecated package, we're not going to worry about that. OBS-URL: https://build.opensuse.org/request/show/862991 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=601 --- qemu.changes | 26 ++++++++++++++++++++++++++ qemu.spec | 20 ++++++-------------- qemu.spec.in | 20 ++++++-------------- 3 files changed, 38 insertions(+), 28 deletions(-) diff --git a/qemu.changes b/qemu.changes index 6a7ce026..afe65cfd 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,29 @@ +------------------------------------------------------------------- +Wed Jan 13 19:48:17 UTC 2021 - Bruce Rogers + +- Convert qemu-kvm from a script to a symlink. This method of + invoking the QEMU emulator has been deprecated for some time, + but is still provided. It has as it's origins a version of QEMU + which had KVM acceleration enabled by default. In it's recent + incarnation it is a script which adds '-machine accel=kvm' to the + beginning of the list of command line options passed to the + emulator. This method collides with the now preferred method of + specifying acceleration options by using -accel. qemu-kvm is now + changed to simply be a symlink to the same QEMU binary which the + prior script exec'd. This new approach takes advantage of a built + in QEMU feature where if QEMU is invoked using a program name + ending in 'kvm', KVM emulation is enabled. This approach is + better in that it is more compatible with any other command line + option that may be added for specifying acceleration (not that + you should do that). + For those who have taken advantage of the fact that you can add + additional command line options to the qemu-kvm script, or doing + other things in that script you will just need to create an + alternate script "emulator" to achieve the same. It's possible + that there may be some very subtle behavioral difference in the + switch from a script to a symlink, but given that qemu-kvm is a + deprecated package, we're not going to worry about that. + ------------------------------------------------------------------- Tue Jan 5 14:56:10 UTC 2021 - Bruce Rogers diff --git a/qemu.spec b/qemu.spec index 162f58cd..cf3e2c85 100644 --- a/qemu.spec +++ b/qemu.spec @@ -507,10 +507,10 @@ Obsoletes: kvm < %{qemuver} %description kvm %{generic_qemu_description} -This package simply provides a shell script wrapper for the QEMU program which -does the actual machine emulation and virtualization for this architecture. The -wrapper simply adds command-line parameters to ensure that the KVM accelerator -is invoked. It provides no additional benefit, and is considered deprecated. +This package provides a symlink to the main QEMU emulator used for KVM +virtualization. The symlink is named qemu-kvm, which causes the QEMU program +to enable the KVM accelerator, due to the name reference ending with 'kvm'. +This package is an artifact of the early origins of QEMU, and is deprecated. %endif %package lang @@ -1643,22 +1643,14 @@ install -D -m 0644 %{SOURCE11} %{buildroot}%_docdir/qemu-ppc/supported.txt install -D -m 0644 %{SOURCE12} %{buildroot}%_docdir/qemu-x86/supported.txt install -D -m 0644 %{SOURCE13} %{buildroot}%_docdir/qemu-s390x/supported.txt %if %{legacy_qemu_kvm} -cat > %{buildroot}%_bindir/qemu-kvm << 'EOF' -#!/bin/sh - -%ifarch s390x -exec %_bindir/qemu-system-s390x -machine accel=kvm "$@" -%else -exec %_bindir/qemu-system-x86_64 -machine accel=kvm "$@" -%endif -EOF -chmod 755 %{buildroot}%_bindir/qemu-kvm install -D -m 0644 %{SOURCE5} %{buildroot}%_mandir/man1/qemu-kvm.1.gz install -d %{buildroot}%_docdir/qemu-kvm %ifarch s390x +ln -s qemu-system-s390x %{buildroot}%_bindir/qemu-kvm ln -s ../qemu-s390x/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.txt rst2html --exit-status=2 %{buildroot}%_docdir/qemu-s390x/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.html %else +ln -s qemu-system-x86_64 %{buildroot}%_bindir/qemu-kvm ln -s ../qemu-x86/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.txt rst2html --exit-status=2 %{buildroot}%_docdir/qemu-x86/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.html %endif diff --git a/qemu.spec.in b/qemu.spec.in index a2ced03b..88ad1473 100644 --- a/qemu.spec.in +++ b/qemu.spec.in @@ -440,10 +440,10 @@ Obsoletes: kvm < %{qemuver} %description kvm %{generic_qemu_description} -This package simply provides a shell script wrapper for the QEMU program which -does the actual machine emulation and virtualization for this architecture. The -wrapper simply adds command-line parameters to ensure that the KVM accelerator -is invoked. It provides no additional benefit, and is considered deprecated. +This package provides a symlink to the main QEMU emulator used for KVM +virtualization. The symlink is named qemu-kvm, which causes the QEMU program +to enable the KVM accelerator, due to the name reference ending with 'kvm'. +This package is an artifact of the early origins of QEMU, and is deprecated. %endif %package lang @@ -1510,22 +1510,14 @@ install -D -m 0644 %{SOURCE11} %{buildroot}%_docdir/qemu-ppc/supported.txt install -D -m 0644 %{SOURCE12} %{buildroot}%_docdir/qemu-x86/supported.txt install -D -m 0644 %{SOURCE13} %{buildroot}%_docdir/qemu-s390x/supported.txt %if %{legacy_qemu_kvm} -cat > %{buildroot}%_bindir/qemu-kvm << 'EOF' -#!/bin/sh - -%ifarch s390x -exec %_bindir/qemu-system-s390x -machine accel=kvm "$@" -%else -exec %_bindir/qemu-system-x86_64 -machine accel=kvm "$@" -%endif -EOF -chmod 755 %{buildroot}%_bindir/qemu-kvm install -D -m 0644 %{SOURCE5} %{buildroot}%_mandir/man1/qemu-kvm.1.gz install -d %{buildroot}%_docdir/qemu-kvm %ifarch s390x +ln -s qemu-system-s390x %{buildroot}%_bindir/qemu-kvm ln -s ../qemu-s390x/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.txt rst2html --exit-status=2 %{buildroot}%_docdir/qemu-s390x/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.html %else +ln -s qemu-system-x86_64 %{buildroot}%_bindir/qemu-kvm ln -s ../qemu-x86/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.txt rst2html --exit-status=2 %{buildroot}%_docdir/qemu-x86/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.html %endif