MT#60284 Make sure qemu-guest-agent is available

Now that we enabled the QEMU Guest Agent option for our PVE VMs, we need
to have qemu-guest-agent present and active. Otherwise the VMs might
fail to shut down, like with our debian/sipwise/docker Debian systems
which are created via
https://jenkins.mgm.sipwise.com/job/daily-build-matrix-debian-boxes/:

| [proxmox-vm-shutdown] $ /bin/sh -e /tmp/env-proxmox-vm-shutdown7956268380939677154.sh
| [environment-script] Adding variable 'vm1reset' with value 'NO'
| [environment-script] Adding variable 'vm2' with value 'none'
| [environment-script] Adding variable 'vm1' with value 'none'
| [environment-script] Adding variable 'vm2reset' with value 'NO'
| [proxmox-vm-shutdown] $ /bin/bash /tmp/jenkins14192704603218787414.sh
| Using safe VM 'shutdown' for modern releases (mr6.5+). Executing action 'shutdown'...
| Shutting down VM 106
| Build timed out (after 10 minutes). Marking the build as aborted.
| Build was aborted
| [WS-CLEANUP] Deleting project workspace...

Let's make sure qemu-guest-agent is available in our Grml live system.
We added qemu-guest-agent to the package list of our Grml Sipwise ISO
(see git rev 65c3fea4c), but to ensure we don't strictly depend on this
brand new Grml Sipwise ISO yet, make sure to install it on-the-fly if
not yet present (like we already did for git, augeas-tools + gdisk).

Also make sure qemu-guest-agent service is enabled if socket
/dev/virtio-ports/org.qemu.guest_agent.0 is present (indicating that the
agent feature is enabled on VM level).

Furthermore ensure qemu-guest-agent is present also in the installed
Debian system. Otherwise when rebooting the VM once it's no longer
running the Grml live system but the installed Debian system, it might
also fail to shutdown. So add it to the default package list of packages
for bootstrapping.

Change-Id: Id6adac55a47cfaed542cad2f9ac9740783e6d924
(cherry picked from commit 82e6638b40)
mr12.3
Michael Prokop 11 months ago
parent 7b53466fb1
commit 75c4a06fa4

@ -1463,7 +1463,7 @@ export LANG=C
unset SHELL
# defaults
ADDITIONAL_PACKAGES=(git augeas-tools gdisk)
ADDITIONAL_PACKAGES=(git augeas-tools gdisk qemu-guest-agent)
ADJUST_FOR_LOW_PERFORMANCE=false
ARCH=$(dpkg --print-architecture)
CARRIER_EDITION=false
@ -1535,6 +1535,11 @@ trap 'wait_exit;' 1 2 3 6 15 ERR EXIT
echo "Host IP: $(ip-screen)"
echo "Deployment version: $SCRIPT_VERSION"
# MT#60284 ensure qemu-guest-agent is running if it's available in VM
if [ -S /dev/virtio-ports/org.qemu.guest_agent.0 ] ; then
systemctl start qemu-guest-agent
fi
enable_deploy_status_server
set_deploy_status "checkBootParam"
@ -2161,7 +2166,7 @@ case "${DEBIAN_RELEASE}" in
;;
esac
DEBOPT_OPTIONS+=("--variant=minbase --include=systemd,systemd-sysv,init,zstd,isc-dhcp-client,ifupdown,ca-certificates${pkg_eatmydata}${pkg_usrmerge}")
DEBOPT_OPTIONS+=("--variant=minbase --include=systemd,systemd-sysv,init,zstd,isc-dhcp-client,ifupdown,ca-certificates,qemu-guest-agent${pkg_eatmydata}${pkg_usrmerge}")
# TT#61152 Add configuration Acquire::Retries=3, for apt to retry downloads
DEBOPT_OPTIONS+=("--aptopt='Acquire::Retries=3'")

Loading…
Cancel
Save