From 58957c219b1eac8b8db17f7854b3cd92fb1f1421 Mon Sep 17 00:00:00 2001 From: Daniel P. Berrangé Date: Sep 16 2024 14:40:12 +0000 Subject: Introduce QEMU_GA_ARGS env variable to replace BLACKLIST_RPC We previously replaced use of --blacklist with -b since the former was deleted in QEMU 9.1. We want to avoid use of the 'black list' term downstream too though. In future we're also expecting further command line args to be added to the guest agent which are desirable to set. Rather than hardcode the use of -b in the unit file, define a more general QEMU_GA_ARGS variable that enables the sysconfig file to set arbitrary extra command line arguments. A pre-start script is used to rewrite existing sysconfig files that users may have present to ensure upgradability. Signed-off-by: Daniel P. Berrangé --- diff --git a/qemu-ga.sysconfig b/qemu-ga.sysconfig index aea1ccb..5b2b3b4 100644 --- a/qemu-ga.sysconfig +++ b/qemu-ga.sysconfig @@ -1,11 +1,12 @@ # This is a systemd environment file, not a shell script. # It provides settings for "/lib/systemd/system/qemu-guest-agent.service". -# Comma-separated blacklist of RPCs to disable, or empty list to enable all. +# Extra arguments to pass to the guest QEMU, for example, to filter our +# RPC commands. See 'qemu-ga(8)' man page for permissible arguments. # -# You can get the list of RPC commands using "qemu-ga -b '?'". -# There should be no spaces between commas and commands in the blacklist. -#BLACKLIST_RPC=guest-file-open,guest-file-close,guest-file-read,guest-file-write,guest-file-seek,guest-file-flush,guest-exec,guest-exec-status +# For example, to filter out a set of commands the --block-rpcs commands: +# +#QEMU_GA_ARGS=--block-rpcs=guest-file-open,guest-file-close,guest-file-read,guest-file-write,guest-file-seek,guest-file-flush,guest-exec,guest-exec-status # Fsfreeze hook script specification. # diff --git a/qemu-guest-agent.service b/qemu-guest-agent.service index 0d89bb2..6734f7e 100644 --- a/qemu-guest-agent.service +++ b/qemu-guest-agent.service @@ -7,11 +7,13 @@ IgnoreOnIsolate=True [Service] UMask=0077 EnvironmentFile=/etc/sysconfig/qemu-ga +# Support upgrades from QEMU < 9.1 +ExecStartPre=/bin/sh -c "if grep '^BLACKLIST_RPC' /etc/sysconfig/qemu-ga >/dev/null ; then sed -i 's/^BLACKLIST_RPC=/QEMU_GA_ARGS=--block-rpcs=/' /etc/sysconfig/qemu-ga ; fi" ExecStart=/usr/bin/qemu-ga \ --method=virtio-serial \ --path=/dev/virtio-ports/org.qemu.guest_agent.0 \ - -b ${BLACKLIST_RPC} \ - -F${FSFREEZE_HOOK_PATHNAME} + -F${FSFREEZE_HOOK_PATHNAME} \ + $QEMU_GA_ARGS Restart=always RestartSec=0 diff --git a/qemu.spec b/qemu.spec index deb5bc5..c8b2ecb 100644 --- a/qemu.spec +++ b/qemu.spec @@ -367,7 +367,7 @@ Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38 %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 2 +%global baserelease 3 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -3150,6 +3150,10 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Mon Sep 16 2024 Daniel P. Berrangé - 9.1.0-3 +- Replace BLACKLIST_RPC with QEMU_GA_ARGS in sysconfig file +- Related rhbz #2258100 + * Mon Sep 16 2024 Richard W.M. Jones - 2:9.1.0-2 - Replace qemu --blacklist option with -b (related: RHBZ#2258100)