diff options
-rw-r--r-- | usr.sbin/ldomctl/config.c | 6 | ||||
-rw-r--r-- | usr.sbin/ldomctl/ldomctl.8 | 11 | ||||
-rw-r--r-- | usr.sbin/ldomctl/ldomctl.c | 25 | ||||
-rw-r--r-- | usr.sbin/ldomctl/ldomctl.h | 4 |
4 files changed, 34 insertions, 12 deletions
diff --git a/usr.sbin/ldomctl/config.c b/usr.sbin/ldomctl/config.c index 952d34b8791..e70ccb2b4cf 100644 --- a/usr.sbin/ldomctl/config.c +++ b/usr.sbin/ldomctl/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.29 2019/11/28 18:40:42 kn Exp $ */ +/* $OpenBSD: config.c,v 1.30 2020/01/04 15:45:46 kn Exp $ */ /* * Copyright (c) 2012, 2018 Mark Kettenis @@ -2759,7 +2759,7 @@ primary_init(void) } void -build_config(const char *filename) +build_config(const char *filename, int noaction) { struct guest *primary; struct guest *guest; @@ -2781,6 +2781,8 @@ build_config(const char *filename) SIMPLEQ_INIT(&conf.domain_list); if (parse_config(filename, &conf) < 0) exit(1); + if (noaction) + exit(0); pri = md_read("pri"); if (pri == NULL) diff --git a/usr.sbin/ldomctl/ldomctl.8 b/usr.sbin/ldomctl/ldomctl.8 index 400a46c5cf7..84195d1fc0e 100644 --- a/usr.sbin/ldomctl/ldomctl.8 +++ b/usr.sbin/ldomctl/ldomctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ldomctl.8,v 1.21 2019/12/30 20:10:48 kn Exp $ +.\" $OpenBSD: ldomctl.8,v 1.22 2020/01/04 15:45:46 kn Exp $ .\" .\" Copyright (c) 2012 Mark Kettenis <kettenis@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: December 30 2019 $ +.Dd $Mdocdate: January 4 2020 $ .Dt LDOMCTL 8 sparc64 .Os .Sh NAME @@ -63,12 +63,17 @@ The download is aborted if a configuration with the same name already exists. .It Cm dump Dump the current configuration from non-volatile storage into the current working directory. -.It Cm init-system Ar file +.It Cm init-system Oo Fl n Oc Ar file Generate files in the current working directory for a logical domain configuration .Ar file as described in .Xr ldom.conf 5 . +.Bl -tag -width Fl +.It Fl n +Configtest mode. +Only check the configuration file for validity. +.El .It Cm list List configurations stored in non-volatile storage. Indicate the currently running configuration, diff --git a/usr.sbin/ldomctl/ldomctl.c b/usr.sbin/ldomctl/ldomctl.c index 17c0ecff9dc..e0944809330 100644 --- a/usr.sbin/ldomctl/ldomctl.c +++ b/usr.sbin/ldomctl/ldomctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldomctl.c,v 1.32 2020/01/03 19:45:51 kn Exp $ */ +/* $OpenBSD: ldomctl.c,v 1.33 2020/01/04 15:45:46 kn Exp $ */ /* * Copyright (c) 2012 Mark Kettenis @@ -129,7 +129,7 @@ usage(void) fprintf(stderr, "usage:\t%1$s delete|select configuration\n" "\t%1$s download directory\n" "\t%1$s dump|list|list-io\n" - "\t%1$s init-system file\n" + "\t%1$s init-system [-n] file\n" "\t%1$s create-vdisk -s size file\n" "\t%1$s console|panic|start|status|stop [domain]\n", getprogname()); exit(EXIT_FAILURE); @@ -241,12 +241,27 @@ dump(int argc, char **argv) void init_system(int argc, char **argv) { - if (argc != 2) + int ch, noaction = 0; + + while ((ch = getopt(argc, argv, "n")) != -1) { + switch (ch) { + case 'n': + noaction = 1; + break; + default: + usage(); + } + } + argc -= optind; + argv += optind; + + if (argc != 1) usage(); - hv_config(); + if (!noaction) + hv_config(); - build_config(argv[1]); + build_config(argv[0], noaction); } void diff --git a/usr.sbin/ldomctl/ldomctl.h b/usr.sbin/ldomctl/ldomctl.h index 5ccfcd11ce1..c5e8be6721f 100644 --- a/usr.sbin/ldomctl/ldomctl.h +++ b/usr.sbin/ldomctl/ldomctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ldomctl.h,v 1.11 2019/11/28 18:03:33 kn Exp $ */ +/* $OpenBSD: ldomctl.h,v 1.12 2020/01/04 15:45:46 kn Exp $ */ /* * Copyright (c) 2012 Mark Kettenis @@ -193,5 +193,5 @@ struct ldom_config { }; int parse_config(const char *, struct ldom_config *); -void build_config(const char *); +void build_config(const char *, int); void list_components(void); |