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 <behlendorf1@llnl.gov>
Closes #1077
This commit is contained in:
Brian Behlendorf 2012-11-06 11:33:24 -08:00
parent 004324ecc6
commit c372b36e3e

View File

@ -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);