Fix duplicate proto error in kubectl 1.8.0-alpha.
- Remove vendor'ed package go.pedge.io/pb/go/google/protobuf. - Update vendor'ed package github.com/libopenstorage/openstorage.
This commit is contained in:
191
vendor/github.com/libopenstorage/openstorage/api/api.go
generated
vendored
191
vendor/github.com/libopenstorage/openstorage/api/api.go
generated
vendored
@@ -2,26 +2,44 @@ package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mohae/deepcopy"
|
||||
)
|
||||
|
||||
// Strings for VolumeSpec
|
||||
const (
|
||||
Name = "name"
|
||||
SpecEphemeral = "ephemeral"
|
||||
SpecShared = "shared"
|
||||
SpecSize = "size"
|
||||
SpecScale = "scale"
|
||||
SpecFilesystem = "fs"
|
||||
SpecBlockSize = "block_size"
|
||||
SpecHaLevel = "repl"
|
||||
SpecPriority = "io_priority"
|
||||
SpecSnapshotInterval = "snap_interval"
|
||||
SpecAggregationLevel = "aggregation_level"
|
||||
SpecDedupe = "dedupe"
|
||||
SpecPassphrase = "passphrase"
|
||||
Name = "name"
|
||||
SpecNodes = "nodes"
|
||||
SpecParent = "parent"
|
||||
SpecEphemeral = "ephemeral"
|
||||
SpecShared = "shared"
|
||||
SpecSticky = "sticky"
|
||||
SpecSecure = "secure"
|
||||
SpecCompressed = "compressed"
|
||||
SpecSize = "size"
|
||||
SpecScale = "scale"
|
||||
SpecFilesystem = "fs"
|
||||
SpecBlockSize = "block_size"
|
||||
SpecHaLevel = "repl"
|
||||
SpecPriority = "io_priority"
|
||||
SpecSnapshotInterval = "snap_interval"
|
||||
SpecSnapshotSchedule = "snap_schedule"
|
||||
SpecAggregationLevel = "aggregation_level"
|
||||
SpecDedupe = "dedupe"
|
||||
SpecPassphrase = "secret_key"
|
||||
SpecAutoAggregationValue = "auto"
|
||||
SpecGroup = "group"
|
||||
SpecGroupEnforce = "fg"
|
||||
SpecZones = "zones"
|
||||
SpecRacks = "racks"
|
||||
SpecRegions = "regions"
|
||||
SpecLabels = "labels"
|
||||
SpecPriorityAlias = "priority_io"
|
||||
SpecIoProfile = "io_profile"
|
||||
)
|
||||
|
||||
// OptionKey specifies a set of recognized query params.
|
||||
@@ -30,6 +48,8 @@ const (
|
||||
OptName = "Name"
|
||||
// OptVolumeID query parameter used to lookup volume by ID.
|
||||
OptVolumeID = "VolumeID"
|
||||
// OptSnapID query parameter used to lookup snapshot by ID.
|
||||
OptSnapID = "SnapID"
|
||||
// OptLabel query parameter used to lookup volume by set of labels.
|
||||
OptLabel = "Label"
|
||||
// OptConfigLabel query parameter used to lookup volume by set of labels.
|
||||
@@ -40,9 +60,16 @@ const (
|
||||
|
||||
// Api client-server Constants
|
||||
const (
|
||||
OsdVolumePath = "osd-volumes"
|
||||
OsdVolumePath = "osd-volumes"
|
||||
OsdSnapshotPath = "osd-snapshot"
|
||||
TimeLayout = "Jan 2 15:04:05 UTC 2006"
|
||||
)
|
||||
|
||||
const (
|
||||
// AutoAggregation value indicates driver to select aggregation level.
|
||||
AutoAggregation = math.MaxUint32
|
||||
)
|
||||
|
||||
// Node describes the state of a node.
|
||||
// It includes the current physical state (CPU, memory, storage, network usage) as
|
||||
// well as the containers running on the system.
|
||||
@@ -56,6 +83,7 @@ type Node struct {
|
||||
Status Status
|
||||
GenNumber uint64
|
||||
Disks map[string]StorageResource
|
||||
Pools []StoragePool
|
||||
MgmtIp string
|
||||
DataIp string
|
||||
Timestamp time.Time
|
||||
@@ -66,6 +94,17 @@ type Node struct {
|
||||
NodeLabels map[string]string
|
||||
}
|
||||
|
||||
type FluentDConfig struct {
|
||||
IP string `json:"ip"`
|
||||
Port string `json:"port"`
|
||||
}
|
||||
|
||||
type TunnelConfig struct {
|
||||
Key string `json:"key"`
|
||||
Cert string `json:"cert"`
|
||||
Endpoint string `json:"tunnel_endpoint"`
|
||||
}
|
||||
|
||||
// Cluster represents the state of the cluster.
|
||||
type Cluster struct {
|
||||
Status Status
|
||||
@@ -79,6 +118,18 @@ type Cluster struct {
|
||||
|
||||
// Nodes is an array of all the nodes in the cluster.
|
||||
Nodes []Node
|
||||
|
||||
// Logging url for the cluster.
|
||||
LoggingURL string
|
||||
|
||||
// Management url for the cluster
|
||||
ManagementURL string
|
||||
|
||||
// FluentD Host for the cluster
|
||||
FluentDConfig FluentDConfig
|
||||
|
||||
// TunnelConfig for the cluster [key, cert, endpoint]
|
||||
TunnelConfig TunnelConfig
|
||||
}
|
||||
|
||||
// StatPoint represents the basic structure of a single Stat reported
|
||||
@@ -95,69 +146,97 @@ type StatPoint struct {
|
||||
Timestamp int64
|
||||
}
|
||||
|
||||
// DriverTypeSimpleValueOf returns the string format of DriverType
|
||||
func DriverTypeSimpleValueOf(s string) (DriverType, error) {
|
||||
obj, err := simpleValueOf("driver_type", DriverType_value, s)
|
||||
return DriverType(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of DriverType
|
||||
func (x DriverType) SimpleString() string {
|
||||
return simpleString("driver_type", DriverType_name, int32(x))
|
||||
}
|
||||
|
||||
// FSTypeSimpleValueOf returns the string format of FSType
|
||||
func FSTypeSimpleValueOf(s string) (FSType, error) {
|
||||
obj, err := simpleValueOf("fs_type", FSType_value, s)
|
||||
return FSType(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of DriverType
|
||||
func (x FSType) SimpleString() string {
|
||||
return simpleString("fs_type", FSType_name, int32(x))
|
||||
}
|
||||
|
||||
// CosTypeSimpleValueOf returns the string format of CosType
|
||||
func CosTypeSimpleValueOf(s string) (CosType, error) {
|
||||
obj, err := simpleValueOf("cos_type", CosType_value, s)
|
||||
return CosType(obj), err
|
||||
obj, exists := CosType_value[strings.ToUpper(s)]
|
||||
if !exists {
|
||||
return -1, fmt.Errorf("Invalid cos value: %s", s)
|
||||
}
|
||||
return CosType(obj), nil
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of CosType
|
||||
func (x CosType) SimpleString() string {
|
||||
return simpleString("cos_type", CosType_name, int32(x))
|
||||
}
|
||||
|
||||
// GraphDriverChangeTypeSimpleValueOf returns the string format of GraphDriverChangeType
|
||||
func GraphDriverChangeTypeSimpleValueOf(s string) (GraphDriverChangeType, error) {
|
||||
obj, err := simpleValueOf("graph_driver_change_type", GraphDriverChangeType_value, s)
|
||||
return GraphDriverChangeType(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of GraphDriverChangeType
|
||||
func (x GraphDriverChangeType) SimpleString() string {
|
||||
return simpleString("graph_driver_change_type", GraphDriverChangeType_name, int32(x))
|
||||
}
|
||||
|
||||
// VolumeActionParamSimpleValueOf returns the string format of VolumeAction
|
||||
func VolumeActionParamSimpleValueOf(s string) (VolumeActionParam, error) {
|
||||
obj, err := simpleValueOf("volume_action_param", VolumeActionParam_value, s)
|
||||
return VolumeActionParam(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of VolumeAction
|
||||
func (x VolumeActionParam) SimpleString() string {
|
||||
return simpleString("volume_action_param", VolumeActionParam_name, int32(x))
|
||||
}
|
||||
|
||||
// VolumeStateSimpleValueOf returns the string format of VolumeState
|
||||
func VolumeStateSimpleValueOf(s string) (VolumeState, error) {
|
||||
obj, err := simpleValueOf("volume_state", VolumeState_value, s)
|
||||
return VolumeState(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of VolumeState
|
||||
func (x VolumeState) SimpleString() string {
|
||||
return simpleString("volume_state", VolumeState_name, int32(x))
|
||||
}
|
||||
|
||||
// VolumeStatusSimpleValueOf returns the string format of VolumeStatus
|
||||
func VolumeStatusSimpleValueOf(s string) (VolumeStatus, error) {
|
||||
obj, err := simpleValueOf("volume_status", VolumeStatus_value, s)
|
||||
return VolumeStatus(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of VolumeStatus
|
||||
func (x VolumeStatus) SimpleString() string {
|
||||
return simpleString("volume_status", VolumeStatus_name, int32(x))
|
||||
}
|
||||
|
||||
// IoProfileSimpleValueOf returns the string format of IoProfile
|
||||
func IoProfileSimpleValueOf(s string) (IoProfile, error) {
|
||||
obj, err := simpleValueOf("io_profile", IoProfile_value, s)
|
||||
return IoProfile(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of IoProfile
|
||||
func (x IoProfile) SimpleString() string {
|
||||
return simpleString("io_profile", IoProfile_name, int32(x))
|
||||
}
|
||||
|
||||
func simpleValueOf(typeString string, valueMap map[string]int32, s string) (int32, error) {
|
||||
obj, ok := valueMap[strings.ToUpper(fmt.Sprintf("%s_%s", typeString, s))]
|
||||
if !ok {
|
||||
@@ -178,6 +257,7 @@ func toSec(ms uint64) uint64 {
|
||||
return ms / 1000
|
||||
}
|
||||
|
||||
// WriteThroughput returns the write throughput
|
||||
func (v *Stats) WriteThroughput() uint64 {
|
||||
if v.IntervalMs == 0 {
|
||||
return 0
|
||||
@@ -185,6 +265,7 @@ func (v *Stats) WriteThroughput() uint64 {
|
||||
return (v.WriteBytes) / toSec(v.IntervalMs)
|
||||
}
|
||||
|
||||
// ReadThroughput returns the read throughput
|
||||
func (v *Stats) ReadThroughput() uint64 {
|
||||
if v.IntervalMs == 0 {
|
||||
return 0
|
||||
@@ -192,17 +273,93 @@ func (v *Stats) ReadThroughput() uint64 {
|
||||
return (v.ReadBytes) / toSec(v.IntervalMs)
|
||||
}
|
||||
|
||||
// Latency returns latency
|
||||
func (v *Stats) Latency() uint64 {
|
||||
ops := v.Writes + v.Reads
|
||||
if ops == 0 {
|
||||
return 0
|
||||
}
|
||||
return (uint64)((v.IoMs * 1000) / (v.Writes + v.Reads))
|
||||
return (uint64)((v.IoMs * 1000) / ops)
|
||||
}
|
||||
|
||||
// Read latency returns avg. time required for read operation to complete
|
||||
func (v *Stats) ReadLatency() uint64 {
|
||||
if v.Reads == 0 {
|
||||
return 0
|
||||
}
|
||||
return (uint64)((v.ReadMs * 1000) / v.Reads)
|
||||
}
|
||||
|
||||
// Write latency returns avg. time required for write operation to complete
|
||||
func (v *Stats) WriteLatency() uint64 {
|
||||
if v.Writes == 0 {
|
||||
return 0
|
||||
}
|
||||
return (uint64)((v.WriteMs * 1000) / v.Writes)
|
||||
}
|
||||
|
||||
// Iops returns iops
|
||||
func (v *Stats) Iops() uint64 {
|
||||
if v.IntervalMs == 0 {
|
||||
return 0
|
||||
}
|
||||
return (v.Writes + v.Reads) / toSec(v.IntervalMs)
|
||||
}
|
||||
|
||||
// Scaled returns true if the volume is scaled.
|
||||
func (v *Volume) Scaled() bool {
|
||||
return v.Spec.Scale > 1
|
||||
}
|
||||
|
||||
// Contains returns true if mid is a member of volume's replication set.
|
||||
func (m *Volume) Contains(mid string) bool {
|
||||
rsets := m.GetReplicaSets()
|
||||
for _, rset := range rsets {
|
||||
for _, node := range rset.Nodes {
|
||||
if node == mid {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Copy makes a deep copy of VolumeSpec
|
||||
func (s *VolumeSpec) Copy() *VolumeSpec {
|
||||
spec := *s
|
||||
if s.VolumeLabels != nil {
|
||||
spec.VolumeLabels = make(map[string]string)
|
||||
for k, v := range s.VolumeLabels {
|
||||
spec.VolumeLabels[k] = v
|
||||
}
|
||||
}
|
||||
if s.ReplicaSet != nil {
|
||||
spec.ReplicaSet = &ReplicaSet{Nodes: make([]string, len(s.ReplicaSet.Nodes))}
|
||||
copy(spec.ReplicaSet.Nodes, s.ReplicaSet.Nodes)
|
||||
}
|
||||
return &spec
|
||||
}
|
||||
|
||||
// Copy makes a deep copy of Node
|
||||
func (s *Node) Copy() *Node {
|
||||
localCopy := deepcopy.Copy(*s)
|
||||
nodeCopy := localCopy.(Node)
|
||||
return &nodeCopy
|
||||
}
|
||||
|
||||
func (v Volume) IsClone() bool {
|
||||
return v.Source != nil && len(v.Source.Parent) != 0 && !v.Readonly
|
||||
}
|
||||
|
||||
func (v Volume) IsSnapshot() bool {
|
||||
return v.Source != nil && len(v.Source.Parent) != 0 && v.Readonly
|
||||
}
|
||||
|
||||
func (v Volume) DisplayId() string {
|
||||
if v.Locator != nil {
|
||||
return fmt.Sprintf("%s (%s)", v.Locator.Name, v.Id)
|
||||
} else {
|
||||
return v.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
Reference in New Issue
Block a user