Prevent zpool upgrade failing due to unavailable pools

Prior to this fix "zpool upgrade" and "zpool upgrade -a" would fail due to
an assert when operating on unavailable pools.

We now print a warning to stderr but allow the processing of other pools
to procesed.

MFC after:	1 month
This commit is contained in:
Steven Hartland 2014-12-25 02:17:17 +00:00
parent 52f1bb38c2
commit fce5da5f71
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=276194

View File

@ -4629,6 +4629,13 @@ upgrade_cb(zpool_handle_t *zhp, void *arg)
boolean_t printnl = B_FALSE;
int ret;
if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) {
(void) fprintf(stderr, gettext("cannot upgrade '%s': pool is "
"currently unavailable\n\n"), zpool_get_name(zhp));
/* Allow iteration to continue. */
return (0);
}
config = zpool_get_config(zhp, NULL);
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION,
&version) == 0);
@ -4729,6 +4736,14 @@ upgrade_list_disabled_cb(zpool_handle_t *zhp, void *arg)
nvlist_t *config;
uint64_t version;
if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) {
(void) fprintf(stderr, gettext("cannot check supported "
"features on '%s': pool is currently unavailable\n\n"),
zpool_get_name(zhp));
/* Allow iteration to continue. */
return (0);
}
config = zpool_get_config(zhp, NULL);
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION,
&version) == 0);