Re: ldomctl: Omit tty device from status output

2020-01-03 Thread Klemens Nanni
On Fri, Jan 03, 2020 at 08:58:16PM +, Stuart Henderson wrote:
> On 2019/12/30 01:13, Klemens Nanni wrote:
> > Now that `ldomctl console ...' is implemented there is actually no need
> > to print the device any longer, it is an implementation detail that
> > should be hidden just like it is the case with vmctl.
> 
> But vmctl does show the device ..?
Sloppiness on my side, sorry.

kettenis presented his use case and you proved my argument for
consistency to be invalid, so I have no plans for dropping the TTY
column any longer.

Thanks everyone :-)



Re: ldomctl: Omit tty device from status output

2020-01-03 Thread Stuart Henderson
On 2019/12/30 01:13, Klemens Nanni wrote:
> Now that `ldomctl console ...' is implemented there is actually no need
> to print the device any longer, it is an implementation detail that
> should be hidden just like it is the case with vmctl.

But vmctl does show the device ..?

$ vmctl start open
vmctl: started vm 1 successfully, tty /dev/ttyp9

$ vmctl stat
   ID   PID VCPUS  MAXMEM  CURMEM TTYOWNERSTATE NAME
1 77553 11.0G1.1M   ttyp9sthen  running open
2 - 11.0G   -   -sthen  stopped cd



Re: ldomctl: Omit tty device from status output

2020-01-03 Thread Klemens Nanni
On Fri, Jan 03, 2020 at 09:11:01PM +0100, Mark Kettenis wrote:
> The way I see it, "ldomctl console" is just there for compatibility
> with vmctl.  We don't really need it for sparc64 as the random
> allocation of ttys that vmm(4) suffers from doesn't happen (and there
> are interesting user permission issues that we discussed a few weeks
> ago).
I added it to be able to address guests by their names which I know
instead of their serial devices which I have to derive from the overall
config.

Compatibility with vmctl is certainly nice but of less importance.

> I continue to use "cu -l ttyV2" as I'm used to it (and it takes less
> typing).  But occasionally I need to refresh my memory about the tty
> assigned to my domains.
Fair enough, if that's still helpful in your use case I'll just leave it
there.



Re: ldomctl: Omit tty device from status output

2020-01-03 Thread Mark Kettenis
> Date: Fri, 3 Jan 2020 20:18:46 +0100
> From: Klemens Nanni 
> 
> On Fri, Jan 03, 2020 at 08:04:10PM +0100, Mark Kettenis wrote:
> > No.  If you messed this up in a previous commit, please fix it some
> > other way.
> The purpose of this diff is not to fix previously messed up spacing but
> to omit information that I consider redundant by now since the `console'
> available.
> 
> At e2k19 I added printing the vcctty first, then the console command
> followed.  In hindsight, printing it could have been skipped right away,
> but well... didn't occur to me earlier.
> 
> vmctl does not print the device either, I just don't see a reason to do
> it in ldomctl anymore.

The way I see it, "ldomctl console" is just there for compatibility
with vmctl.  We don't really need it for sparc64 as the random
allocation of ttys that vmm(4) suffers from doesn't happen (and there
are interesting user permission issues that we discussed a few weeks
ago).

I continue to use "cu -l ttyV2" as I'm used to it (and it takes less
typing).  But occasionally I need to refresh my memory about the tty
assigned to my domains.



Re: ldomctl: Omit tty device from status output

2020-01-03 Thread Klemens Nanni
On Fri, Jan 03, 2020 at 08:04:10PM +0100, Mark Kettenis wrote:
> No.  If you messed this up in a previous commit, please fix it some
> other way.
The purpose of this diff is not to fix previously messed up spacing but
to omit information that I consider redundant by now since the `console'
available.

At e2k19 I added printing the vcctty first, then the console command
followed.  In hindsight, printing it could have been skipped right away,
but well... didn't occur to me earlier.

vmctl does not print the device either, I just don't see a reason to do
it in ldomctl anymore.



Re: ldomctl: Omit tty device from status output

2020-01-03 Thread Mark Kettenis
> Date: Mon, 30 Dec 2019 01:13:56 +0100
> From: Klemens Nanni 
> 
> Now that `ldomctl console ...' is implemented there is actually no need
> to print the device any longer, it is an implementation detail that
> should be hidden just like it is the case with vmctl.
> 
> That also makes it fit nicely on serial consoles again.
> 
>   $ doas ldomctl status primary
>   primary  -running  OpenBSD running  
>   1%
>   $ jot -s '' -b . 72
>   
>   $ doas obj/ldomctl status primary
>   primary  running  OpenBSD running0%
> 
> OK?

No.  If you messed this up in a previous commit, please fix it some
other way.

> Index: ldomctl.8
> ===
> RCS file: /cvs/src/usr.sbin/ldomctl/ldomctl.8,v
> retrieving revision 1.20
> diff -u -p -r1.20 ldomctl.8
> --- ldomctl.8 6 Dec 2019 23:01:03 -   1.20
> +++ ldomctl.8 30 Dec 2019 00:13:06 -
> @@ -162,9 +162,9 @@ The primary domain should have less CPUs
>  are now assigned to the guest domains:
>  .Bd -literal -offset indent
>  # ldomctl status
> -primary - running OpenBSD running1%
> -puffy   ttyV0 running OpenBoot Primary Boot Loader   8%
> -salmah  ttyV1 running OpenBoot Primary Boot Loader  12%
> +primary  running  OpenBSD running1%
> +puffyrunning  OpenBoot Primary Boot Loader   8%
> +salmah   running  OpenBoot Primary Boot Loader  12%
>  .Ed
>  .Pp
>  Configure the
> Index: ldomctl.c
> ===
> RCS file: /cvs/src/usr.sbin/ldomctl/ldomctl.c,v
> retrieving revision 1.31
> diff -u -p -r1.31 ldomctl.c
> --- ldomctl.c 28 Dec 2019 18:36:02 -  1.31
> +++ ldomctl.c 30 Dec 2019 00:12:02 -
> @@ -509,7 +509,6 @@ guest_status(int argc, char **argv)
>   double utilisation = 0.0;
>   const char *state_str;
>   char buf[32];
> - char console_str[8] = "-";
>  
>   if (argc < 1 || argc > 2)
>   usage();
> @@ -610,14 +609,8 @@ guest_status(int argc, char **argv)
>   break;
>   }
>  
> - /* primary has no console */
> - if (guest->gid != 0) {
> - snprintf(console_str, sizeof(console_str),
> - "ttyV%llu", guest->gid - 1);
> - }
> -
> - printf("%-16s %-8s %-16s %-32s %3.0f%%\n", guest->name,
> - console_str, state_str, state.state == GUEST_STATE_NORMAL ?
> + printf("%-16s %-16s %-32s %3.0f%%\n", guest->name,
> + state_str, state.state == GUEST_STATE_NORMAL ?
>   softstate.soft_state_str : "-", utilisation);
>   }
>  }
> 
>