fix verify and add verify test cases
This commit is contained in:
27
.travis.yml
27
.travis.yml
@@ -36,18 +36,21 @@ script:
|
|||||||
- ./autogen.sh
|
- ./autogen.sh
|
||||||
- ./configure
|
- ./configure
|
||||||
- make
|
- make
|
||||||
- ./test-tool/iscsi-test-cu -d -f --test=SCSI.TestUnitReady iscsi://127.0.0.1:3260/${TARGET}/0
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.TestUnitReady iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
- ./test-tool/iscsi-test-cu -d -f --test=SCSI.ReadCapacity10 iscsi://127.0.0.1:3260/${TARGET}/0
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.ReadCapacity10 iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
- ./test-tool/iscsi-test-cu -d -f --test=SCSI.ReadCapacity16 iscsi://127.0.0.1:3260/${TARGET}/0
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.ReadCapacity16 iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
- ./test-tool/iscsi-test-cu -d -f --test=SCSI.Read10.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.Read10.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
- ./test-tool/iscsi-test-cu -d -f --test=SCSI.Write10.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.Write10.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
- ./test-tool/iscsi-test-cu -d -f --test=SCSI.Read16.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.Read16.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
- ./test-tool/iscsi-test-cu -d -f --test=SCSI.Write16.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.Write16.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
- ./test-tool/iscsi-test-cu -d -f --test=SCSI.Read32.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.Read32.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
- ./test-tool/iscsi-test-cu -d -f --test=SCSI.Write32.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.Write32.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
- ./test-tool/iscsi-test-cu -d -f --test=SCSI.WriteVerify10.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.WriteVerify10.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
- ./test-tool/iscsi-test-cu -d -f --test=SCSI.WriteVerify16.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.WriteVerify16.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
- ./test-tool/iscsi-test-cu -d -f --test=SCSI.WriteVerify32.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.WriteVerify32.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.Verify10.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.Verify12.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
|
- ./test-tool/iscsi-test-cu -d -A --test=SCSI.Verify16.Simple iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
- ./utils/iscsi-ls -s iscsi://127.0.0.1:3260/${TARGET}
|
- ./utils/iscsi-ls -s iscsi://127.0.0.1:3260/${TARGET}
|
||||||
- ./utils/iscsi-inq iscsi://127.0.0.1:3260/${TARGET}/0
|
- ./utils/iscsi-inq iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
- ./utils/iscsi-readcapacity16 iscsi://127.0.0.1:3260/${TARGET}/0
|
- ./utils/iscsi-readcapacity16 iscsi://127.0.0.1:3260/${TARGET}/0
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ You can test this with [open-iscsi](http://www.open-iscsi.com/) or [libiscsi](ht
|
|||||||
* SCSI Command Queue (p2)
|
* SCSI Command Queue (p2)
|
||||||
* More SCSI commands
|
* More SCSI commands
|
||||||
* SPC3/SAM2
|
* SPC3/SAM2
|
||||||
* Verify (carmark, p1)
|
|
||||||
* Support `Target Group` and `Target Port` (p3)
|
* Support `Target Group` and `Target Port` (p3)
|
||||||
* Refactor (carmark, p1)
|
* Refactor (carmark, p1)
|
||||||
* Command Line (carmark, p1)
|
* Command Line (carmark, p1)
|
||||||
|
|||||||
@@ -261,6 +261,12 @@ func (m *ISCSICommand) scsiCmdRespBytes() []byte {
|
|||||||
for i := 0; i < 3*4; i++ {
|
for i := 0; i < 3*4; i++ {
|
||||||
buf.WriteByte(0x00)
|
buf.WriteByte(0x00)
|
||||||
}
|
}
|
||||||
|
buf.Write(m.RawData)
|
||||||
|
dl := len(m.RawData)
|
||||||
|
for dl%4 > 0 {
|
||||||
|
dl++
|
||||||
|
buf.WriteByte(0x00)
|
||||||
|
}
|
||||||
|
|
||||||
return buf.Bytes()
|
return buf.Bytes()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -532,8 +532,13 @@ func SBCVerify(host int, cmd *api.SCSICommand) api.SAMStat {
|
|||||||
var (
|
var (
|
||||||
key = ILLEGAL_REQUEST
|
key = ILLEGAL_REQUEST
|
||||||
asc = ASC_INVALID_FIELD_IN_CDB
|
asc = ASC_INVALID_FIELD_IN_CDB
|
||||||
|
dev = cmd.Device
|
||||||
|
scb = cmd.SCB.Bytes()
|
||||||
|
lba uint64
|
||||||
|
tl uint32
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
if cmd.Device.Attrs.Removable && !cmd.Device.Attrs.Online {
|
if dev.Attrs.Removable && !dev.Attrs.Online {
|
||||||
key = NOT_READY
|
key = NOT_READY
|
||||||
asc = ASC_MEDIUM_NOT_PRESENT
|
asc = ASC_MEDIUM_NOT_PRESENT
|
||||||
goto sense
|
goto sense
|
||||||
@@ -550,7 +555,36 @@ func SBCVerify(host int, cmd *api.SCSICommand) api.SAMStat {
|
|||||||
// no data compare with the media
|
// no data compare with the media
|
||||||
return api.SAMStatGood
|
return api.SAMStatGood
|
||||||
}
|
}
|
||||||
// TODO
|
lba = getSCSIReadWriteOffset(scb)
|
||||||
|
tl = getSCSIReadWriteCount(scb)
|
||||||
|
|
||||||
|
// Verify that we are not doing i/o beyond the end-of-lun
|
||||||
|
if tl != 0 {
|
||||||
|
if lba+uint64(tl) < lba || lba+uint64(tl) > dev.Size>>dev.BlockShift {
|
||||||
|
key = ILLEGAL_REQUEST
|
||||||
|
asc = ASC_LBA_OUT_OF_RANGE
|
||||||
|
glog.Warningf("sense: lba: %d, tl: %d, size: %d", lba, tl, dev.Size>>dev.BlockShift)
|
||||||
|
goto sense
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if lba >= dev.Size>>dev.BlockShift {
|
||||||
|
key = ILLEGAL_REQUEST
|
||||||
|
asc = ASC_LBA_OUT_OF_RANGE
|
||||||
|
glog.Warningf("sense")
|
||||||
|
goto sense
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.Offset = lba << dev.BlockShift
|
||||||
|
cmd.TL = tl << dev.BlockShift
|
||||||
|
err = bsPerformCommand(dev.Storage, cmd)
|
||||||
|
if err != nil {
|
||||||
|
glog.Error(err)
|
||||||
|
key = HARDWARE_ERROR
|
||||||
|
asc = ASC_INTERNAL_TGT_FAILURE
|
||||||
|
} else {
|
||||||
|
return api.SAMStatGood
|
||||||
|
}
|
||||||
sense:
|
sense:
|
||||||
cmd.InSDBBuffer.Resid = 0
|
cmd.InSDBBuffer.Resid = 0
|
||||||
BuildSenseData(cmd, key, asc)
|
BuildSenseData(cmd, key, asc)
|
||||||
|
|||||||
Reference in New Issue
Block a user