Actions
Feature #6143
closedWant zoneadm list option for non-global zones only
Start date:
2015-08-20
Due date:
% Done:
100%
Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:
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.
Updated by Ryan England almost 4 years ago
- Category set to zones
- Status changed from New to In Progress
- Assignee set to Ryan England
- Tags deleted (
needs-triage)
Updated by Ryan England over 3 years 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.
Updated by Ryan England over 3 years 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.
Updated by Electric Monk over 3 years 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>
Actions