364385 |
19-Aug-2020 |
0mp |
MFC 364294, 364295:
- Remove an unnecessary macro
- Comment out TODO notes from bectl(8) manual page |
357667 |
07-Feb-2020 |
kevans |
MFC r357067: Drop "All Rights Reserved" from all libbe/bectl files |
356593 |
10-Jan-2020 |
kevans |
MFC r356279: libbe(3): promote dependent clones when destroying a BE
When removing a boot environment iterate over the dependents and process the snapshots by grabbing any clones. Promote the clones we found and then remove the target environment.
This fixes the ability to destroy a boot environment when it has been used to spawn one or more other boot environments.
PR: 242592 |
353784 |
20-Oct-2019 |
kevans |
MFC r353644, r353646, r353663: bectl(8) origin auto-destroy
r353644: libbe(3): add needed bits for be_destroy to auto-destroy some origins
New BEs can be created from either an existing snapshot or an existing BE. If an existing BE is chosen (either implicitly via 'bectl create' or explicitly via 'bectl create -e foo bar', for instance), then bectl will create a snapshot of the current BE or "foo" with be_snapshot, with a name formatted like: strftime("%F-%T") and a serial added to it.
This commit adds the needed bits for libbe or consumers to determine if a snapshot names matches one of these auto-created snapshots (with some light validation of the date/time/serial), and also a be_destroy flag to specify that the origin should be automatically destroyed if possible.
A future commit to bectl will specify BE_DESTROY_AUTOORIGIN by default so we clean up the origin in the most common case, non-user-managed snapshots.
r353646: bectl(8): destroy: use BE_DESTROY_AUTOORIGIN if -o is not specified
-o will force the origin to be destroyed unconditionally. BE_DESTROY_AUTOORIGIN, on the other hand, will only destroy the origin if it matches the format used by be_snapshot. This lets us clean up the snapshots that are clearly not user-managed (because we're creating them) while leaving user-created snapshots in place and warning that they're still around when the BE created goes away.
r353663: libbe(3): Fix destroy of imported BE w/ AUTOORIGIN
Imported BE, much like the activated BE, will not have an origin that we can fetch/examine for destruction. be_destroy should not return BE_ERR_NOORIGIN for failure to get the origin property for BE_DESTROY_AUTOORIGIN, because we don't really know going into it that there's even an origin to be destroyed.
BE_DESTROY_NEEDORIGIN has been renamed to BE_DESTROY_WANTORIGIN because only a subset of it *needs* the origin, so 'need' is too strong of verbiage.
This was caught by jenkins and the bectl tests, but kevans failed to run the bectl tests prior to commit. |
352348 |
15-Sep-2019 |
kevans |
MFC r352211: bectl(8): Add a "check" command
This command simply returns 0 at the moment and explicitly takes no arguments. This should be used by utilities wanting to see if bectl can operate on the system they're running, or with a specific root (`bectl -r`). It may grow more checks than "will libbe successfully init" in the future, but for now this is enough as that checks for the dataset mounted at "/" and that it looks capable of being a BE root (e.g. it's not a top-level dataset)
bectl commands can now specify if they want to be silent, and this will turn off libbe_print_on_error so they can control the output as needed. This is already used in `bectl check`, and may be turned on in the future for some other commands where libbe errors are better suppressed as the failure mode may be obvious. |
352345 |
15-Sep-2019 |
kevans |
MFC r352092: bectl(8): initialize reverse earlier
This turns into a warning in GCC 4.2 that 'reverse' may be used uninitialized in this function. While I don't immediately see where it's deciding this from (there's only two paths that make column != NULL, and they both set reverse), initializing reverse earlier is good for clarity. |
352088 |
09-Sep-2019 |
kevans |
MFC r351813: bectl(8): implement sorting for 'bectl list' output
Allow 'bectl list' to sort output by a given property name. The property name is passed in using a command-line flag, '-c' for ascending order and '-C' for descending order. The properties allowed to sort by are:
- name (the default output, even if '-c' or '-C' are not used) - creation - origin - used - usedds - usedsnap - usedrefreserv
The default output for 'bectl list' is now ascending alphabetical order of BE name.
To sort by creation time from earliest to latest, the command would be 'bectl list -c creation' |
350344 |
26-Jul-2019 |
kevans |
MFC r349380, r349383, r349455: bectl(8)/libbe(3) fixes
r349380: libbe(3): mount: the BE dataset is mounted at /
Other parts of libbe(3) were fairly strict on the mountpoint property of the BE dataset, and be_mount was not much better. It was improved in r347027 to allow mountpoint=none for depth==0, but this bit was still sensitive to mountpoint != / and mountpoint != none. Given that other parts of libbe(3) no longer restrict the mountpoint property here, and the rest of the base system is generally OK and will assume that a BE is mounted at /, let's do the same.
r349383: libbe(3): restructure be_mount, skip canmount check for BE dataset
Further cleanup after r349380; loader and kernel will both ignore canmount on the root dataset as well, so we should not be so strict about it when mounting it. be_mount is restructured to make it more clear that depth==0 is special, and to not try fetching these properties that we won't care about.
r349455: bectl(8): create non-recursive boot environments
bectl advertises that it has the ability to create recursive and non-recursive boot environments. This patch implements that functionality using the be_create_depth API provided by libbe. With this patch, bectl now works as bectl(8) describes in regards to creating recursive/non-recursive boot environments. |
350340 |
26-Jul-2019 |
kevans |
MFC r348328: bectl(8): Address Coverity complaints
CID 1400451: case 0 is missing a break/return and falling through to the default case. waitpid(0, ...) makes little sense in the child, we likely wanted to terminate immediately.
CID 1400453: size argument uses sizeof(char **) instead of sizeof(char *) and is assigned to a char **; sizeof's match but "this isn't a portable assumption".
CID: 1400451, 1400453 |
350339 |
26-Jul-2019 |
kevans |
Partial revert r350338: stable/11 part
The stand/libsa changes were not supposed to ride along with this revision; backing out the stable/11 part and re-applying the MFC.
Pointy hat: kevans |
350338 |
26-Jul-2019 |
kevans |
MFC r348328: bectl(8): Address Coverity complaints
CID 1400451: case 0 is missing a break/return and falling through to the default case. waitpid(0, ...) makes little sense in the child, we likely wanted to terminate immediately.
CID 1400453: size argument uses sizeof(char **) instead of sizeof(char *) and is assigned to a char **; sizeof's match but "this isn't a portable assumption".
CID: 1400451, 1400453 |
348863 |
10-Jun-2019 |
kevans |
MFC r348510: bectl(8): Don't accept jid=0 from jail_getid
This will trivially exist, but we don't want it - none of our jailed BEs will have jid=0.
Approved by: re (gjb) |
348305 |
27-May-2019 |
kevans |
MFC r348127: bectl(8): add description for create subcommand
In commit r345845, a portion of documentation for the create subcommand was removed. Specifically, for creating a snapshot of an existing boot environment. bectl even has a test-case for this functionality.
Removing the sub-command description was discussed in PR 235850.
This patch brings back the second "create" description that was originally in place. Albeit, with a few wording/clarifying changes.
Approved by: re (marius) |
348304 |
27-May-2019 |
kevans |
MFC r348215, r348219: fix bectl(8) jail w/ numeric BE names
r348215: jail_getid(3): validate jid string input
Currently, if jail_getid(3) is passed in a numeric string, it assumes that this is a jid string and passes it back converted to an int without checking that it's a valid/existing jid. This breaks consumers that might use jail_getid(3) to see if it can trivially grab a jid from a name if that name happens to be numeric but not actually the name/jid of the jail. Instead of returning -1 for the jail not existing, it'll return the int version of the input and the consumer will not fallback to trying other methods.
Pass the numeric input to jail_get(2) as the jid for validation, rather than the name. This works well- the kernel enforces that jid=name if name is numeric, so doing the safe thing and checking numeric input as a jid will still DTRT based on the description of jail_getid.
r348219: bectl(8): Add a test for jail/unjail of numeric BE names
Fixed by r348215, bectl ujail first attempts the trivial fetch of a jid by passing the first argument to 'ujail' to jail_getid(3) in case a jid/name have been passed in instead of a BE name. For numerically named BEs, this was doing the wrong thing: instead of failing to locate the jid specified and falling back to mountpath search, jail_getid(3) would return the input as-is.
While here, I've fixed bectl_jail_cleanup which still used a hard-coded pool name that was overlooked w.r.t. other work that was in-flight around the same time.
Approved by: re (marius) |
346429 |
20-Apr-2019 |
kevans |
MFC bectl(8)/libbe(3): r337663-337664,337667,337697-337699,337800,337805, 337915-337918,337921,337924,337947,337993-337995,338221-338222,338303, 338417,339047,339972,339994,340334,340507-340508,340592-340594, 340635-340636,340722-340723,340974,342466,342849,342903,342911,343335, 343543,343977,343993-343994,344034,344067,344084,345302,345769, 345845-345846,345848,346082
There are simply too many small changes to enumerate; in summary:
bectl(8)/libbe(3) has been introduced from current state in -CURRENT and added to the stable/11 rescue build. bectl(8) is a tool for managing ZFS boot environments, largely inspired by beadm. It includes features such as being able to jail a boot environment or easily mount it for modification.
Relnotes: probably |
337663 |
11-Aug-2018 |
kevans |
Merge libbe(3)/bectl(8) from projects/bectl into head
bectl(8) is an administrative interface for working with ZFS boot environments, intended to provide a superset of the functionality provided by sysutils/beadm.
libbe(3) is the back-end library that the required functionality has been pulled out into for later reuse.
These were originally written for GSoC 2017 under the mentorship of allanjude@.
bectl(8) has proven pretty stable in my testing, with the known bug documented in the man page.
Relnotes: yes
|
337662 |
11-Aug-2018 |
kevans |
libbe(3)/bectl(8): More SYSROOT/GCC build fixes
- Missing include path - Fully specify libzfs's dependencies (except for deps pulled in by other deps) in Makefile.inc1 - Drop WARNS back down to 2 for libbe(3). I do this with much hesitation, but the libzfs headers are apparently a hot warning-filled mess as far as GCC 4.2 is concerned.
|
337657 |
11-Aug-2018 |
kevans |
bectl(8): Add missing include path
|
337606 |
11-Aug-2018 |
kevans |
bectl(8): Also document the import bug.
|
337603 |
11-Aug-2018 |
kevans |
bectl(8): Swap the order of ujail/umount documentation...
"Despite my inconsistency, consistency is king." -Anonymous
|
337602 |
11-Aug-2018 |
kevans |
bectl(8): Document export/import
|
337598 |
11-Aug-2018 |
kevans |
libbe(3)/bectl(8): Make igor and mandoc -Tlint a little happier
|
337596 |
11-Aug-2018 |
kevans |
libbe(3)/bectl(8): Kill off the 'add' functionality for now
The mostly-undocumented 'add' functionality, from initial read-through, is intended for construction of deep ("bdrewery style") boot environments. However, it's mostly broken at this point. `#if SOON` it out on both sides so that we're not exposing a broken API/feature.
Work will resume on it in due time.
|
337416 |
07-Aug-2018 |
kevans |
libbe(3)/bectl(8): Standardize $FreeBSD$ IDs
|
337414 |
07-Aug-2018 |
kevans |
libbe(3)/bectl(8): Standardize copyright headers
- File names don't necessarily need to be repeated - Add SPDX tags - Add a missing copyright for Kyle Kneitinger in bectl.8, originally written by him in GSoC 2017; his standard copyright notice has been copied from other files within the same directory to remain consistent with how he clearly wished to portray it
|
337406 |
07-Aug-2018 |
kevans |
libbe(3): Check that dataset is to be mounted at / for be_exists
This makes the be_exists behavior match the comments that assert that we've already checked that the dataset derived from the BE name is set to mount at /.
Other changes of note: - bectl_list sees another change; changing mountpoint based on mount status turns out to be a bad idea, so instead make the mounted property of the returned nvlist the path that it's mounted at
- Always return the "mountpoint" property in "mountpoint" if it's ste
|
337405 |
07-Aug-2018 |
kevans |
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.
|
337380 |
06-Aug-2018 |
kevans |
bectl(8): Provide -u option to unset jail parameters
All but name, host.hostname, and path may be completely unset.
|
337369 |
06-Aug-2018 |
kevans |
bectl(8): Split list functionality out into its own file as well
|
337368 |
06-Aug-2018 |
kevans |
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]
|
337359 |
05-Aug-2018 |
kevans |
bectl(8): Some light cleanup and commenting
|
337358 |
05-Aug-2018 |
kevans |
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.
|
337343 |
05-Aug-2018 |
kevans |
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
|
337341 |
05-Aug-2018 |
kevans |
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.
|
337284 |
04-Aug-2018 |
kevans |
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.
|
337283 |
04-Aug-2018 |
kevans |
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.
|
337228 |
03-Aug-2018 |
kevans |
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.
|
337226 |
03-Aug-2018 |
kevans |
bectl(8): Just use a single pointer for all string props
|
337225 |
03-Aug-2018 |
kevans |
bectl(8): Move dataset printing out into its own function
This may later get reused for printing snapshot and/or origin snapshot information.
|
336748 |
26-Jul-2018 |
kevans |
bectl(8): Remove sneaky comment
|
336747 |
26-Jul-2018 |
kevans |
bectl(8): Hack together a more proper `bectl list`
Note that the space is currently just the 'used' property of the dataset.
|
336732 |
26-Jul-2018 |
kevans |
bectl(8): Remove the jail mount point with unjail
|
336731 |
26-Jul-2018 |
kevans |
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.
|
336730 |
26-Jul-2018 |
kevans |
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).
|
336715 |
25-Jul-2018 |
kevans |
libbe(3)/bectl(8): Provide and use proper alloc/free for property lists
|
336710 |
25-Jul-2018 |
kevans |
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
|
336708 |
25-Jul-2018 |
kevans |
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.
|
336703 |
25-Jul-2018 |
kevans |
bectl(8): Consistent style
|
336702 |
25-Jul-2018 |
kevans |
bectl(8): Rename error messages
|
336694 |
25-Jul-2018 |
kevans |
bectl.c: Chase rename
|
336684 |
24-Jul-2018 |
kevans |
Normalize bectl(8)/libbe(3) Makefiles, remove Makefile copyright/license
Approved by: hselaskey
|
336670 |
24-Jul-2018 |
kevans |
bectl(8): Chase rename in manpage
|
336669 |
24-Jul-2018 |
kevans |
Rename be(1) to bectl(8); continues to live in /sbin
Discussed with: rpokala, allanjude
|
336668 |
24-Jul-2018 |
kevans |
Import libbe(3)/be(1) from socsvn/soc2017/kneitinger/libbe-head
|