- Fix PoolImportSearch not listing pools that are not explicitly exported
This commit is contained in:
parent
f5a73ad14f
commit
b1b9ae5efc
10
zpool.c
10
zpool.c
|
@ -486,4 +486,14 @@ nvlist_ptr get_zpool_vdev_tree(nvlist_ptr nv) {
|
|||
return NULL;
|
||||
}
|
||||
return vdev_tree;
|
||||
}
|
||||
|
||||
|
||||
nvlist_ptr go_zpool_search_import(libzfs_handle_ptr zfsh, int paths, char **path, boolean_t do_scan) {
|
||||
importargs_t idata = { 0 };
|
||||
idata.path = path;
|
||||
idata.paths = paths;
|
||||
// idata.scan = 0;
|
||||
|
||||
return zpool_search_import(zfsh, &idata);
|
||||
}
|
5
zpool.go
5
zpool.go
|
@ -307,7 +307,7 @@ func PoolImportSearch(searchpaths []string) (epools []ExportedPool, err error) {
|
|||
C.strings_setat(cpaths, C.int(i), csPath)
|
||||
}
|
||||
|
||||
pools := C.zpool_find_import(C.libzfsHandle, C.int(numofp), cpaths)
|
||||
pools := C.go_zpool_search_import(C.libzfsHandle, C.int(numofp), cpaths, C.B_FALSE)
|
||||
defer C.nvlist_free(pools)
|
||||
elem = C.nvlist_next_nvpair(pools, elem)
|
||||
epools = make([]ExportedPool, 0, 1)
|
||||
|
@ -319,9 +319,6 @@ func PoolImportSearch(searchpaths []string) (epools []ExportedPool, err error) {
|
|||
}
|
||||
|
||||
ep.State = PoolState(C.get_zpool_state(config))
|
||||
if ep.State != PoolStateExported {
|
||||
continue
|
||||
}
|
||||
|
||||
if cname = C.get_zpool_name(config); cname == nil {
|
||||
err = fmt.Errorf("Failed to fetch %s", C.ZPOOL_CONFIG_POOL_NAME)
|
||||
|
|
2
zpool.h
2
zpool.h
|
@ -68,6 +68,8 @@ const char *get_zpool_comment(nvlist_ptr nv);
|
|||
|
||||
nvlist_ptr get_zpool_vdev_tree(nvlist_ptr nv);
|
||||
|
||||
nvlist_ptr go_zpool_search_import(libzfs_handle_ptr zfsh, int paths, char **path, boolean_t do_scan);
|
||||
|
||||
|
||||
extern char *sZPOOL_CONFIG_VERSION;
|
||||
extern char *sZPOOL_CONFIG_POOL_NAME;
|
||||
|
|
Loading…
Reference in New Issue