Add fetching of GUID in VDevTree
This commit is contained in:
parent
ee9aac43ac
commit
768fbf7f22
6
zpool.c
6
zpool.c
|
@ -378,6 +378,12 @@ const char *get_vdev_type(nvlist_ptr nv) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t get_vdev_guid(nvlist_ptr nv) {
|
||||||
|
uint64_t value = 0;
|
||||||
|
nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
const vdev_stat_ptr get_vdev_stats(nvlist_ptr nv) {
|
const vdev_stat_ptr get_vdev_stats(nvlist_ptr nv) {
|
||||||
vdev_stat_ptr vs = NULL;
|
vdev_stat_ptr vs = NULL;
|
||||||
uint_t count;
|
uint_t count;
|
||||||
|
|
3
zpool.go
3
zpool.go
|
@ -115,6 +115,7 @@ type VDevTree struct {
|
||||||
Spares []VDevTree
|
Spares []VDevTree
|
||||||
L2Cache []VDevTree
|
L2Cache []VDevTree
|
||||||
Logs *VDevTree
|
Logs *VDevTree
|
||||||
|
GUID uint64
|
||||||
Parity uint
|
Parity uint
|
||||||
Path string
|
Path string
|
||||||
Name string
|
Name string
|
||||||
|
@ -178,6 +179,8 @@ func poolGetConfig(name string, nv C.nvlist_ptr) (vdevs VDevTree, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vdevs.GUID = uint64(C.get_vdev_guid(nv))
|
||||||
|
|
||||||
// Fetch vdev state
|
// Fetch vdev state
|
||||||
if vs = C.get_vdev_stats(nv); vs == nil {
|
if vs = C.get_vdev_stats(nv); vs == nil {
|
||||||
err = fmt.Errorf("Failed to fetch %s", C.ZPOOL_CONFIG_VDEV_STATS)
|
err = fmt.Errorf("Failed to fetch %s", C.ZPOOL_CONFIG_VDEV_STATS)
|
||||||
|
|
1
zpool.h
1
zpool.h
|
@ -62,6 +62,7 @@ nvlist_t *nvlist_array_at(nvlist_t **a, uint_t i);
|
||||||
int refresh_stats(zpool_list_t *pool);
|
int refresh_stats(zpool_list_t *pool);
|
||||||
|
|
||||||
const char *get_vdev_type(nvlist_ptr nv);
|
const char *get_vdev_type(nvlist_ptr nv);
|
||||||
|
uint64_t get_vdev_guid(nvlist_ptr nv);
|
||||||
const vdev_stat_ptr get_vdev_stats(nvlist_ptr nv);
|
const vdev_stat_ptr get_vdev_stats(nvlist_ptr nv);
|
||||||
pool_scan_stat_ptr get_vdev_scan_stats(nvlist_t *nv);
|
pool_scan_stat_ptr get_vdev_scan_stats(nvlist_t *nv);
|
||||||
vdev_children_ptr get_vdev_children(nvlist_t *nv);
|
vdev_children_ptr get_vdev_children(nvlist_t *nv);
|
||||||
|
|
Loading…
Reference in New Issue