I noticed that cython-sgio has a hard-coded timeout of 1800000 milliseconds (30 minutes). It means that all commands in python-scsi can only use this fixed timeout value, which makes the library quite inflexible for different use cases.
I understand that 1800000 milliseconds probably works well for most modern SCSI devices in normal situations, but there are definitely cases where we need to be able to set this timeout ourselves, like:
- The protocol test to validate command timeout behavior;
- Buggy devices where some commands never return, leaving us stuck waiting 30 minutes for a timeout.
sg3_utils has 3 default timeout values for different commands(https://github.com/doug-gilbert/sg3_utils/blob/main/lib/sg_cmds_basic.c#L51-L53), while some commands support to set the timeout in input parameters, like “unmap”:
# sg_unmap -h
Usage: sg_unmap [--all=ST,RN[,LA]] [--anchor] [--dry-run] [--force]
[--grpnum=GN] [--help] [--in=FILE] [--lba=LBA,LBA...]
[--num=NUM,NUM...] [--timeout=TO] [--verbose] [--version]
DEVICE
where:
--all=ST,RN[,LA]|-A ST,RN[,LA] start unmaps at LBA ST, RN blocks
per unmap until the end of disk, or until
and including LBA LA (last)
--anchor|-a set anchor field in cdb
--dry-run|-d prepare but skip UNMAP call(s)
--force|-f don't ask for confirmation before zapping media
--grpnum=GN|-g GN GN is group number field (def: 0)
--help|-h print out usage message
--in=FILE|-I FILE read LBA, NUM pairs from FILE (if FILE is '-'
then stdin is read)
--lba=LBA,LBA...|-l LBA,LBA... LBA is the logical block address
to start NUM unmaps
--num=NUM,NUM...|-n NUM,NUM... NUM is number of logical blocks to
unmap starting at corresponding LBA
--timeout=TO|-t TO command timeout (unit: seconds) (def: 60)
--verbose|-v increase verbosity
--version|-V print version string and exit
I noticed that cython-sgio has a hard-coded timeout of 1800000 milliseconds (30 minutes). It means that all commands in python-scsi can only use this fixed timeout value, which makes the library quite inflexible for different use cases.
I understand that 1800000 milliseconds probably works well for most modern SCSI devices in normal situations, but there are definitely cases where we need to be able to set this timeout ourselves, like:
sg3_utils has 3 default timeout values for different commands(https://github.com/doug-gilbert/sg3_utils/blob/main/lib/sg_cmds_basic.c#L51-L53), while some commands support to set the timeout in input parameters, like “unmap”: