Skip to content

Commit 82f0e0b

Browse files
authored
Merge pull request #24 from tasleson/add_slots_api
Add slots API
2 parents e17f0b3 + 4fdb77e commit 82f0e0b

File tree

8 files changed

+278
-50
lines changed

8 files changed

+278
-50
lines changed

.circleci/config.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,9 @@ jobs:
88
- run:
99
command: ./test/docker_travis_test.sh
1010
no_output_timeout: 20m
11-
el7:
12-
docker:
13-
- image: centos:7
14-
steps:
15-
- checkout
16-
- run:
17-
command: ./test/docker_travis_test.sh
18-
no_output_timeout: 20m
19-
el8:
20-
docker:
21-
- image: oraclelinux:8
22-
steps:
23-
- checkout
24-
- run:
25-
command: ./test/docker_travis_test.sh
26-
no_output_timeout: 20m
2711

2812
workflows:
2913
version: 2
3014
workflow:
3115
jobs:
3216
- fedora
33-
- el7
34-
- el8

client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ func (c *ClientConnection) JobStatus(jobID string, returnedResult interface{}) (
285285
}
286286

287287
switch status {
288-
case JobStatusInprogress:
288+
case JobStatusInProgress:
289289
var percent uint8
290290
if percentError := json.Unmarshal(result[1], &percent); percentError != nil {
291291
return JobStatusError, 0, percentError
@@ -356,13 +356,13 @@ func (c *ClientConnection) getJobOrNone(err error, returned json.RawMessage, syn
356356
// JobWait waits for the job to finish and retrieves the end result in "returnedResult".
357357
func (c *ClientConnection) JobWait(jobID string, returnedResult interface{}) error {
358358

359-
for true {
359+
for {
360360
var status, _, err = c.JobStatus(jobID, returnedResult)
361361
if err != nil {
362362
return err
363363
}
364364

365-
if status == JobStatusInprogress {
365+
if status == JobStatusInProgress {
366366
time.Sleep(time.Millisecond * 250)
367367
continue
368368
} else if status == JobStatusComplete {

data.go

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type PluginInfo struct {
1212
// System represents a storage system.
1313
// * A hardware RAID card
1414
// * A storage area network (SAN)
15-
// * A software solutions running on commidity hardware
15+
// * A software solutions running on commodity hardware
1616
// * A Linux system running NFS Service
1717
type System struct {
1818
Class string `json:"class"`
@@ -94,8 +94,8 @@ type JobStatusType uint32
9494

9595
const (
9696

97-
// JobStatusInprogress indicated job is in progress
98-
JobStatusInprogress JobStatusType = 1 + iota
97+
// JobStatusInProgress indicated job is in progress
98+
JobStatusInProgress JobStatusType = 1 + iota
9999

100100
// JobStatusComplete indicates job is complete
101101
JobStatusComplete
@@ -211,8 +211,8 @@ const (
211211
// PoolUnsupportedVolumeGrow this pool does not allow growing volumes
212212
PoolUnsupportedVolumeGrow PoolUnsupportedType = 1 << iota
213213

214-
// PoolUnsupportedVolumeShink this pool does not allow shrinking volumes
215-
PoolUnsupportedVolumeShink
214+
// PoolUnsupportedVolumeShrink this pool does not allow shrinking volumes
215+
PoolUnsupportedVolumeShrink
216216
)
217217

218218
// PoolStatusType type used to describe the status of pool
@@ -405,7 +405,7 @@ const (
405405
//DiskStatusRemoved Disk was removed by administrator
406406
DiskStatusRemoved
407407

408-
// DiskStatusStarting Disk is in the process of becomming ready.
408+
// DiskStatusStarting Disk is in the process of becoming ready.
409409
DiskStatusStarting
410410

411411
// DiskStatusStopping Disk is shutting down.
@@ -414,7 +414,7 @@ const (
414414
// DiskStatusStopped Disk is stopped by administrator.
415415
DiskStatusStopped
416416

417-
// DiskStatusInitializing Disk is not yet functional, could be initializing eg. RAID, zeroed or scrubed etc.
417+
// DiskStatusInitializing Disk is not yet functional, could be initializing eg. RAID, zeroed or scrubbed etc.
418418
DiskStatusInitializing
419419

420420
// DiskStatusMaintenanceMode In maintenance for bad sector scan, integrity check and etc
@@ -699,10 +699,10 @@ const (
699699
// CapAgsGrantedToVol list access groups with access to volume
700700
CapAgsGrantedToVol CapabilityType = 44
701701

702-
// CapHasChildDep indicates support for determing if volume has child dep.
702+
// CapHasChildDep indicates support for determining if volume has child dep.
703703
CapHasChildDep CapabilityType = 45
704704

705-
// CapChildDepRm indiates support for removing child dep.
705+
// CapChildDepRm indicates support for removing child dep.
706706
CapChildDepRm CapabilityType = 46
707707

708708
// CapAccessGroupCreateIscsiIqn supports ag creating with iSCSI initiator
@@ -985,7 +985,7 @@ const (
985985
WriteCachePolicyWriteThrough
986986
)
987987

988-
// WriteCacheStatus represente write cache status type
988+
// WriteCacheStatus represents write cache status type
989989
type WriteCacheStatus uint32
990990

991991
const (
@@ -1028,7 +1028,7 @@ const (
10281028
ReadCacheStatusDisabled
10291029
)
10301030

1031-
// PhysicalDiskCache represents pyhsical disk caching type
1031+
// PhysicalDiskCache represents physical disk caching type
10321032
type PhysicalDiskCache uint32
10331033

10341034
const (
@@ -1045,7 +1045,7 @@ const (
10451045
PhysicalDiskCacheUseDiskSetting
10461046
)
10471047

1048-
// VolumeCacheInfo contains informationa about volume caching values
1048+
// VolumeCacheInfo contains information about volume caching values
10491049
type VolumeCacheInfo struct {
10501050
WriteSetting WriteCachePolicy
10511051
WriteStatus WriteCacheStatus
@@ -1097,3 +1097,45 @@ const (
10971097
// DiskLedStatusFaultUnknown fault LED is unknown
10981098
DiskLedStatusFaultUnknown
10991099
)
1100+
1101+
func append_s(dest string, append string, sep string) string {
1102+
if len(dest) > 0 {
1103+
return sep + append
1104+
}
1105+
return append
1106+
}
1107+
1108+
func (s DiskLedStatusBitField) String() string {
1109+
var rc string
1110+
var sep = ", "
1111+
1112+
if s&DiskLedStatusUnknown == DiskLedStatusUnknown {
1113+
rc += append_s(rc, "Unknown", sep)
1114+
}
1115+
1116+
if s&DiskLedStatusIdentOn == DiskLedStatusIdentOn {
1117+
rc += append_s(rc, "Ident On", sep)
1118+
}
1119+
1120+
if s&DiskLedStatusIdentOff == DiskLedStatusIdentOff {
1121+
rc += append_s(rc, "Ident Off", sep)
1122+
}
1123+
1124+
if s&DiskLedStatusIdentUnknown == DiskLedStatusIdentUnknown {
1125+
rc += append_s(rc, "Ident Unknown", sep)
1126+
}
1127+
1128+
if s&DiskLedStatusFaultOn == DiskLedStatusFaultOn {
1129+
rc += append_s(rc, "Fault On", sep)
1130+
}
1131+
1132+
if s&DiskLedStatusFaultOff == DiskLedStatusFaultOff {
1133+
rc += append_s(rc, "Fault Off", sep)
1134+
}
1135+
1136+
if s&DiskLedStatusFaultUnknown == DiskLedStatusFaultUnknown {
1137+
rc += append_s(rc, "Fault Unknown", sep)
1138+
}
1139+
1140+
return rc
1141+
}

errors/errors.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const (
8686
// NotFoundPool ... The specified pool was not found
8787
NotFoundPool int32 = 203
8888

89-
// NotFoundFsSs ... The specfified file system/snap shot was not found
89+
// NotFoundFsSs ... The specified file system/snap shot was not found
9090
NotFoundFsSS int32 = 204
9191

9292
// NotFoundVolume ... The specified volume was not found
@@ -95,6 +95,9 @@ const (
9595
// NotFoundNfsExport ... The specified NFS export was not found
9696
NotFoundNfsExport int32 = 206
9797

98+
// NotFoundGeneric ...A non-specific resource was not found
99+
NotFoundGeneric int32 = 207
100+
98101
// NotFoundSystem ... The specified system was not found
99102
NotFoundSystem int32 = 208
100103

@@ -122,8 +125,8 @@ const (
122125
// NotEnoughSpace ... Insufficient space to complete the request
123126
NotEnoughSpace int32 = 350
124127

125-
//TransPortComunication ... Issue reading/writing to plugin
126-
TransPortComunication int32 = 400
128+
//TransPortCommunication ... Issue reading/writing to plugin
129+
TransPortCommunication int32 = 400
127130

128131
// TransPortSerialization ... Issue with serializing the payload of a request
129132
TransPortSerialization int32 = 401

ipc.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ func (t *transPort) invoke(cmd string, args map[string]interface{}, result inter
8686

8787
if sendError := t.send(string(msgSerialized)); sendError != nil {
8888
return &errors.LsmError{
89-
Code: errors.TransPortComunication,
89+
Code: errors.TransPortCommunication,
9090
Message: fmt.Sprintf("Error writing to unix domain socket %s\n", sendError)}
9191
}
9292

9393
var reply, replyError = t.recv()
9494
if replyError != nil {
9595
return &errors.LsmError{
96-
Code: errors.TransPortComunication,
96+
Code: errors.TransPortCommunication,
9797
Message: fmt.Sprintf("Error reading from unix domain socket %s\n", replyError)}
9898
}
9999

@@ -131,7 +131,7 @@ func (t *transPort) readRequest() (*requestMsg, error) {
131131
request, requestError := t.recv()
132132
if requestError != nil {
133133
return nil, &errors.LsmError{
134-
Code: errors.TransPortComunication,
134+
Code: errors.TransPortCommunication,
135135
Message: fmt.Sprintf("Error reading from unix domain socket %s\n", requestError)}
136136
}
137137

@@ -147,7 +147,7 @@ func (t *transPort) readRequest() (*requestMsg, error) {
147147
func (t *transPort) sendIt(msg string) error {
148148
if sendError := t.send(msg); sendError != nil {
149149
return &errors.LsmError{
150-
Code: errors.TransPortComunication,
150+
Code: errors.TransPortCommunication,
151151
Message: fmt.Sprintf("Error writing to unix domain socket %s\n", sendError)}
152152
}
153153
return nil

0 commit comments

Comments
 (0)