From fa11852433d5b414c3b9d99ed0139a0cb75391aa Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 23 Aug 2021 15:01:43 +0200 Subject: [PATCH] qemu: domain: Remove qemuDomainIsUsingNoShutdown Directly use 'priv->allowReboot' as we now document what the behaiour is to avoid another lookup. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 4 +--- src/qemu/qemu_domain.c | 16 ---------------- src/qemu/qemu_domain.h | 3 --- src/qemu/qemu_process.c | 3 +-- 4 files changed, 2 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2756f46b51..5b743dd1ad 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6165,11 +6165,9 @@ qemuBuildPMCommandLine(virCommand *cmd, { virQEMUCaps *qemuCaps = priv->qemuCaps; - /* Only add -no-reboot option if each event destroys domain */ if (priv->allowReboot == VIR_TRISTATE_BOOL_NO) virCommandAddArg(cmd, "-no-reboot"); - - if (qemuDomainIsUsingNoShutdown(priv)) + else virCommandAddArg(cmd, "-no-shutdown"); if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI)) { diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 50a921c80d..65c3394d99 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11139,22 +11139,6 @@ qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason) } -/* qemuDomainIsUsingNoShutdown: - * @priv: Domain private data - * - * We can receive an event when QEMU stops. If we use no-shutdown, then - * we can watch for this event and do a soft/warm reboot. - * - * Returns: @true when -no-shutdown either should be or was added to the - * command line. - */ -bool -qemuDomainIsUsingNoShutdown(qemuDomainObjPrivate *priv) -{ - return priv->allowReboot == VIR_TRISTATE_BOOL_YES; -} - - bool qemuDomainDiskIsMissingLocalOptional(virDomainDiskDef *disk) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index f3c6bb3390..cb1cd968d5 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1001,9 +1001,6 @@ void qemuDomainStorageIdReset(qemuDomainObjPrivate *priv); virDomainEventResumedDetailType qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason); -bool -qemuDomainIsUsingNoShutdown(qemuDomainObjPrivate *priv); - bool qemuDomainDiskIsMissingLocalOptional(virDomainDiskDef *disk); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index a07231976f..6eb104c70b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8751,8 +8751,7 @@ qemuProcessReconnect(void *opaque) * domain crashed; otherwise, if the monitor was started, * then we can blame ourselves, else we failed before the * monitor started so we don't really know. */ - if (!priv->mon && tryMonReconn && - qemuDomainIsUsingNoShutdown(priv)) + if (!priv->mon && tryMonReconn && priv->allowReboot == VIR_TRISTATE_BOOL_YES) state = VIR_DOMAIN_SHUTOFF_CRASHED; else if (priv->mon) state = VIR_DOMAIN_SHUTOFF_DAEMON;