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.
This commit is contained in:
parent
bc37ac7ea8
commit
8338f584dc
@ -376,6 +376,7 @@ bectl_cmd_destroy(int argc, char *argv[])
|
||||
|
||||
/* We'll emit a notice if there's an origin to be cleaned up */
|
||||
if ((flags & BE_DESTROY_ORIGIN) == 0 && strchr(target, '@') == NULL) {
|
||||
flags |= BE_DESTROY_AUTOORIGIN;
|
||||
if (be_root_concat(be, target, targetds) != 0)
|
||||
goto destroy;
|
||||
if (be_prop_list_alloc(&props) != 0)
|
||||
@ -384,7 +385,8 @@ bectl_cmd_destroy(int argc, char *argv[])
|
||||
be_prop_list_free(props);
|
||||
goto destroy;
|
||||
}
|
||||
if (nvlist_lookup_string(props, "origin", &origin) == 0)
|
||||
if (nvlist_lookup_string(props, "origin", &origin) == 0 &&
|
||||
!be_is_auto_snapshot_name(be, origin))
|
||||
fprintf(stderr, "bectl destroy: leaving origin '%s' intact\n",
|
||||
origin);
|
||||
be_prop_list_free(props);
|
||||
|
Loading…
x
Reference in New Issue
Block a user