Version: v1.0.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 26 Imported by: 8


Client API

The client API is the interface between client and server gRPC applications and provides capabilities to manage storage and network hardware local to the storage nodes in addition to DAOS pools and services.



(C) Copyright 2020 Intel Corporation.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.



This section is empty.


View Source
var (
	FaultUnknown = clientFault(
		"unknown client error",
	FaultConfigBadControlPort = clientFault(
		"invalid control port in configuration",
		"specify a nonzero control port in configuration ('port' parameter) and retry the client application",
	FaultConfigBadAccessPoints = clientFault(
		"invalid list of access points in configuration",
		"only a single access point is currently supported, specify only one and retry the client application",
View Source
var (
	MockUUID         = "00000000-0000-0000-0000-000000000000"
	MockServers      = Addresses{"", ""}
	MockCtrlrs       = NvmeControllers{MockNvmeController()}
	MockSuccessState = ctlpb.ResponseState{Status: ctlpb.ResponseStatus_CTL_SUCCESS}
	MockState        = ctlpb.ResponseState{
		Status: ctlpb.ResponseStatus_CTL_ERR_APP,
		Error:  "example application error",
	MockCtrlrResults = NvmeControllerResults{
			Pciaddr: "0000:81:00.0",
			State:   &MockState,
	MockScmModules    = ScmModules{MockScmModule()}
	MockModuleResults = ScmModuleResults{
			Physicalid: 1234,
			State:      &MockState,
	MockScmNamespaces = ScmNamespaces{MockScmNamespace()}
	MockMounts        = ScmMounts{MockScmMount()}
	MockMountResults  = ScmMountResults{
			Mntpoint: "/mnt/daos",
			State:    &MockState,
	MockACL = &mockACLResult{
		acl: []string{
	MockPoolList = []*mgmtpb.ListPoolsResp_Pool{
		{Uuid: "12345678-1234-1234-1234-123456789abc", Svcreps: []uint32{1, 2}},
		{Uuid: "12345678-1234-1234-1234-cba987654321", Svcreps: []uint32{0}},
	MockErr = errors.New("unknown failure")


func StorageFormatRequest

func StorageFormatRequest(mc Control, parms interface{}, ch chan ClientResult)

StorageFormatRequest attempts to format nonvolatile storage devices on a remote server over gRPC.

Calls control StorageFormat routine which activates StorageFormat service rpc and returns an open stream handle. Receive on stream and send ClientResult over channel for each.


type AccessControlList

type AccessControlList struct {
	Entries    []string // Access Control Entries in short string format
	Owner      string   // User that owns the resource
	OwnerGroup string   // Group that owns the resource

AccessControlList is a structure for the access control list.

func (*AccessControlList) Empty

func (acl *AccessControlList) Empty() bool

Empty checks whether there are any entries in the AccessControlList

func (*AccessControlList) HasOwner added in v0.9.0

func (acl *AccessControlList) HasOwner() bool

HasOwner checks whether the AccessControlList has an owner user.

func (*AccessControlList) HasOwnerGroup added in v0.9.0

func (acl *AccessControlList) HasOwnerGroup() bool

HasOwnerGroup checks whether the AccessControlList has an owner group.

func (*AccessControlList) String

func (acl *AccessControlList) String() string

String displays the AccessControlList in a basic string format.

type Addresses

type Addresses []string

Addresses is an alias for a slice of <ipv4/hostname>:<port> addresses.

type ClientBioResult

type ClientBioResult struct {
	Address string
	Stats   *mgmtpb.BioHealthResp
	Err     error

ClientBioResult is a container for output of BIO health query client requests.

func (ClientBioResult) String

func (cr ClientBioResult) String() string

type ClientResult

type ClientResult struct {
	Address string
	Value   interface{}
	Err     error

ClientResult is a container for output of any type of client request.

func (ClientResult) String

func (cr ClientResult) String() string

type ClientSmdResult

type ClientSmdResult struct {
	Address string
	Devs    *mgmtpb.SmdDevResp
	Pools   *mgmtpb.SmdPoolResp
	Err     error

ClientSmdResult is a container for output of SMD dev list query client requests.

func (ClientSmdResult) String

func (cr ClientSmdResult) String() string

type ClientStateResult added in v0.9.0

type ClientStateResult struct {
	Address string
	Dev     *mgmtpb.DevStateResp
	Err     error

ClientStateResult is a container for output of device state query requests

func (ClientStateResult) String added in v0.9.0

func (cr ClientStateResult) String() string

type Configuration

type Configuration struct {
	SystemName      string   `yaml:"name"`
	AccessPoints    []string `yaml:"access_points"`
	ControlPort     int      `yaml:"port"`
	HostList        []string `yaml:"hostlist"`
	RuntimeDir      string   `yaml:"runtime_dir"`
	HostFile        string   `yaml:"host_file"`
	LogFile         string   `yaml:"log_file"`
	LogFileFormat   string   `yaml:"log_file_format"`
	Path            string
	TransportConfig *security.TransportConfig `yaml:"transport_config"`
	Ext             External

Configuration contains all known configuration variables available to the client

func GetConfig

func GetConfig(log logging.Logger, inPath string) (*Configuration, error)

GetConfig loads a configuration file from the path given, or from the default location if none is provided. It returns a populated Configuration struct based upon the default values and any config file overrides.

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration creates a new instance of the Configuration struct populated with defaults and default external interface.

func (*Configuration) Load added in v0.9.0

func (c *Configuration) Load() error

Load reads the configuration file specified by Configuration.Path and parses it. Parsed values override any default values.

func (*Configuration) SetPath added in v0.9.0

func (c *Configuration) SetPath(inPath string) error

func (*Configuration) Validate added in v0.9.0

func (c *Configuration) Validate(log logging.Logger) (err error)

Validate asserts that config meets minimum requirements.

type Connect

type Connect interface {
	BioHealthQuery(*mgmtpb.BioHealthReq) ResultQueryMap
	ClearConns() ResultMap
	ConnectClients(Addresses) ResultMap
	GetActiveConns(ResultMap) ResultMap
	NetworkListProviders() ResultMap
	NetworkScanDevices(searchProvider string) NetworkScanResultMap
	PoolCreate(*PoolCreateReq) (*PoolCreateResp, error)
	PoolDestroy(*PoolDestroyReq) error
	PoolQuery(PoolQueryReq) (*PoolQueryResp, error)
	PoolSetProp(PoolSetPropReq) (*PoolSetPropResp, error)
	PoolGetACL(PoolGetACLReq) (*PoolGetACLResp, error)
	PoolOverwriteACL(PoolOverwriteACLReq) (*PoolOverwriteACLResp, error)
	PoolUpdateACL(PoolUpdateACLReq) (*PoolUpdateACLResp, error)
	PoolDeleteACL(PoolDeleteACLReq) (*PoolDeleteACLResp, error)
	SmdListDevs(*mgmtpb.SmdDevReq) ResultSmdMap
	SmdListPools(*mgmtpb.SmdPoolReq) ResultSmdMap
	StorageScan(*StorageScanReq) *StorageScanResp
	StorageFormat(reformat bool) StorageFormatResults
	StoragePrepare(*ctlpb.StoragePrepareReq) ResultMap
	DevStateQuery(*mgmtpb.DevStateReq) ResultStateMap
	StorageSetFaulty(*mgmtpb.DevStateReq) ResultStateMap
	SystemQuery(SystemQueryReq) (*SystemQueryResp, error)
	SystemStop(SystemStopReq) (*SystemStopResp, error)
	SystemStart(SystemStartReq) (*SystemStartResp, error)
	LeaderQuery(LeaderQueryReq) (*LeaderQueryResp, error)
	ListPools(ListPoolsReq) (*ListPoolsResp, error)

Connect is an external interface providing functionality across multiple connected clients (controllers).

func NewConnect

func NewConnect(log logging.Logger) Connect

NewConnect is a factory for Connect interface to operate over multiple clients.

type Control

type Control interface {
	// contains filtered or unexported methods

Control interface provides connection handling capabilities.

type ControllerFactory

type ControllerFactory interface {
	// contains filtered or unexported methods

ControllerFactory is an interface providing capability to connect clients.

type External

type External interface {
	Getenv(string) string
	RunCommand(string) error

External interface provides methods to support various os operations.

type LeaderQueryReq added in v0.8.0

type LeaderQueryReq struct {
	System string

LeaderQueryReq contains the inputs for the leader query command.

type LeaderQueryResp added in v0.8.0

type LeaderQueryResp struct {
	Leader   string
	Replicas []string

LeaderQueryResp contains the status of the request and, if successful, the MS leader and set of replicas in the system.

type ListPoolsReq added in v0.8.0

type ListPoolsReq struct {
	SysName string

ListPoolsReq contains the inputs for the list pools command.

type ListPoolsResp added in v0.8.0

type ListPoolsResp struct {
	Status int32
	Pools  []*PoolDiscovery

ListPoolsResp contains the status of the request and, if successful, the list of pools in the system.

type NetworkScanResult

type NetworkScanResult struct {
	// contains filtered or unexported fields

func (NetworkScanResult) String

func (nsr NetworkScanResult) String() string

type NetworkScanResultMap

type NetworkScanResultMap map[string][]NetworkScanResult

func (NetworkScanResultMap) String

func (nsrm NetworkScanResultMap) String() string

type NvmeScanResult

type NvmeScanResult struct {
	Ctrlrs proto.NvmeControllers
	Err    error

NvmeScanResult represents the result of scanning for SCM modules installed on a storage node.

func (*NvmeScanResult) String

func (result *NvmeScanResult) String() string

func (*NvmeScanResult) StringHealthStats

func (result *NvmeScanResult) StringHealthStats() string

func (*NvmeScanResult) Summary

func (result *NvmeScanResult) Summary() (out string)

type NvmeScanResults

type NvmeScanResults map[string]*NvmeScanResult

NvmeScanResults maps NvmeScanResult structs to the addresses of remote servers identified by an address string.

type PoolCreateReq

type PoolCreateReq struct {
	ScmBytes   uint64
	NvmeBytes  uint64
	RankList   []uint32
	NumSvcReps uint32
	Sys        string
	Usr        string
	Grp        string
	ACL        *AccessControlList
	UUID       string

PoolCreateReq struct contains request

type PoolCreateResp

type PoolCreateResp struct {
	UUID    string
	SvcReps []uint32

PoolCreateResp struct contains response

type PoolDeleteACLReq

type PoolDeleteACLReq struct {
	UUID      string // UUID of the pool
	Principal string // Principal whose entry will be removed

PoolDeleteACLReq contains the input parameters for PoolDeleteACL.

type PoolDeleteACLResp

type PoolDeleteACLResp struct {
	ACL *AccessControlList // actual ACL of the pool

PoolDeleteACLResp returns the updated ACL for the pool.

type PoolDestroyReq

type PoolDestroyReq struct {
	UUID  string
	Force bool

PoolDestroyReq struct contains request

type PoolDiscovery added in v0.8.0

type PoolDiscovery struct {
	UUID        string   // Unique identifier
	SvcReplicas []uint32 // Ranks of pool service replicas

PoolDiscovery represents the basic discovery information for a pool.

type PoolGetACLReq

type PoolGetACLReq struct {
	UUID string // pool UUID

PoolGetACLReq contains the input parameters for PoolGetACL

type PoolGetACLResp

type PoolGetACLResp struct {
	ACL *AccessControlList

PoolGetACLResp contains the output results for PoolGetACL

type PoolOverwriteACLReq

type PoolOverwriteACLReq struct {
	UUID string             // pool UUID
	ACL  *AccessControlList // new ACL for the pool

PoolOverwriteACLReq contains the input parameters for PoolOverwriteACL

type PoolOverwriteACLResp

type PoolOverwriteACLResp struct {
	ACL *AccessControlList // actual ACL of the pool

PoolOverwriteACLResp returns the updated ACL for the pool

type PoolQueryReq added in v0.9.0

type PoolQueryReq struct {
	UUID string

PoolQueryReq contains pool query parameters.

type PoolQueryResp added in v0.9.0

type PoolQueryResp struct {
	Status          int32
	UUID            string
	TotalTargets    uint32
	ActiveTargets   uint32
	DisabledTargets uint32
	Rebuild         *PoolRebuildStatus
	Scm             *StorageUsageStats
	Nvme            *StorageUsageStats

PoolQueryResp contains the pool query response.

type PoolRebuildState added in v0.9.0

type PoolRebuildState uint

PoolRebuildState indicates the current state of the pool rebuild process.

const (
	// PoolRebuildStateIdle indicates that the rebuild process is idle.
	PoolRebuildStateIdle PoolRebuildState = iota
	// PoolRebuildStateDone indicates that the rebuild process has completed.
	// PoolRebuildStateBusy indicates that the rebuild process is in progress.

func (PoolRebuildState) String added in v0.9.0

func (prs PoolRebuildState) String() string

type PoolRebuildStatus added in v0.9.0

type PoolRebuildStatus struct {
	Status  int32
	State   PoolRebuildState
	Objects uint64
	Records uint64

PoolRebuildStatus contains detailed information about the pool rebuild process.

type PoolSetPropReq added in v0.9.0

type PoolSetPropReq struct {
	// UUID identifies the pool for which this property should be set.
	UUID string
	// Property is always a string representation of the pool property.
	// It will be resolved into the C representation prior to being
	// forwarded over dRPC.
	Property string
	// Value is an approximation of the union in daos_prop_entry.
	// It can be either a string or a uint64. Struct-based properties
	// are not supported via this API.
	Value interface{}

PoolSetPropReq contains pool set-prop parameters.

func (*PoolSetPropReq) SetNumber added in v0.9.0

func (pspr *PoolSetPropReq) SetNumber(numVal uint64)

SetNumber sets the property value to a uint64 number.

func (*PoolSetPropReq) SetString added in v0.9.0

func (pspr *PoolSetPropReq) SetString(strVal string)

SetString sets the property value to a string.

type PoolSetPropResp added in v0.9.0

type PoolSetPropResp struct {
	UUID     string
	Property string
	Value    string

PoolSetPropResp contains the response to a pool set-prop operation.

type PoolUpdateACLReq

type PoolUpdateACLReq struct {
	UUID string             // pool UUID
	ACL  *AccessControlList // ACL entries to add to the pool

PoolUpdateACLReq contains the input parameters for PoolUpdateACL

type PoolUpdateACLResp

type PoolUpdateACLResp struct {
	ACL *AccessControlList // actual ACL of the pool

PoolUpdateACLResp returns the updated ACL for the pool

type ProviderListResult

type ProviderListResult struct {
	// contains filtered or unexported fields

type ResultMap

type ResultMap map[string]ClientResult

ResultMap map client addresses to method call ClientResults

func (ResultMap) String

func (rm ResultMap) String() string

type ResultQueryMap

type ResultQueryMap map[string]ClientBioResult

func (ResultQueryMap) String

func (rm ResultQueryMap) String() string

type ResultSmdMap

type ResultSmdMap map[string]ClientSmdResult

func (ResultSmdMap) String

func (rm ResultSmdMap) String() string

type ResultStateMap added in v0.9.0

type ResultStateMap map[string]ClientStateResult

func (ResultStateMap) String added in v0.9.0

func (rm ResultStateMap) String() string

type ScmScanResult

type ScmScanResult struct {
	Modules    storage.ScmModules
	Namespaces storage.ScmNamespaces
	Err        error

ScmScanResult represents the result of scanning for SCM modules installed on a storage node and SCM namespaces.

func (*ScmScanResult) String

func (result *ScmScanResult) String() string

func (*ScmScanResult) Summary

func (result *ScmScanResult) Summary() (out string)

type ScmScanResults

type ScmScanResults map[string]*ScmScanResult

ScmScanMap maps ScmModuleScanResult structs to the addresses of remote servers identified by an address string.

type StorageFormatReq added in v0.8.0

type StorageFormatReq struct {
	Reformat bool

StorageFormatReq encapsulated subsystem format parameters.

type StorageFormatResult

type StorageFormatResult struct {
	Nvme proto.NvmeControllerResults
	Scm  proto.ScmMountResults
	Err  error

func (*StorageFormatResult) HasErrors added in v0.8.0

func (sfr *StorageFormatResult) HasErrors() bool

type StorageFormatResults added in v0.8.0

type StorageFormatResults map[string]StorageFormatResult

StorageFormatResults stores results of format operations on NVMe controllers and SCM mountpoints.

func (StorageFormatResults) Keys added in v0.8.0

func (sfr StorageFormatResults) Keys() (keys []string)

type StorageScanReq

type StorageScanReq struct{}

StorageScanReq encapsulated subsystem scan parameters.

type StorageScanResp

type StorageScanResp struct {
	Servers []string
	Nvme    NvmeScanResults
	Scm     ScmScanResults

StorageScanResp encapsulated subsystem results.

func MockScanResp

func MockScanResp(cs *NvmeControllers, ms *ScmModules, nss *ScmNamespaces, addrs Addresses) *StorageScanResp

MockScanResp mocks scan results from scm and nvme for multiple servers. Each result indicates success or failure through presence of Err.

func (*StorageScanResp) StringHealthStats

func (ssr *StorageScanResp) StringHealthStats() string

type StorageUsageStats added in v0.9.0

type StorageUsageStats struct {
	Total uint64
	Free  uint64
	Min   uint64
	Max   uint64
	Mean  uint64

StorageUsageStats represents DAOS storage usage statistics.

type SystemQueryReq added in v0.9.0

type SystemQueryReq struct {
	Ranks []uint32

SystemQueryReq contains the inputs for the system query request.

type SystemQueryResp added in v0.9.0

type SystemQueryResp struct {
	Members system.Members

SystemQueryResp contains the request response.

type SystemStartReq added in v0.9.0

type SystemStartReq struct {
	Ranks []uint32

SystemStartReq contains the inputs for the system start request.

type SystemStartResp added in v0.9.0

type SystemStartResp struct {
	Results system.MemberResults // resulting from harness starts

SystemStartResp contains the request response.

type SystemStopReq added in v0.9.0

type SystemStopReq struct {
	Prep  bool
	Kill  bool
	Ranks []uint32
	Force bool

SystemStopReq contains the inputs for the system stop command.

type SystemStopResp added in v0.9.0

type SystemStopResp struct {
	Results system.MemberResults

SystemStopResp contains the request response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL