summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Rosenfeld <hans.rosenfeld@nexenta.com>2015-10-28 14:47:13 +0100
committerHans Rosenfeld <hans.rosenfeld@nexenta.com>2015-11-06 17:30:19 +0100
commit08e9b2df0318952b8677b4feb62b4ec784f28101 (patch)
tree60130e4b928236301e1e81319d7c99164029a652
parente4adc82d6b02a6aa5d1b1d9772653c82c16e28ad (diff)
downloadillumos-gate-08e9b2df0318952b8677b4feb62b4ec784f28101.tar.gz
6408 libbe shouldn't run installgrub on offline/unavail/faulted vdevs
Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com> Approved by: Dan McDonald <danmcd@omniti.com>
-rw-r--r--usr/src/lib/libbe/common/be_activate.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/usr/src/lib/libbe/common/be_activate.c b/usr/src/lib/libbe/common/be_activate.c
index feb6fc46b5..cdc37d6f22 100644
--- a/usr/src/lib/libbe/common/be_activate.c
+++ b/usr/src/lib/libbe/common/be_activate.c
@@ -881,6 +881,8 @@ be_do_installboot_helper(zpool_handle_t *zphp, nvlist_t *child, char *stage1,
char *path, *dsk_ptr;
char *flag = "";
int ret;
+ vdev_stat_t *vs;
+ uint_t vsc;
if (nvlist_lookup_string(child, ZPOOL_CONFIG_PATH, &path) != 0) {
be_print_err(gettext("be_do_installboot: "
@@ -888,6 +890,20 @@ be_do_installboot_helper(zpool_handle_t *zphp, nvlist_t *child, char *stage1,
return (BE_ERR_NODEV);
}
+ if ((nvlist_lookup_uint64_array(child, ZPOOL_CONFIG_VDEV_STATS,
+ (uint64_t **)&vs, &vsc) != 0) ||
+ vs->vs_state < VDEV_STATE_DEGRADED) {
+ /*
+ * Don't try to run installgrub on a vdev that is not ONLINE
+ * or DEGRADED. Try to print a warning for each such vdev.
+ */
+ be_print_err(gettext("be_do_installboot: "
+ "vdev %s is %s, can't install boot loader\n"),
+ path, zpool_state_to_name(vs->vs_state, vs->vs_aux));
+ free(path);
+ return (BE_SUCCESS);
+ }
+
/*
* Modify the vdev path to point to the raw disk.
*/