mirror_zfs/lib
Brian Behlendorf 6466b61db6 Make zpool import -d|-c behave consistently
When importing pools with zpool import -aN there is inconsistent
behavior between '-d /dev/disk/by-id' (or another path) and
'-c /etc/zfs/zpool.cache'.

The difference in behavior is caused by zpool_find_import_cached()
returning an empty nvlist_t when there are no pools to import but
zpool_find_import_impl() returns NULL for the same situation. The
behavior of zpool_find_import_cached() is arguably more correct
because it allows returning NULL to be used for an error case and
not an empty set.

This change resolves the issue by updating get_configs() such that
it returns an empty set instead of NULL when no config is found.
The updated behavior will now always return 0 for this case.

$ zpool import -aN; echo $?
no pools available to import
0

$ zpool import -aN -d /var/tmp/; echo $?
no pools available to import
0

$ zpool import -aN -c /etc/zfs/zpool.cache; echo $?
no pools available to import
0

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2080
2015-01-28 11:12:31 -08:00
..
libavl Remove autotools products 2012-08-27 11:47:44 -07:00
libefi 2493 change efi_rescan() to wait longer 2014-08-26 16:12:37 -07:00
libnvpair Illumos #2619 and #2747 2013-01-08 10:35:35 -08:00
libshare Remove unconditional sharetab update 2014-01-07 09:48:09 -08:00
libspl Swap DTRACE_PROBE* with Linux tracepoints 2014-11-17 11:13:55 -08:00
libunicode Remove autotools products 2012-08-27 11:47:44 -07:00
libuutil Remove autotools products 2012-08-27 11:47:44 -07:00
libzfs Make zpool import -d|-c behave consistently 2015-01-28 11:12:31 -08:00
libzfs_core Illumos 4757, 4913 2014-08-01 14:28:05 -07:00
libzpool Mark IO pipeline with PF_FSTRANS 2015-01-16 14:28:05 -08:00
Makefile.am Illumos #2882, #2883, #2900 2013-09-04 15:49:00 -07:00