From 8b85f8f9360bb780725a2a7128db3858c944a56c Mon Sep 17 00:00:00 2001 From: kn Date: Mon, 22 Mar 2021 18:50:11 +0000 Subject: [PATCH] Properly reflect stopping state Diff from Preben Guldberg < preben at guldberg dot org>, thanks! In "vmctl status", VMs that are being stopped but are still running will simply show up as "running". Give preference to showing the "stopping" state akin to how a paused VM is handled. Tested by Dave Voutila OK tb --- usr.sbin/vmctl/vmctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/vmctl/vmctl.c b/usr.sbin/vmctl/vmctl.c index d8edbc062eb..8a8d153460b 100644 --- a/usr.sbin/vmctl/vmctl.c +++ b/usr.sbin/vmctl/vmctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmctl.c,v 1.76 2021/01/27 07:21:12 deraadt Exp $ */ +/* $OpenBSD: vmctl.c,v 1.77 2021/03/22 18:50:11 kn Exp $ */ /* * Copyright (c) 2014 Mike Larkin @@ -708,7 +708,7 @@ add_info(struct imsg *imsg, int *ret) * * Returns a string representing the current VM state, note that the order * matters. A paused VM does have the VM_STATE_RUNNING bit set, but - * VM_STATE_PAUSED is more significant to report. + * VM_STATE_PAUSED is more significant to report. Same goes for stopping VMs. * * Parameters * vm_state: mask indicating the vm state @@ -720,10 +720,10 @@ vm_state(unsigned int mask) return "paused"; else if (mask & VM_STATE_WAITING) return "waiting"; - else if (mask & VM_STATE_RUNNING) - return "running"; else if (mask & VM_STATE_SHUTDOWN) return "stopping"; + else if (mask & VM_STATE_RUNNING) + return "running"; /* Presence of absence of other flags */ else if (!mask || (mask & VM_STATE_DISABLED)) return "stopped"; -- 2.20.1