func (h *Hypervisor) GetActiveStoragePools() ([]string, error) { number := C.virConnectNumOfStoragePools(h.cptr) if number == -1 { return nil, GetLastError() } names := make([]string, number) if number == 0 { return names, nil } cnames := make([]*C.char, number) result := C.virConnectListStoragePools(h.cptr, &cnames[0], number) if result == -1 { return nil, GetLastError() } for i, v := range cnames { names[i] = C.GoString(v) defer C.free(unsafe.Pointer(v)) } return names, nil }
func (h *Hypervisor) GetNumberOfActiveStoragePools() (int, error) { number := C.virConnectNumOfStoragePools(h.cptr) if number == -1 { return 0, GetLastError() } return int(number), nil }