Preben Guldberg writes:
> In "vmctl status", VMs that are being stopped but are still running > will simply show up as "running". > > The diff below gives preference to showing the stopping state akin to > how a paused VM is handled. I've tested this and it works as advertised. I guess I had been living in ignorance not knowing I should be seeing a "stopping" status! > > Index: usr.sbin/vmctl/vmctl.c > =================================================================== > RCS file: /cvs/src/usr.sbin/vmctl/vmctl.c,v > retrieving revision 1.76 > diff -u -p -u -p -r1.76 vmctl.c > --- usr.sbin/vmctl/vmctl.c 27 Jan 2021 07:21:12 -0000 1.76 > +++ usr.sbin/vmctl/vmctl.c 7 Mar 2021 15:39:03 -0000 > @@ -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";
