Commit Graph

27 Commits

Author SHA1 Message Date
Kyle Evans
9c65c7fb48 bectl(8): Only show mountpoint if the dataset is actually mounted
This is to accomodate a later change in libbe(3) that will always return the
mountpoint, whether it be the directory the dataset is actively mounted at
or the "mountpoint" property.
2018-08-07 03:01:04 +00:00
Kyle Evans
2a0b8dc2cb bectl(8): Provide -u option to unset jail parameters
All but name, host.hostname, and path may be completely unset.
2018-08-06 15:21:46 +00:00
Kyle Evans
526ad58e80 bectl(8): Split list functionality out into its own file as well 2018-08-06 03:41:52 +00:00
Kyle Evans
d694059f1e bectl(8): bectl jail improvements
- Support passing arbitrary jail arguments via -o
- Split the related (and rewritten since the GSoC) jail bits out into a new
  bectl_jail.c file, to reduce clutter in bectl.c
- Don't use RFC 1918 IP space [0]; we'll instead set no default IPv4 and let
  the user pass in any address options they wish via -o

Reported by:	rgrimes [0], Shawn Webb [0]
2018-08-06 03:32:25 +00:00
Kyle Evans
9a460e6fd2 bectl(8): Some light cleanup and commenting 2018-08-05 20:03:05 +00:00
Kyle Evans
96c5db5854 bectl(8): Implement bectl list -s
be_get_dataset_snapshots has been added to libbe(3), effectively returning
the same information as be_get_bootenv_props but for snapshots of the given
dataset. The assumption is that one will have the BE dataset name before
wanting to grab snapshots.
2018-08-05 19:38:56 +00:00
Kyle Evans
9b1662e67b bectl: Implement -D ("space if origin datasets were deleted")
This also accomplishes the following:

- Proxy through zfs_nicenum as be_nicenum, because it looks better than
  humanize_number and would presumably be useful to other libbe consumers.

- Rename be_get_snapshot_props to be_get_dataset_props, make it more useful
2018-08-05 04:40:13 +00:00
Kyle Evans
f97b318f7d bectl(8): Take -H parameter to list into account
-H is for a scripted format, where all fields are tab-delimited and the
headers go away. We accomplish this by splitting out pad printing to a
separate function that'll take into account whether we're supposed to be
scripted or not.

This has the nice side effect of maintaining positive column sizes again.
2018-08-05 04:16:00 +00:00
Kyle Evans
3443420646 bectl(8): Sort BEs lightly by active (now or later) BE, then others
While it could be preferred to do this at insert in libbe(3), there's no
convenient way to insert at the head of an nvlist. Instead, we'll make two
passes over- once to print anything active either now or at nextboot, and
another to print everything else.

This doesn't actually impact performance in a significant way here, so we'll
worry about further optimizations if the need actually arises.
2018-08-04 06:29:46 +00:00
Kyle Evans
77d5a868a0 bectl(8): Add some relevant bectl list -a information
bectl list -a should show the boot environment, its relevant dataset, and
the snapshot it was created from. The header also changes to indicate the
rough order in which these things will show.

While here, start doing a little bit of spring cleaning and splitting
different bits out.
2018-08-04 06:14:54 +00:00
Kyle Evans
4146029bb3 bectl(8): Take origin snapshot into account when calculating used space
This more closely matches the behavior for beadm. The associated libbe(3)
API is still getting worked out a little bit.
2018-08-03 02:04:57 +00:00
Kyle Evans
74c55b3d38 bectl(8): Just use a single pointer for all string props 2018-08-03 01:51:44 +00:00
Kyle Evans
970fd6543a bectl(8): Move dataset printing out into its own function
This may later get reused for printing snapshot and/or origin snapshot
information.
2018-08-03 01:46:46 +00:00
Kyle Evans
4503a8b6c7 bectl(8): Remove sneaky comment 2018-07-26 18:57:51 +00:00
Kyle Evans
83244ec1ec bectl(8): Hack together a more proper bectl list
Note that the space is currently just the 'used' property of the dataset.
2018-07-26 18:56:50 +00:00
Kyle Evans
2e355bd3ff bectl(8): Remove the jail mount point with unjail 2018-07-26 04:12:31 +00:00
Kyle Evans
a2d93d3c98 bectl(8): Redo jail using jail(3) API
The jail is created with allow.mount, allow.mount.devfs, and
enforce_statfs=1. Upon creation, we immediately attach, chdir to "/", and
drop the user into a shell inside the jail.

The default IP for this is arbitrarily 10.20.30.40.
2018-07-26 04:07:36 +00:00
Kyle Evans
ad765da4e8 bectl(8): Support unjailing a boot environment
The given parameter may either be a jid, jail name, or a BE name.  In all
cases, the parameter will be resolved to a jid and bectl(8) will
sanity-check that there's actually a BE mounted at the requested jail root
before invoking jail_remove(2).
2018-07-26 03:14:58 +00:00
Kyle Evans
734e362fa1 libbe(3)/bectl(8): Provide and use proper alloc/free for property lists 2018-07-25 16:00:48 +00:00
Kyle Evans
b29bf2f84e libbe(3)/be(8): Drop WARNS overrides, fix all fallout
Based on the idea that we shouldn't have all-new library and utility going
into base that need WARNS=1...

- Decent amount of constification
- Lots of parentheses
- Minor other nits
2018-07-25 15:14:35 +00:00
Kyle Evans
3682d5e902 bectl(8): Start dumping out BE information with bectl list
For the moment, this is a primitive nvlist dump of what we get back from
be_get_bootenv_props as a proof-of-concept and to make sure that we're
getting back the kind of information we want to see from list.
2018-07-25 14:30:47 +00:00
Kyle Evans
16a10da86c bectl(8): Consistent style 2018-07-25 04:06:09 +00:00
Kyle Evans
2c8489579a bectl(8): Rename error messages 2018-07-25 03:57:28 +00:00
Kyle Evans
9e004b219e bectl.c: Chase rename 2018-07-25 01:04:50 +00:00
Kyle Evans
268af06d3e Normalize bectl(8)/libbe(3) Makefiles, remove Makefile copyright/license
Approved by:	hselaskey
2018-07-24 19:55:02 +00:00
Kyle Evans
edbfe3bcb5 bectl(8): Chase rename in manpage 2018-07-24 13:24:30 +00:00
Kyle Evans
5952343e02 Rename be(1) to bectl(8); continues to live in /sbin
Discussed with:	rpokala, allanjude
2018-07-24 13:21:44 +00:00