Print this page
*** NO COMMENTS ***

*** 22,32 **** /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. */ /* ! * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ /* * System includes */ --- 22,32 ---- /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. */ /* ! * Copyright 2013 Nexenta Systems, Inc. All rights reserved. */ /* * System includes */
*** 321,330 **** --- 321,339 ---- /* Generate string for BE's root dataset */ be_make_root_ds(bt.obe_zpool, bt.obe_name, obe_root_ds, sizeof (obe_root_ds)); bt.obe_root_ds = obe_root_ds; + if (getzoneid() != GLOBAL_ZONEID) { + if (!be_zone_compare_uuids(bt.obe_root_ds)) { + be_print_err(gettext("be_rollback: rolling back zone " + "root dataset from non-active global BE is not " + "supported\n")); + return (BE_ERR_NOTSUP); + } + } + /* Get handle to BE's root dataset */ if ((zhp = zfs_open(g_zfs, bt.obe_root_ds, ZFS_TYPE_DATASET)) == NULL) { be_print_err(gettext("be_rollback: " "failed to open BE root dataset (%s): %s\n"), bt.obe_root_ds, libzfs_error_description(g_zfs));
*** 427,436 **** --- 436,455 ---- be_make_root_ds(bt.obe_zpool, bt.obe_name, root_ds, sizeof (root_ds)); bt.obe_root_ds = root_ds; + if (getzoneid() != GLOBAL_ZONEID) { + if (!be_zone_compare_uuids(bt.obe_root_ds)) { + be_print_err(gettext("be_create_snapshot: creating " + "snapshot for the zone root dataset from " + "non-active global BE is not " + "supported\n")); + return (BE_ERR_NOTSUP); + } + } + /* If BE policy not specified, use the default policy */ if (bt.policy == NULL) { bt.policy = be_default_policy(); } else { /* Validate policy type */
*** 480,511 **** /* * If ZFS pool version supports snapshot user properties, store * cleanup policy there. Otherwise don't set one - this snapshot * will always inherit the cleanup policy from its parent. */ if (pool_version >= SPA_VERSION_SNAP_PROPS) { if (nvlist_alloc(&ss_props, NV_UNIQUE_NAME, 0) != 0) { ! be_print_err(gettext("be_create_snapshot: internal " ! "error: out of memory\n")); return (BE_ERR_NOMEM); } ! if (nvlist_add_string(ss_props, BE_POLICY_PROPERTY, bt.policy) ! != 0) { ! be_print_err(gettext("be_create_snapshot: internal " ! "error: out of memory\n")); nvlist_free(ss_props); return (BE_ERR_NOMEM); } } else if (policy != NULL) { /* * If an explicit cleanup policy was requested * by the caller and we don't support it, error out. */ be_print_err(gettext("be_create_snapshot: cannot set " ! "cleanup policy: ZFS pool version is %d\n"), pool_version); return (BE_ERR_NOTSUP); } /* Create the snapshots recursively */ if (zfs_snapshot(g_zfs, ss, B_TRUE, ss_props) != 0) { if (!autoname || libzfs_errno(g_zfs) != EZFS_EXISTS) { be_print_err(gettext("be_create_snapshot: " --- 499,533 ---- /* * If ZFS pool version supports snapshot user properties, store * cleanup policy there. Otherwise don't set one - this snapshot * will always inherit the cleanup policy from its parent. */ + if (getzoneid() == GLOBAL_ZONEID) { if (pool_version >= SPA_VERSION_SNAP_PROPS) { if (nvlist_alloc(&ss_props, NV_UNIQUE_NAME, 0) != 0) { ! be_print_err(gettext("be_create_snapshot: " ! "internal error: out of memory\n")); return (BE_ERR_NOMEM); } ! if (nvlist_add_string(ss_props, BE_POLICY_PROPERTY, ! bt.policy) != 0) { ! be_print_err(gettext("be_create_snapshot: " ! "internal error: out of memory\n")); nvlist_free(ss_props); return (BE_ERR_NOMEM); } } else if (policy != NULL) { /* * If an explicit cleanup policy was requested * by the caller and we don't support it, error out. */ be_print_err(gettext("be_create_snapshot: cannot set " ! "cleanup policy: ZFS pool version is %d\n"), ! pool_version); return (BE_ERR_NOTSUP); } + } /* Create the snapshots recursively */ if (zfs_snapshot(g_zfs, ss, B_TRUE, ss_props) != 0) { if (!autoname || libzfs_errno(g_zfs) != EZFS_EXISTS) { be_print_err(gettext("be_create_snapshot: "