This commit is contained in:
Rich Ercolani 2024-09-11 14:20:06 -04:00 committed by GitHub
commit 1c3deeadec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 3 deletions

View File

@ -7953,8 +7953,11 @@ zpool_do_online(int argc, char **argv)
poolname = argv[0]; poolname = argv[0];
if ((zhp = zpool_open(g_zfs, poolname)) == NULL) if ((zhp = zpool_open(g_zfs, poolname)) == NULL) {
(void) fprintf(stderr, gettext("failed to open pool "
"\"%s\""), poolname);
return (1); return (1);
}
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
vdev_state_t oldstate; vdev_state_t oldstate;
@ -7975,12 +7978,15 @@ zpool_do_online(int argc, char **argv)
&l2cache, NULL); &l2cache, NULL);
if (tgt == NULL) { if (tgt == NULL) {
ret = 1; ret = 1;
(void) fprintf(stderr, gettext("couldn't find device "
"\"%s\" in pool \"%s\"\n"), argv[i], poolname);
continue; continue;
} }
uint_t vsc; uint_t vsc;
oldstate = ((vdev_stat_t *)fnvlist_lookup_uint64_array(tgt, oldstate = ((vdev_stat_t *)fnvlist_lookup_uint64_array(tgt,
ZPOOL_CONFIG_VDEV_STATS, &vsc))->vs_state; ZPOOL_CONFIG_VDEV_STATS, &vsc))->vs_state;
if (zpool_vdev_online(zhp, argv[i], flags, &newstate) == 0) { if ((rc = zpool_vdev_online(zhp, argv[i], flags,
&newstate)) == 0) {
if (newstate != VDEV_STATE_HEALTHY) { if (newstate != VDEV_STATE_HEALTHY) {
(void) printf(gettext("warning: device '%s' " (void) printf(gettext("warning: device '%s' "
"onlined, but remains in faulted state\n"), "onlined, but remains in faulted state\n"),
@ -8006,6 +8012,9 @@ zpool_do_online(int argc, char **argv)
} }
} }
} else { } else {
(void) fprintf(stderr, gettext("Failed to online "
"\"%s\" in pool \"%s\": %d\n"),
argv[i], poolname, rc);
ret = 1; ret = 1;
} }
} }
@ -8090,8 +8099,11 @@ zpool_do_offline(int argc, char **argv)
poolname = argv[0]; poolname = argv[0];
if ((zhp = zpool_open(g_zfs, poolname)) == NULL) if ((zhp = zpool_open(g_zfs, poolname)) == NULL) {
(void) fprintf(stderr, gettext("failed to open pool "
"\"%s\""), poolname);
return (1); return (1);
}
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
uint64_t guid = zpool_vdev_path_to_guid(zhp, argv[i]); uint64_t guid = zpool_vdev_path_to_guid(zhp, argv[i]);