@@ -41,7 +41,7 @@ type iscsiSession struct {
41
41
42
42
type deviceInfo []Device
43
43
44
- // Device contains informations about a device
44
+ // Device contains information about a device
45
45
type Device struct {
46
46
Name string `json:"name"`
47
47
Hctl string `json:"hctl"`
@@ -58,28 +58,26 @@ type HCTL struct {
58
58
LUN int
59
59
}
60
60
61
- // Connector provides a struct to hold all of the needed parameters to make our iSCSI connection
61
+ // Connector provides a struct to hold all the needed parameters to make our iSCSI connection
62
62
type Connector struct {
63
- VolumeName string `json:"volume_name"`
64
- TargetIqn string `json:"target_iqn"`
65
- TargetPortals []string `json:"target_portal"`
66
- Lun int32 `json:"lun"`
67
- AuthType string `json:"auth_type"`
68
- DiscoverySecrets Secrets `json:"discovery_secrets"`
69
- SessionSecrets Secrets `json:"session_secrets"`
70
- Interface string `json:"interface"`
71
-
63
+ VolumeName string `json:"volume_name"`
64
+ TargetIqn string `json:"target_iqn"`
65
+ TargetPortals []string `json:"target_portal"`
66
+ Lun int32 `json:"lun"`
67
+ AuthType string `json:"auth_type"`
68
+ DiscoverySecrets Secrets `json:"discovery_secrets"`
69
+ SessionSecrets Secrets `json:"session_secrets"`
70
+ Interface string `json:"interface"`
72
71
MountTargetDevice * Device `json:"mount_target_device"`
73
72
Devices []Device `json:"devices"`
74
-
75
- RetryCount uint `json:"retry_count"`
76
- CheckInterval uint `json:"check_interval"`
77
- DoDiscovery bool `json:"do_discovery"`
78
- DoCHAPDiscovery bool `json:"do_chap_discovery"`
73
+ RetryCount uint `json:"retry_count"`
74
+ CheckInterval uint `json:"check_interval"`
75
+ DoDiscovery bool `json:"do_discovery"`
76
+ DoCHAPDiscovery bool `json:"do_chap_discovery"`
79
77
}
80
78
81
79
func init () {
82
- // by default we don't log anything, EnableDebugLogging() can turn on some tracing
80
+ // by default, we don't log anything, EnableDebugLogging() can turn on some tracing
83
81
debug = log .New (ioutil .Discard , "" , 0 )
84
82
}
85
83
@@ -89,7 +87,7 @@ func EnableDebugLogging(writer io.Writer) {
89
87
debug = log .New (writer , "DEBUG: " , log .Ldate | log .Ltime | log .Lshortfile )
90
88
}
91
89
92
- // parseSession takes the raw stdout from the iscsiadm -m session command and encodes it into an iSCSI session type
90
+ // parseSession takes the raw stdout from the ` iscsiadm -m session` command and encodes it into an iSCSI session type
93
91
func parseSessions (lines string ) []iscsiSession {
94
92
entries := strings .Split (strings .TrimSpace (lines ), "\n " )
95
93
r := strings .NewReplacer ("[" , "" ,
@@ -115,6 +113,7 @@ func parseSessions(lines string) []iscsiSession {
115
113
}
116
114
sessions = append (sessions , s )
117
115
}
116
+
118
117
return sessions
119
118
}
120
119
@@ -322,7 +321,7 @@ func (c *Connector) connectTarget(targetIqn string, target string, iFace string,
322
321
if _ , err := iscsiCmd (append (baseArgs , []string {"-R" }... )... ); err != nil {
323
322
debug .Printf ("Failed to rescan session, err: %v" , err )
324
323
if os .IsTimeout (err ) {
325
- debug .Printf ("iscsiadm timeouted , logging out" )
324
+ debug .Printf ("iscsiadm timeout , logging out" )
326
325
cmd := execCommand ("iscsiadm" , append (baseArgs , []string {"-u" }... )... )
327
326
out , err := cmd .CombinedOutput ()
328
327
if err != nil {
@@ -404,7 +403,7 @@ func Disconnect(targetIqn string, targets []string) {
404
403
}
405
404
406
405
// Disconnect performs a disconnect operation from an appliance.
407
- // Be sure to disconnect all deivces properly before doing this as it can result in data loss.
406
+ // Be sure to disconnect all devices properly before doing this as it can result in data loss.
408
407
func (c * Connector ) Disconnect () {
409
408
Disconnect (c .TargetIqn , c .TargetPortals )
410
409
}
@@ -795,7 +794,7 @@ func (d *Device) Delete() error {
795
794
return d .WriteDeviceFile ("delete" , "1" )
796
795
}
797
796
798
- // Rescan rescan an SCSI device by writing 1 in /sys/class/scsi_device/h:c:t:l/device/rescan
797
+ // Rescan does a rescan of SCSI device by writing 1 in /sys/class/scsi_device/h:c:t:l/device/rescan
799
798
func (d * Device ) Rescan () error {
800
799
return d .WriteDeviceFile ("rescan" , "1" )
801
800
}
0 commit comments