Hey Darren,

Are you interested in drafting an arc fasttrack for these interface additions?
Do you see zoneadm being used as:

        # zoneadm boot myzone -s

That would be:
        - myzone is an operand to zoneadm that comes after the subcommand.

This is not compliant with getopt or clip guidelines.  You may
want to review the info here:

http://opensolaris.org/os/community/arc/caselog/2006/062/spec-clip-html/

I think the usability issue is with the zoneadm syntax:

        # command -opt optarg subcommand ...

The above clip guidlines make this comment:

Q: I'd like to have options before my subcommands. This makes sense because
   some options apply to all operations.

    A: This often makes sense from an engineering perspective, but our
    usability data says most users don't understand the system model well
    enough to be able to predict whether the option should go before or after   
    the subcommand.

>From this you could argue that the current zoneadm command is getopt, but not
fully clip compliant.

I think that you are proposing that the zonename could also take a special
operand to the zoneadm command, which comes after the subcommand.

The "good" commands that you are comparing zoneadm to were nice enough to not
have any options/optargs before the subcommand.

You might try running a fastrack, arguing that the syntax:

        # zoneadm boot myzone -m milestone=single-user
being:
        # command subcommand operand suboptions suboperands

while conforming to no standards/guidelines, is more usable than:

        # command option optarg subcommand suboptions suboperand.

I think this could be defined as:

        if -z is not present, a subcommand is present, and the token after
        the subcommand is not an option, then it is the operand to an
        implicit -z.

This is of course not compliant with anything.  You could argue that this
is more usable anyway, or you could find a compliant solution.

-Steve L.

On Sun, Jun 15, 2008 at 06:15:46PM -0700, Darren Reed wrote:
> Tony Ambrozie wrote:
> 
> > Your code changes for both zoneadm and zonecfg would preserve the 
> > current zonexxx -z zonename for backwards compatibility purposes, is 
> > that correct?
> 
> 
> Correct.  There are some command line options that the changes I've
> made don't support, such as using -R.  That's quite deliberate.
> 
> The aim of the changes was to address the common use cases of the
> commands and make their use more intuitive when viewed with the
> other commands in OpenSolaris.
> 
> Darren
> 
> >
> > Thank you,
> >
> >
> > On Mon, Jun 9, 2008 at 11:51 AM, Darren Reed <[EMAIL PROTECTED] 
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> >     Someone mentioned zonecfg was the cause of some similar awkwardness...
> >
> >     So here's a patch attached for that.
> >
> >     Darren
> >
> >
> >
> >     ------- usr/src/cmd/zonecfg/zonecfg.c -------
> >
> >     Index: usr/src/cmd/zonecfg/zonecfg.c
> >     *** /biscuit/onnv/usr/src/cmd/zonecfg/zonecfg.c Mon Mar 24
> >     17:30:38 2008
> >     --- /biscuit/onnv_20080608/usr/src/cmd/zonecfg/zonecfg.c      
> >      Mon Jun  9 11:47:41 2008
> >     ***************
> >     *** 1071,1076 ****
> >     --- 1071,1077 ----
> >                        execname, cmd_to_str(CMD_HELP));
> >                    (void) fprintf(fp, "\t%s -z <zone>\t\t\t(%s)\n",
> >                        execname, gettext("interactive"));
> >     +               (void) fprintf(fp, "\t%s <command> <zone>\n",
> >     execname);
> >                    (void) fprintf(fp, "\t%s -z <zone> <command>\n",
> >     execname);
> >                    (void) fprintf(fp, "\t%s -z <zone> -f
> >     <command-file>\n",
> >                        execname);
> >     ***************
> >     *** 6653,6689 ****
> >            return (execbasename);
> >      }
> >
> >     ! int
> >     ! main(int argc, char *argv[])
> >      {
> >     !       int err, arg;
> >     !       struct stat st;
> >     !
> >     !       /* This must be before anything goes to stdout. */
> >     !       setbuf(stdout, NULL);
> >     !
> >     !       saw_error = B_FALSE;
> >     !       cmd_file_mode = B_FALSE;
> >     !       execname = get_execbasename(argv[0]);
> >     !
> >     !       (void) setlocale(LC_ALL, "");
> >     !       (void) textdomain(TEXT_DOMAIN);
> >     !
> >     !       if (getzoneid() != GLOBAL_ZONEID) {
> >     !               zerr(gettext("%s can only be run from the global
> >     zone."),
> >     !                   execname);
> >     !               exit(Z_ERR);
> >     !       }
> >     !
> >     !       if (argc < 2) {
> >     !               usage(B_FALSE, HELP_USAGE | HELP_SUBCMDS);
> >                    exit(Z_USAGE);
> >            }
> >     !       if (strcmp(argv[1], cmd_to_str(CMD_HELP)) == 0) {
> >     !               (void) one_command_at_a_time(argc - 1, &(argv[1]));
> >     !               exit(Z_OK);
> >     !       }
> >
> >            while ((arg = getopt(argc, argv, "?f:R:z:")) != EOF) {
> >                    switch (arg) {
> >                    case '?':
> >     --- 6654,6679 ----
> >            return (execbasename);
> >      }
> >
> >     ! static void
> >     ! set_zonename(char *zonename)
> >      {
> >     !       if (strcmp(zonename, GLOBAL_ZONENAME) == 0) {
> >     !               global_zone = B_TRUE;
> >     !       } else if (zonecfg_validate_zonename(zonename) != Z_OK) {
> >     !               zone_perror(zonename, Z_BOGUS_ZONE_NAME, B_TRUE);
> >     !               usage(B_FALSE, HELP_SYNTAX);
> >                    exit(Z_USAGE);
> >            }
> >     !       (void) strlcpy(zone, zonename, sizeof (zone));
> >     !       (void) strlcpy(revert_zone, zonename, sizeof (zone));
> >     ! }
> >
> >     + static void
> >     + get_clioptions(int argc, char *argv[])
> >     + {
> >     +       struct stat st;
> >     +       int arg;
> >     +
> >            while ((arg = getopt(argc, argv, "?f:R:z:")) != EOF) {
> >                    switch (arg) {
> >                    case '?':
> >     ***************
> >     *** 6712,6726 ****
> >                            zonecfg_set_root(optarg);
> >                            break;
> >                    case 'z':
> >     !                       if (strcmp(optarg, GLOBAL_ZONENAME) == 0) {
> >     !                               global_zone = B_TRUE;
> >     !                       } else if
> >     (zonecfg_validate_zonename(optarg) != Z_OK) {
> >     !                               zone_perror(optarg,
> >     Z_BOGUS_ZONE_NAME, B_TRUE);
> >     !                               usage(B_FALSE, HELP_SYNTAX);
> >     !                               exit(Z_USAGE);
> >     !                       }
> >     !                       (void) strlcpy(zone, optarg, sizeof (zone));
> >     !                       (void) strlcpy(revert_zone, optarg, sizeof
> >     (zone));
> >                            break;
> >                    default:
> >                            usage(B_FALSE, HELP_USAGE);
> >     --- 6702,6708 ----
> >                            zonecfg_set_root(optarg);
> >                            break;
> >                    case 'z':
> >     !                       set_zonename(optarg);
> >                            break;
> >                    default:
> >                            usage(B_FALSE, HELP_USAGE);
> >     ***************
> >     *** 6727,6733 ****
> >     --- 6709,6761 ----
> >                            exit(Z_USAGE);
> >                    }
> >            }
> >     + }
> >
> >     + int
> >     + main(int argc, char *argv[])
> >     + {
> >     +       int err;
> >     +
> >     +       /* This must be before anything goes to stdout. */
> >     +       setbuf(stdout, NULL);
> >     +
> >     +       saw_error = B_FALSE;
> >     +       cmd_file_mode = B_FALSE;
> >     +       execname = get_execbasename(argv[0]);
> >     +
> >     +       (void) setlocale(LC_ALL, "");
> >     +       (void) textdomain(TEXT_DOMAIN);
> >     +
> >     +       if (getzoneid() != GLOBAL_ZONEID) {
> >     +               zerr(gettext("%s can only be run from the global
> >     zone."),
> >     +                   execname);
> >     +               exit(Z_ERR);
> >     +       }
> >     +
> >     +       if (argc < 2) {
> >     +               usage(B_FALSE, HELP_USAGE | HELP_SUBCMDS);
> >     +               exit(Z_USAGE);
> >     +       }
> >     +       if (strcmp(argv[1], cmd_to_str(CMD_HELP)) == 0) {
> >     +               (void) one_command_at_a_time(argc - 1, &(argv[1]));
> >     +               exit(Z_OK);
> >     +       }
> >     +
> >     +       if (argc >= 3 && *argv[1] != '-' && *argv[2] != '-') {
> >     +               /*
> >     +                * We're assuming that the command line has been
> >     written
> >     +                * as "zonecfg subcmd zonename" but the parser for
> >     the CLI
> >     +                * assumes "zonecfg -z zone subcmd".  If we move the
> >     +                * subcommand and adjust optind, we can fake
> >     having parsed
> >     +                * the "-z zonename"...
> >     +                */
> >     +               set_zonename(argv[2]);
> >     +               argv[2] = argv[1];
> >     +               optind++;
> >     +       } else {
> >     +               get_clioptions(argc, argv);
> >     +       }
> >     +
> >            if (optind > argc || strcmp(zone, "") == 0) {
> >                    usage(B_FALSE, HELP_USAGE);
> >                    exit(Z_USAGE);
> >
> >     _______________________________________________
> >     zones-discuss mailing list
> >     zones-discuss@opensolaris.org <mailto:zones-discuss@opensolaris.org>
> >
> >
> 
> _______________________________________________
> zones-discuss mailing list
> zones-discuss@opensolaris.org
_______________________________________________
zones-discuss mailing list
zones-discuss@opensolaris.org

Reply via email to