@@ -59,6 +59,8 @@ type Connector struct {
59
59
CheckInterval int32 `json:"check_interval"`
60
60
DoDiscovery bool `json:"do_discovery"`
61
61
DoCHAPDiscovery bool `json:"do_chap_discovery"`
62
+ TargetIqn string `json:"target_iqn"`
63
+ TargetPortals []string `json:"target_portals"`
62
64
}
63
65
64
66
func init () {
@@ -75,7 +77,7 @@ func EnableDebugLogging(writer io.Writer) {
75
77
76
78
// parseSession takes the raw stdout from the iscsiadm -m session command and encodes it into an iscsi session type
77
79
func parseSessions (lines string ) []iscsiSession {
78
- entries := strings .Split (strings .TrimSpace (string ( lines ) ), "\n " )
80
+ entries := strings .Split (strings .TrimSpace (lines ), "\n " )
79
81
r := strings .NewReplacer ("[" , "" ,
80
82
"]" , "" )
81
83
@@ -146,7 +148,7 @@ func waitForPathToExist(devicePath *string, maxRetries, intervalSeconds int, dev
146
148
147
149
func waitForPathToExistImpl (devicePath * string , maxRetries , intervalSeconds int , deviceTransport string , osStat statFunc , filepathGlob globFunc ) (bool , error ) {
148
150
if devicePath == nil {
149
- return false , fmt .Errorf ("Unable to check unspecified devicePath" )
151
+ return false , fmt .Errorf ("unable to check unspecified devicePath" )
150
152
}
151
153
152
154
var err error
@@ -224,7 +226,7 @@ func getMultipathDisk(path string) (string, error) {
224
226
}
225
227
}
226
228
debug .Printf ("Couldn't find dm-* path for path: %s, found non dm-* path: %s" , path , devicePath )
227
- return "" , fmt .Errorf ("Couldn 't find dm-* path for path: %s, found non dm-* path: %s" , path , devicePath )
229
+ return "" , fmt .Errorf ("couldn 't find dm-* path for path: %s, found non dm-* path: %s" , path , devicePath )
228
230
}
229
231
230
232
// Connect attempts to connect a volume to this node using the provided Connector info
@@ -238,7 +240,7 @@ func Connect(c Connector) (string, error) {
238
240
}
239
241
240
242
if c .RetryCount < 0 || c .CheckInterval < 0 {
241
- return "" , fmt .Errorf ("Invalid RetryCount and CheckInterval combination, both must be positive integers. " +
243
+ return "" , fmt .Errorf ("invalid RetryCount and CheckInterval combination, both must be positive integers. " +
242
244
"RetryCount: %d, CheckInterval: %d" , c .RetryCount , c .CheckInterval )
243
245
}
244
246
var devicePaths []string
@@ -316,7 +318,7 @@ func Connect(c Connector) (string, error) {
316
318
devicePaths = append (devicePaths , devicePath )
317
319
continue
318
320
} else if err != nil {
319
- lastErr = fmt .Errorf ("Couldn 't attach disk, err: %v" , err )
321
+ lastErr = fmt .Errorf ("couldn 't attach disk, err: %v" , err )
320
322
}
321
323
}
322
324
@@ -376,7 +378,7 @@ func DisconnectVolume(c Connector) error {
376
378
if err != nil {
377
379
return err
378
380
}
379
- err : = FlushMultipathDevice (c .DevicePath )
381
+ err = FlushMultipathDevice (c .DevicePath )
380
382
if err != nil {
381
383
return err
382
384
}
@@ -456,7 +458,7 @@ func GetConnectorFromFile(filePath string) (*Connector, error) {
456
458
457
459
}
458
460
data := Connector {}
459
- err = json .Unmarshal ([] byte ( f ) , & data )
461
+ err = json .Unmarshal (f , & data )
460
462
if err != nil {
461
463
return & Connector {}, err
462
464
}
0 commit comments