Update spare and cache device names on import
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 19 Oct 2012 04:36:07 +0000 (21:36 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 22 Oct 2012 15:46:02 +0000 (08:46 -0700)
commit30b937ee15589126b4e4576d09d664b93897fc25
treed8b734e912373a7be5f6f9b131dbee004790ce47
parenteac4720465e54c86ae814667985c8a013ec45b85
Update spare and cache device names on import

During 'zpool import' all ZPOOL_CONFIG_PATH names are supposed
to be updated by fix_paths().  This was not happening for spare
and cache devices because the proper names were getting filtered
out of the pool_list_t->names.  Interestingly, the names were
being filtered because the spare and cache devices do not
contain the pool name in their vdev label.

The fix is to exclude the device path from the list only if:

  1) has a valid ZPOOL_CONFIG_POOL_NAME key in the label, and
  2) that pool name does not match the specified pool name.

Since the label is valid and because it does properly store the
vdev guid it will be correctly assembled without the pool name.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #725
lib/libzfs/libzfs_import.c