On Fri, Apr 21, 2023 at 11:29:11PM +0000, Koakuma wrote:
> I noticed that when using `ldomctl status` the utilization value of
> stopped ldoms is always a copy of the previous entry's value,
> which is probably incorrect?
> 
> Zeroing utilization value in `ldomctl status` at the start of the loop
> makes it so that stopped ldoms' utilization appear as a zero, which
> I believe is a more appropriate value in this context.
> 
> Before:
> primary          -        running          OpenBSD running                   
> 11%
> gentoo           ttyV0    running          Linux running                      
> 0%
> openbsd          ttyV1    running          OpenBSD running                    
> 5%
> solaris          ttyV2    stopped          -                                  
> 5%
> 
> After:
> primary          -        running          OpenBSD running                    
> 1%
> gentoo           ttyV0    running          Linux running                      
> 0%
> openbsd          ttyV1    running          OpenBSD running                    
> 8%
> solaris          ttyV2    stopped          -                                  
> 0%
> 
> Any comments?

That explains why I saw >0% after i stopped a guest that caused problems...
thought it was a bug nastier than this, but didn't look and forgot.

Makes sense, I'll test in a few days and come back.

> 
> diff --git usr.sbin/ldomctl/ldomctl.c usr.sbin/ldomctl/ldomctl.c
> index e48a560f7db..3a1b47cc1dc 100644
> --- usr.sbin/ldomctl/ldomctl.c
> +++ usr.sbin/ldomctl/ldomctl.c
> @@ -574,6 +574,8 @@ guest_status(int argc, char **argv)
>                 if (gid != -1 && guest->gid != gid)
>                         continue;
>  
> +               utilisation = 0.0;
> +
>                 /*
>                  * Request status.
>                  */
> @@ -644,8 +646,6 @@ guest_status(int argc, char **argv)
>                         if (yielded_cycles <= total_cycles)
>                                 utilisation = (100.0 * (total_cycles
>                                     - yielded_cycles)) / total_cycles;
> -                       else
> -                               utilisation = 0.0;
>  
>                         break;
>                 case GUEST_STATE_SUSPENDED:
> 

Reply via email to