]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: domain: Remove qemuDomainIsUsingNoShutdown
authorPeter Krempa <pkrempa@redhat.com>
Mon, 23 Aug 2021 13:01:43 +0000 (15:01 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 25 Aug 2021 13:32:44 +0000 (15:32 +0200)
Directly use 'priv->allowReboot' as we now document what the behaiour is
to avoid another lookup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_command.c
src/qemu/qemu_domain.c
src/qemu/qemu_domain.h
src/qemu/qemu_process.c

index 2756f46b51d727f2db16b30020808aaed641f7f2..5b743dd1adf0d7cf4d447a4a780a37666cfe4ed9 100644 (file)
@@ -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)) {
index 50a921c80d273a19a7f9e43c7284e411c04914c1..65c3394d9968764488e4a04b99ab6cae37587a0b 100644 (file)
@@ -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)
 {
index f3c6bb33904395fc3702e04a5b7d1a4234404dcd..cb1cd968d53388df892f3dc295a579e5b3cda670 100644 (file)
@@ -1001,9 +1001,6 @@ void qemuDomainStorageIdReset(qemuDomainObjPrivate *priv);
 virDomainEventResumedDetailType
 qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason);
 
-bool
-qemuDomainIsUsingNoShutdown(qemuDomainObjPrivate *priv);
-
 bool
 qemuDomainDiskIsMissingLocalOptional(virDomainDiskDef *disk);
 
index a07231976fb1d42c28d0c7ac0c9cb29f8854e068..6eb104c70b8649f45faaefaaea03d9fe2888b037 100644 (file)
@@ -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;