On 8/24/21 4:44 PM, Peter Krempa wrote:
> While investigating how to fix issue with transient disks breaking when
> -no-shutdown is not used I've ended up figuring out that lifecycle
> action handling in the qemu driver is very broken.
>
> Unbreak the handling by rejecting some actions which were never
> implemented, add support for 'set-action' qmp command and use it to
> update the 'reset' action in qemu and always use '-no-shutdown'.
>
> Peter Krempa (22):
> qemuMonitorJSONSetWatchdogAction: Use automatic memory clearing
> qemuDomainSetLifecycleAction: Add a note about argument range-check
> qemu: driver: Use 'qemuDomainSaveStatus' for saving status XML
> qemu: validate: Reformat header and purge unused includes
> qemu: Reject 'rename-restart' action for
> 'on_reboot'/'on_poweroff'/'on_crash'
> qemu: driver: Validate lifecycle actions in
> 'qemuDomainSetLifecycleAction'
> qemu: Reject 'preserve' action for
> 'on_reboot'/'on_poweroff'/'on_crash'
> qemu: Honor 'restart' action for 'on_poweroff'
> qemu: capablities: Detect presence of 'set-action' as
> QEMU_CAPS_SET_ACTION
> qemu: monitor: Implement monitor code for 'set-action' command
> qemuDomainAttachWatchdog: Use 'set-action' instead of
> 'watchdog-set-action' if supported
> qemuxml2argvtest: Add 'LATEST' version of 'misc-no-reboot' test case
> qemuDomainObjPrivate: Annotate 'allowReboot' field
> qemu: migration: Don't transfer 'allowReboot' flag
> qemu: domain: Remove qemuDomainIsUsingNoShutdown
> qemuDomainSetLifecycleAction: Forbid live update of 'on_reboot'
> qemuProcessHandleReset: Don't emulate lifecycle actions for RESET
> event
> qemuProcessLaunch: Setup handling of 'on_reboot' via QMP when starting
> the process
> qemu: command: Always use '-no-shutdown'
> qemu: process: Don't set 'allowReboot' when qemu supports 'set-action'
> qemuDomainSetLifecycleAction: Properly update 'onReboot' action in
> qemu
> qemu: process: Ignore 'RESET' event during startup
>
> docs/formatdomain.rst | 8 +-
> src/qemu/qemu_capabilities.c | 2 +
> src/qemu/qemu_capabilities.h | 1 +
> src/qemu/qemu_command.c | 14 +-
> src/qemu/qemu_domain.c | 16 --
> src/qemu/qemu_domain.h | 11 +-
> src/qemu/qemu_driver.c | 201 +++++++++++-------
> src/qemu/qemu_hotplug.c | 54 ++++-
> src/qemu/qemu_migration.c | 5 -
> src/qemu/qemu_migration_cookie.c | 22 --
> src/qemu/qemu_migration_cookie.h | 4 -
> src/qemu/qemu_monitor.c | 16 ++
> src/qemu/qemu_monitor.h | 49 +++++
> src/qemu/qemu_monitor_json.c | 95 ++++++++-
> src/qemu/qemu_monitor_json.h | 7 +
> src/qemu/qemu_process.c | 85 +++++---
> src/qemu/qemu_validate.c | 51 +++++
> src/qemu/qemu_validate.h | 31 +--
> .../caps_6.0.0.aarch64.xml | 1 +
> .../qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 +
> .../caps_6.0.0.x86_64.xml | 1 +
> .../caps_6.1.0.x86_64.xml | 1 +
> .../basic-xml2xml-out.xml | 1 -
> .../full-xml2xml-out.xml | 1 -
> .../modern-dom-out-dest.xml | 1 -
> .../modern-dom-out-source.xml | 1 -
> .../nbd-bitmaps-xml2xml-out.xml | 1 -
> tests/qemumonitorjsontest.c | 6 +
> .../misc-no-reboot.x86_64-latest.args | 35 +++
> tests/qemuxml2argvtest.c | 1 +
> 30 files changed, 529 insertions(+), 194 deletions(-)
> create mode 100644 tests/qemuxml2argvdata/misc-no-reboot.x86_64-latest.args
>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Michal