`ldomctl start|stop primary" silently exits zero not doing anything,
`ldomctl panic primary" makes primary panic (and pulls guests down with
it).
The manual explicitly documents those commands for "guest" domains,
code comments say so as well, so lets behave accordingly and prevent
stupid admins like me from testing `ldomctl panic primary' on their
machine before looking at the code.
Feedback on better error message wording?
OK?
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 -0000 1.31
+++ ldomctl.c 30 Dec 2019 21:10:39 -0000
@@ -426,6 +426,9 @@ guest_start(int argc, char **argv)
if (argc != 2)
usage();
+ if (strcmp(argv[1], "primary") == 0)
+ errx(1, "cannot start primary domain");
+
/*
* Start guest domain.
*/
@@ -452,6 +455,9 @@ guest_stop(int argc, char **argv)
if (argc != 2)
usage();
+ if (strcmp(argv[1], "primary") == 0)
+ errx(1, "cannot stop primary domain");
+
/*
* Stop guest domain.
*/
@@ -477,6 +483,9 @@ guest_panic(int argc, char **argv)
if (argc != 2)
usage();
+
+ if (strcmp(argv[1], "primary") == 0)
+ errx(1, "cannot panic primary domain");
/*
* Stop guest domain.