Date: Wed, 16 Oct 2019 14:55:56 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353646 - head/sbin/bectl Message-ID: <201910161455.x9GEtuR6081270@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Wed Oct 16 14:55:56 2019 New Revision: 353646 URL: https://svnweb.freebsd.org/changeset/base/353646 Log: 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. Modified: head/sbin/bectl/bectl.c Modified: head/sbin/bectl/bectl.c ============================================================================== --- head/sbin/bectl/bectl.c Wed Oct 16 14:46:04 2019 (r353645) +++ head/sbin/bectl/bectl.c Wed Oct 16 14:55:56 2019 (r353646) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910161455.x9GEtuR6081270>