diff --git a/api/v3/api_v3_cluster.go b/api/v3/api_v3_cluster.go index 8cc3b7a..a16bfb2 100644 --- a/api/v3/api_v3_cluster.go +++ b/api/v3/api_v3_cluster.go @@ -49,6 +49,15 @@ func GetIsiStats( return resp, err } +func IsIOInProgress(ctx context.Context, + client api.Client) (resp *ExportClientList, err error) { + err = client.Get( + ctx, string(platfromStatsPath), "summary/client", nil, + nil, + &resp) + return resp, err +} + // GetIsiClusterConfig queries the config information of OneFS cluster func GetIsiClusterConfig( ctx context.Context, diff --git a/api/v3/api_v3_types.go b/api/v3/api_v3_types.go index 08fb266..5cdda51 100644 --- a/api/v3/api_v3_types.go +++ b/api/v3/api_v3_types.go @@ -49,3 +49,12 @@ type IsiDevice struct { IsUp bool `json:"is_up"` Lnn int64 `json:"lnn"` } + +type isiClientList struct { + Protocol string `json:"protocol"` + RemoteAddr string `json:"remote_addr"` + RemoteName string `json:"remote_name"` +} +type ExportClientList struct { + ClientsList []*isiClientList `json:"client"` +} diff --git a/cluster.go b/cluster.go index 6129f46..51482d7 100644 --- a/cluster.go +++ b/cluster.go @@ -23,6 +23,7 @@ import ( // Stats is Isilon statistics data structure . type Stats *apiv3.IsiStatsResp +type Clients *apiv3.ExportClientList //GetStatistics returns statistics from Isilon. Keys indicate type of statistics expected func (c *Client) GetStatistics( @@ -37,6 +38,18 @@ func (c *Client) GetStatistics( return stats, nil } +// IsIOinProgress checks whether a volume on a node has IO in progress +func (c *Client) IsIOInProgress( + ctx context.Context) (Clients, error) { + + // query the volume without using the metadata parameter, use whether an error (typically, JSONError instance with "404 Not Found" status code) is returned to indicate whether the volume already exists. + clientList, err := apiv3.IsIOInProgress(ctx, c.API) + if err != nil { + return nil, err + } + return clientList, nil +} + // ClusterConfig represents the configuration of cluster in k8s (namespace API). type ClusterConfig *apiv3.IsiClusterConfig