Project

General

Profile

Feature #6143

Want zoneadm list option for non-global zones only

Added by Eric Sproul almost 5 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
zones
Start date:
2015-08-20
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

I commonly find myself needing to loop over all non-global zones to perform some sort of operation, e.g.

for z in `zoneadm list | grep -v '^global$'`; do
  something
done

As a convenience, it might be nice to have a list option that would elide the global zone entry. It looks like '-n' is available and would make sense. It should also combine with the -c/-i options to filter on state, so:

zoneadm list -n -c

would list all non-global zones in the configured state. Likewise for '-n -i' to show non-global, installed zones.

History

#1

Updated by Ryan England over 1 year ago

  • Category set to zones
  • Status changed from New to In Progress
  • Assignee set to Ryan England
  • Tags deleted (needs-triage)
#2

Updated by Ryan England about 1 year ago

I've run the following tests to verify the code.

ryan@openindiana:/code/illumos-gate/proto/root_i386/usr/sbin$ ./zoneadm list -in
example

ryan@openindiana:/code/illumos-gate/proto/root_i386/usr/sbin$ ./zoneadm list -cn
example

ryan@openindiana:/code/illumos-gate/proto/root_i386/usr/sbin$ ./zoneadm list -zn
-zn: illegal option -- z
usage:  list [-cinpv]
        Lists the current zones, or a specific zone if indicated.  By default,
        all running zones are listed, though this can be expanded to all
        installed zones with the -i option or all configured zones with the
        -c option.  When used with the general -z <zone> and/or -u <uuid-match>
        options, lists only the specified matching zone, but lists it
        regardless of its state, and the -i, -c, and -n options are disallowed.  The
        -v option can be used to display verbose information: zone name, id,
        current state, root directory and options.  The -p option can be used
        to request machine-parsable output.  The -v and -p options are mutually
        exclusive.  If neither -v nor -p is used, just the zone name is listed.
#3

Updated by Ryan England about 1 year ago

One more example listed below.

ryan@openindiana:/code/illumos-gate$ proto/root_i386/usr/sbin/zoneadm -z example list -n
-n: illegal option -- n
usage:    list [-cinpv]
    Lists the current zones, or a specific zone if indicated.  By default,
    all running zones are listed, though this can be expanded to all
    installed zones with the -i option or all configured zones with the
    -c option.  When used with the general -z <zone> and/or -u <uuid-match>
    options, lists only the specified matching zone, but lists it
    regardless of its state, and the -i, -c, and -n options are disallowed.  The
    -v option can be used to display verbose information: zone name, id,
    current state, root directory and options.  The -p option can be used
    to request machine-parsable output.  The -v and -p options are mutually
    exclusive.  If neither -v nor -p is used, just the zone name is listed.
#4

Updated by Electric Monk about 1 year ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit 0222d5accac6e2a33600db46cd235825f511de93

commit  0222d5accac6e2a33600db46cd235825f511de93
Author: Ryan England <rcengland@gmail.com>
Date:   2019-06-04T20:46:34.000Z

    6143 Want zoneadm list option for non-global zones only
    Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
    Reviewed by: Joshua M. Clulow <josh@sysmgr.org>
    Approved by: Joshua M. Clulow <josh@sysmgr.org>

Also available in: Atom PDF