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.
*/
#include <assert.h>
#include <libintl.h>
#include <libnvpair.h>
--- 22,32 ----
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/*
! * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
#include <assert.h>
#include <libintl.h>
#include <libnvpair.h>
*** 186,196 ****
if (be_name != NULL)
cb.be_name = strdup(be_name);
if (be_defaults.be_deflt_rpool_container && rpool != NULL) {
if ((zphp = zpool_open(g_zfs, rpool)) == NULL) {
! be_print_err(gettext("be_get_node_data: failed to "
"open rpool (%s): %s\n"), rpool,
libzfs_error_description(g_zfs));
free(cb.be_name);
return (zfs_err_to_be_err(g_zfs));
}
--- 186,196 ----
if (be_name != NULL)
cb.be_name = strdup(be_name);
if (be_defaults.be_deflt_rpool_container && rpool != NULL) {
if ((zphp = zpool_open(g_zfs, rpool)) == NULL) {
! be_print_err(gettext("be_list: failed to "
"open rpool (%s): %s\n"), rpool,
libzfs_error_description(g_zfs));
free(cb.be_name);
return (zfs_err_to_be_err(g_zfs));
}
*** 822,832 ****
--- 822,834 ----
char *be_ds)
{
char prop_buf[MAXPATHLEN];
nvlist_t *userprops = NULL;
nvlist_t *propval = NULL;
+ nvlist_t *zone_propval = NULL;
char *prop_str = NULL;
+ char *zone_prop_str = NULL;
char *grub_default_bootfs = NULL;
zpool_handle_t *zphp = NULL;
int err = 0;
if (be_node == NULL || be_name == NULL || current_be == NULL ||
*** 863,893 ****
return (errno_to_be_err(err));
}
be_node->be_space_used = zfs_prop_get_int(zhp, ZFS_PROP_USED);
if ((zphp = zpool_open(g_zfs, rpool)) == NULL) {
! be_print_err(gettext("be_get_node_data: failed to open pool "
! "(%s): %s\n"), rpool, libzfs_error_description(g_zfs));
return (zfs_err_to_be_err(g_zfs));
}
! (void) zpool_get_prop(zphp, ZPOOL_PROP_BOOTFS, prop_buf, ZFS_MAXPROPLEN,
! NULL);
! if (be_has_grub() &&
! (be_default_grub_bootfs(rpool, &grub_default_bootfs)
! == BE_SUCCESS) && grub_default_bootfs != NULL)
if (strcmp(grub_default_bootfs, be_ds) == 0)
be_node->be_active_on_boot = B_TRUE;
else
be_node->be_active_on_boot = B_FALSE;
else if (prop_buf != NULL && strcmp(prop_buf, be_ds) == 0)
be_node->be_active_on_boot = B_TRUE;
else
be_node->be_active_on_boot = B_FALSE;
free(grub_default_bootfs);
zpool_close(zphp);
/*
* If the dataset is mounted use the mount point
* returned from the zfs_is_mounted call. If the
* dataset is not mounted then pull the mount
--- 865,906 ----
return (errno_to_be_err(err));
}
be_node->be_space_used = zfs_prop_get_int(zhp, ZFS_PROP_USED);
+ if (getzoneid() == GLOBAL_ZONEID) {
if ((zphp = zpool_open(g_zfs, rpool)) == NULL) {
! be_print_err(gettext("be_get_node_data: failed to open "
! "pool (%s): %s\n"), rpool,
! libzfs_error_description(g_zfs));
return (zfs_err_to_be_err(g_zfs));
}
! (void) zpool_get_prop(zphp, ZPOOL_PROP_BOOTFS, prop_buf,
! ZFS_MAXPROPLEN, NULL);
! if (be_has_grub() && (be_default_grub_bootfs(rpool,
! &grub_default_bootfs) == BE_SUCCESS) &&
! grub_default_bootfs != NULL)
if (strcmp(grub_default_bootfs, be_ds) == 0)
be_node->be_active_on_boot = B_TRUE;
else
be_node->be_active_on_boot = B_FALSE;
else if (prop_buf != NULL && strcmp(prop_buf, be_ds) == 0)
be_node->be_active_on_boot = B_TRUE;
else
be_node->be_active_on_boot = B_FALSE;
+
+ be_node->be_global_active = B_TRUE;
+
free(grub_default_bootfs);
zpool_close(zphp);
+ } else {
+ if (be_zone_compare_uuids(be_node->be_root_ds))
+ be_node->be_global_active = B_TRUE;
+ else
+ be_node->be_global_active = B_FALSE;
+ }
/*
* If the dataset is mounted use the mount point
* returned from the zfs_is_mounted call. If the
* dataset is not mounted then pull the mount
*** 908,917 ****
--- 921,946 ----
/* Get all user properties used for libbe */
if ((userprops = zfs_get_user_props(zhp)) == NULL) {
be_node->be_policy_type = strdup(be_default_policy());
} else {
+ if (getzoneid() != GLOBAL_ZONEID) {
+ if (nvlist_lookup_nvlist(userprops,
+ BE_ZONE_ACTIVE_PROPERTY, &zone_propval) != 0 ||
+ zone_propval == NULL) {
+ be_node->be_active_on_boot = B_FALSE;
+ } else {
+ verify(nvlist_lookup_string(zone_propval,
+ ZPROP_VALUE, &zone_prop_str) == 0);
+ if (strcmp(zone_prop_str, "on") == 0) {
+ be_node->be_active_on_boot = B_TRUE;
+ } else {
+ be_node->be_active_on_boot = B_FALSE;
+ }
+ }
+ }
+
if (nvlist_lookup_nvlist(userprops, BE_POLICY_PROPERTY,
&propval) != 0 || propval == NULL) {
be_node->be_policy_type =
strdup(be_default_policy());
} else {
*** 922,938 ****
be_node->be_policy_type =
strdup(be_default_policy());
else
be_node->be_policy_type = strdup(prop_str);
}
!
! if (nvlist_lookup_nvlist(userprops, BE_UUID_PROPERTY, &propval)
! == 0 && nvlist_lookup_string(propval, ZPROP_VALUE,
&prop_str) == 0) {
be_node->be_uuid_str = strdup(prop_str);
}
}
/*
* Increment the dataset counter to include the root dataset
* of the BE.
*/
--- 951,975 ----
be_node->be_policy_type =
strdup(be_default_policy());
else
be_node->be_policy_type = strdup(prop_str);
}
! if (getzoneid() != GLOBAL_ZONEID) {
! if (nvlist_lookup_nvlist(userprops,
! BE_ZONE_PARENTBE_PROPERTY, &propval) != 0 &&
! nvlist_lookup_string(propval, ZPROP_VALUE,
&prop_str) == 0) {
be_node->be_uuid_str = strdup(prop_str);
}
+ } else {
+ if (nvlist_lookup_nvlist(userprops, BE_UUID_PROPERTY,
+ &propval) == 0 && nvlist_lookup_string(propval,
+ ZPROP_VALUE, &prop_str) == 0) {
+ be_node->be_uuid_str = strdup(prop_str);
}
+ }
+ }
/*
* Increment the dataset counter to include the root dataset
* of the BE.
*/