changeset 23894:9fc483dacaa9

13367 beadm activate -t should not promote new BE datasets Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Alexander Eremin <aeremin@tintri.com> Approved by: Dan McDonald <danmcd@joyent.com>
author Andy Fiddaman <omnios@citrus-it.co.uk>
date Tue, 15 Dec 2020 15:20:42 +0000
parents 49e0cb1642f6
children 8fc178e155c7
files usr/src/lib/libbe/common/be_activate.c
diffstat 1 files changed, 30 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libbe/common/be_activate.c	Tue Nov 17 10:47:03 2020 -0600
+++ b/usr/src/lib/libbe/common/be_activate.c	Tue Dec 15 15:20:42 2020 +0000
@@ -26,7 +26,7 @@
 /*
  * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  * Copyright 2016 Toomas Soome <tsoome@me.com>
- * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+ * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  */
 
 #include <assert.h>
@@ -333,36 +333,39 @@
 		}
 	}
 
-	if ((zhp = zfs_open(g_zfs, root_ds, ZFS_TYPE_FILESYSTEM)) != NULL) {
-		/*
-		 * We don't need to close the zfs handle at this
-		 * point because The callback funtion
-		 * be_promote_ds_callback() will close it for us.
-		 */
-		if (be_promote_ds_callback(zhp, NULL) != 0) {
-			be_print_err(gettext("be_activate: "
-			    "failed to activate the "
-			    "datasets for %s: %s\n"),
-			    root_ds,
+	if (nextboot == BE_NEXTBOOT_IGNORE) {
+		if ((zhp = zfs_open(g_zfs, root_ds, ZFS_TYPE_FILESYSTEM)) !=
+		    NULL) {
+			/*
+			 * We don't need to close the zfs handle at this
+			 * point because The callback funtion
+			 * be_promote_ds_callback() will close it for us.
+			 */
+			if (be_promote_ds_callback(zhp, NULL) != 0) {
+				be_print_err(gettext("be_activate: "
+				    "failed to activate the "
+				    "datasets for %s: %s\n"),
+				    root_ds,
+				    libzfs_error_description(g_zfs));
+				ret = BE_ERR_PROMOTE;
+				goto done;
+			}
+		} else {
+			be_print_err(gettext("be_activate: failed to open "
+			    "dataset (%s): %s\n"), root_ds,
 			    libzfs_error_description(g_zfs));
-			ret = BE_ERR_PROMOTE;
+			ret = zfs_err_to_be_err(g_zfs);
 			goto done;
 		}
-	} else {
-		be_print_err(gettext("be_activate: failed to open "
-		    "dataset (%s): %s\n"), root_ds,
-		    libzfs_error_description(g_zfs));
-		ret = zfs_err_to_be_err(g_zfs);
-		goto done;
-	}
 
-	if (getzoneid() == GLOBAL_ZONEID &&
-	    be_get_uuid(cb.obe_root_ds, &uu) == BE_SUCCESS &&
-	    (ret = be_promote_zone_ds(cb.obe_name, cb.obe_root_ds))
-	    != BE_SUCCESS) {
-		be_print_err(gettext("be_activate: failed to promote "
-		    "the active zonepath datasets for zones in BE %s\n"),
-		    cb.obe_name);
+		if (getzoneid() == GLOBAL_ZONEID &&
+		    be_get_uuid(cb.obe_root_ds, &uu) == BE_SUCCESS &&
+		    (ret = be_promote_zone_ds(cb.obe_name, cb.obe_root_ds))
+		    != BE_SUCCESS) {
+			be_print_err(gettext("be_activate: failed to promote "
+			    "the active zonepath datasets for zones in BE "
+			    "%s\n"), cb.obe_name);
+		}
 	}
 
 	if (getzoneid() != GLOBAL_ZONEID) {