diff options
author | Brian Behlendorf <[email protected]> | 2012-11-06 11:33:24 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2012-11-30 13:45:14 -0800 |
commit | c372b36e3eba18d1a8747b8375e3e7c049d40c89 (patch) | |
tree | 0d7a366b72826f73293fa72c0d930d53669b5ed4 /lib/libzfs/libzfs_pool.c | |
parent | 004324ecc646ae909e721dc9eda8b1f57e9db71b (diff) |
Allow GPT+EFI vdevs for root pools
Commit 57a4edd allows the bootfs property to be set on any pool.
However, many of the zpool commands still prevent you from using
EFI labeled devices for the root pool. For example:
# zpool attach rpool /dev/sda /dev/sdb
cannot label 'sdb': EFI labeled devices are not supported on
root pools. on root devices.
For non-Solaris builds such as Linux disable this error.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #1077
Diffstat (limited to 'lib/libzfs/libzfs_pool.c')
-rw-r--r-- | lib/libzfs/libzfs_pool.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 75e883e4f..e2a67c6a7 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -341,6 +341,7 @@ bootfs_name_valid(const char *pool, char *bootfs) return (B_FALSE); } +#if defined(__sun__) || defined(__sun) /* * Inspect the configuration to determine if any of the devices contain * an EFI label. @@ -361,6 +362,7 @@ pool_uses_efi(nvlist_t *config) } return (B_FALSE); } +#endif boolean_t zpool_is_bootable(zpool_handle_t *zhp) @@ -1128,6 +1130,7 @@ zpool_add(zpool_handle_t *zhp, nvlist_t *nvroot) return (zfs_error(hdl, EZFS_BADVERSION, msg)); } +#if defined(__sun__) || defined(__sun) if (zpool_is_bootable(zhp) && nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_SPARES, &spares, &nspares) == 0) { uint64_t s; @@ -1146,6 +1149,7 @@ zpool_add(zpool_handle_t *zhp, nvlist_t *nvroot) } } } +#endif if (zpool_get_prop_int(zhp, ZPOOL_PROP_VERSION, NULL) < SPA_VERSION_L2CACHE && @@ -2059,6 +2063,7 @@ zpool_get_config_physpath(nvlist_t *config, char *physpath, size_t phypath_size) &child, &count) != 0) return (EZFS_INVALCONFIG); +#if defined(__sun__) || defined(__sun) /* * root pool can not have EFI labeled disks and can only have * a single top-level vdev. @@ -2066,6 +2071,7 @@ zpool_get_config_physpath(nvlist_t *config, char *physpath, size_t phypath_size) if (strcmp(type, VDEV_TYPE_ROOT) != 0 || count != 1 || pool_uses_efi(vdev_root)) return (EZFS_POOL_INVALARG); +#endif (void) vdev_get_physpaths(child[0], physpath, phypath_size, &rsz, B_FALSE); @@ -2372,6 +2378,7 @@ zpool_vdev_attach(zpool_handle_t *zhp, (void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN, "cannot attach %s to %s"), new_disk, old_disk); +#if defined(__sun__) || defined(__sun) /* * If this is a root pool, make sure that we're not attaching an * EFI labeled device. @@ -2381,6 +2388,7 @@ zpool_vdev_attach(zpool_handle_t *zhp, "EFI labeled devices are not supported on root pools.")); return (zfs_error(hdl, EZFS_POOL_NOTSUP, msg)); } +#endif (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); if ((tgt = zpool_find_vdev(zhp, old_disk, &avail_spare, &l2cache, @@ -3807,12 +3815,14 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, char *name) if (zhp) { nvlist_t *nvroot; +#if defined(__sun__) || defined(__sun) if (zpool_is_bootable(zhp)) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "EFI labeled devices are not supported on root " "pools.")); return (zfs_error(hdl, EZFS_POOL_NOTSUP, errbuf)); } +#endif verify(nvlist_lookup_nvlist(zhp->zpool_config, ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); |