- Fix bug not fetching disk path in pool configuration when disk is unavailable (plugged off)

This commit is contained in:
Faruk Kasumovic 2017-04-25 13:24:34 +02:00
parent 89e00d6218
commit fa91900915
1 changed files with 2 additions and 2 deletions

View File

@ -210,13 +210,13 @@ func poolGetConfig(name string, nv C.nvlist_ptr) (vdevs VDevTree, err error) {
// Fetch the children // Fetch the children
if C.nvlist_lookup_nvlist_array(nv, C.sZPOOL_CONFIG_CHILDREN, if C.nvlist_lookup_nvlist_array(nv, C.sZPOOL_CONFIG_CHILDREN,
unsafe.Pointer(&child), &children) != 0 { unsafe.Pointer(&child), &children) != 0 {
return children = 0
} }
if children > 0 { if children > 0 {
vdevs.Devices = make([]VDevTree, 0, children) vdevs.Devices = make([]VDevTree, 0, children)
} }
if C.nvlist_lookup_uint64(nv, C.sZPOOL_CONFIG_NOT_PRESENT, if C.nvlist_lookup_uint64(nv, C.sZPOOL_CONFIG_NOT_PRESENT,
&notpresent) == 0 { &notpresent) == 0 || notpresent != 0 {
var path C.char_ptr var path C.char_ptr
if 0 != C.nvlist_lookup_string(nv, C.sZPOOL_CONFIG_PATH, unsafe.Pointer(&path)) { if 0 != C.nvlist_lookup_string(nv, C.sZPOOL_CONFIG_PATH, unsafe.Pointer(&path)) {
err = fmt.Errorf("Failed to fetch %s", C.ZPOOL_CONFIG_PATH) err = fmt.Errorf("Failed to fetch %s", C.ZPOOL_CONFIG_PATH)