Skip to content

Commit 4e9a534

Browse files
further login refactor; more sensible default options
Signed-off-by: J. Lowell Wofford <[email protected]>
1 parent 1682f62 commit 4e9a534

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

initiator.go

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func (l *IscsiLoginPdu) AddParam(keyvalue string) {
154154

155155
// ReReadPartitionTable opens the given file and reads partition table from it
156156
func ReReadPartitionTable(devname string) error {
157-
f, err := os.OpenFile(devname, os.O_RDWR, 0)
157+
f, err := os.OpenFile(devname, os.O_RDONLY, 0)
158158
if err != nil {
159159
return err
160160
}
@@ -242,12 +242,12 @@ const (
242242
)
243243

244244
var defaultOpts = IscsiOptions{
245-
MaxRecvDLength: oneMegabyte,
246-
MaxXmitDLength: oneMegabyte,
247-
FirstBurstLength: oneMegabyte,
248-
MaxBurstLength: oneMegabyte,
249-
HeaderDigest: "CRC32C",
250-
DataDigest: "CRC32C",
245+
MaxRecvDLength: 262144,
246+
MaxXmitDLength: 262144,
247+
FirstBurstLength: 262144,
248+
MaxBurstLength: 16776192,
249+
HeaderDigest: "None",
250+
DataDigest: "None",
251251
PingTimeout: oneMinute,
252252
RecvTimeout: oneMinute,
253253
CmdsMax: 128,
@@ -256,7 +256,7 @@ var defaultOpts = IscsiOptions{
256256
ImmediateData: true,
257257
DataPDUInOrder: true,
258258
DataSequenceInOrder: true,
259-
Scheduler: "noop",
259+
Scheduler: "mq-deadline",
260260
ScanTimeout: 3 * time.Second,
261261
}
262262

@@ -736,6 +736,7 @@ func (s *IscsiTargetSession) Login() error {
736736
}
737737
return nil
738738
}
739+
/* we can skip auth altogether ...
739740
queue := []string{
740741
"AuthMethod=None",
741742
// RFC 3720 page 36 last line, https://tools.ietf.org/html/rfc3720#page-36
@@ -748,9 +749,22 @@ func (s *IscsiTargetSession) Login() error {
748749
if err := handleLoginStage(queue, ISCSI_OP_PARMS_NEGOTIATION_STAGE); err != nil {
749750
return err
750751
}
752+
*/
751753

754+
// we don't need an auth stage
755+
s.currStage = ISCSI_OP_PARMS_NEGOTIATION_STAGE
752756
log.Println("login: param negotiation")
753-
queue = append(queue, []string{
757+
queue := []string{
758+
"SessionType=Normal",
759+
"DefaultTime2Wait=2",
760+
"DefaultTime2Retain=0",
761+
"IFMarker=No",
762+
"OFMarker=No",
763+
"ErrorRecoveryLevel=0",
764+
"MaxOutstandingR2T=1",
765+
"MaxConnections=1",
766+
fmt.Sprintf("InitiatorName=%s", s.opts.InitiatorName),
767+
fmt.Sprintf("TargetName=%s", s.opts.Volume),
754768
fmt.Sprintf("MaxRecvDataSegmentLength=%d", s.opts.MaxRecvDLength),
755769
fmt.Sprintf("FirstBurstLength=%d", s.opts.FirstBurstLength),
756770
fmt.Sprintf("MaxBurstLength=%d", s.opts.MaxBurstLength),
@@ -760,7 +774,7 @@ func (s *IscsiTargetSession) Login() error {
760774
fmt.Sprintf("ImmediateData=%v", iscsiBoolStr(s.opts.ImmediateData)),
761775
fmt.Sprintf("DataPDUInOrder=%v", iscsiBoolStr(s.opts.DataPDUInOrder)),
762776
fmt.Sprintf("DataSequenceInOrder=%v", iscsiBoolStr(s.opts.DataSequenceInOrder)),
763-
}...)
777+
}
764778
if err := handleLoginStage(queue, ISCSI_FULL_FEATURE_PHASE); err != nil {
765779
return err
766780
}

0 commit comments

Comments
 (0)