MFV r268454:

Refresh zpool list for each interval in order to produce fresh
output.

Illumos issue: 4966 zpool list iterator does not update output

MFC after:	 2 weeks
This commit is contained in:
Xin LI 2014-07-09 21:07:20 +00:00
commit b1396c9f98
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=268470

View File

@ -3076,17 +3076,10 @@ zpool_do_list(int argc, char **argv)
if (zprop_get_list(g_zfs, props, &cb.cb_proplist, ZFS_TYPE_POOL) != 0)
usage(B_FALSE);
if ((list = pool_list_get(argc, argv, &cb.cb_proplist, &ret)) == NULL)
return (1);
if (argc == 0 && !cb.cb_scripted && pool_list_count(list) == 0) {
(void) printf(gettext("no pools available\n"));
zprop_free_list(cb.cb_proplist);
return (0);
}
for (;;) {
pool_list_update(list);
if ((list = pool_list_get(argc, argv, &cb.cb_proplist,
&ret)) == NULL)
return (1);
if (pool_list_count(list) == 0)
break;
@ -3109,9 +3102,16 @@ zpool_do_list(int argc, char **argv)
if (count != 0 && --count == 0)
break;
pool_list_free(list);
(void) sleep(interval);
}
if (argc == 0 && !cb.cb_scripted && pool_list_count(list) == 0) {
(void) printf(gettext("no pools available\n"));
ret = 0;
}
pool_list_free(list);
zprop_free_list(cb.cb_proplist);
return (ret);
}