> Date: Sun, 18 Sep 2022 19:08:46 +0000 > From: Klemens Nanni <k...@openbsd.org> > > The T4-2 firmware does NOT select newly downloaded configurations, so > I have to run > > # ldomctl download config-try-3-with-this-feature > [... wait... sometimes it hangs and needs ^C + rerun...] > # ldomctl select config-try-3-with-this-feature > > The following is much more convenient: > > # ldomctl download -s config-try-3-with-this-feature > > With firmware that does select automatically, this would just select > twice, which does no harm. > > Feedback? OK? (for after release)
I don't think this is worth the additional complexity. Less is more. > diff --git a/usr.sbin/ldomctl/ldomctl.8 b/usr.sbin/ldomctl/ldomctl.8 > index ec63fb157e5..3c20ad9009a 100644 > --- a/usr.sbin/ldomctl/ldomctl.8 > +++ b/usr.sbin/ldomctl/ldomctl.8 > @@ -56,7 +56,7 @@ Specify an escape character as per > .El > .It Cm delete Ar configuration > Delete the specified configuration from non-volatile storage. > -.It Cm download Ar directory > +.It Cm download Oo Fl s Oc Ar directory > Save a logical domain configuration to non-volatile storage on the > service processor. > The name of the configuration is taken from the name of the > @@ -69,6 +69,10 @@ Depending on the firmware, the new configuration must be > activated explicitly > using the > .Cm select > command. > +.Bl -tag -width 3n > +.It Fl s > +Explicitly select the new configuration. > +.El > .It Cm dump > Dump the current configuration from non-volatile storage into the current > working directory. > diff --git a/usr.sbin/ldomctl/ldomctl.c b/usr.sbin/ldomctl/ldomctl.c > index 906ab414488..05601e133ed 100644 > --- a/usr.sbin/ldomctl/ldomctl.c > +++ b/usr.sbin/ldomctl/ldomctl.c > @@ -126,7 +126,7 @@ __dead void > usage(void) > { > fprintf(stderr, "usage:\t%1$s delete|select configuration\n" > - "\t%1$s download directory\n" > + "\t%1$s download [-s] directory\n" > "\t%1$s dump|list|list-io\n" > "\t%1$s init-system [-n] file\n" > "\t%1$s create-vdisk -s size file\n" > @@ -389,8 +389,21 @@ void > download(int argc, char **argv) > { > struct ds_conn *dc; > + int ch, do_select = 0; > > - if (argc != 2) > + while ((ch = getopt(argc, argv, "s")) != -1) { > + switch (ch) { > + case 's': > + do_select = 1; > + break; > + default: > + usage(); > + } > + } > + argc -= optind; > + argv += optind; > + > + if (argc != 1) > usage(); > > hv_config(); > @@ -400,7 +413,9 @@ download(int argc, char **argv) > while (TAILQ_EMPTY(&mdstore_sets)) > ds_conn_handle(dc); > > - mdstore_download(dc, argv[1]); > + mdstore_download(dc, argv[0]); > + if (do_select) > + mdstore_select(dc, argv[0]); > } > > void > >