Re: Linux Virtual SCSI HBAs and Virtual disks

Aboo Valappil
2007-01-25T21:42:17Z

Hi Doug Gilbert,

I am not sure if my previous email was received or not.
> # ./start_target.sh id=3 -files ../../zz_lun0 -v
> # lsscsi
> [0:0:0:0] disk Linux scsi_debug 0004 /dev/sda
> [1:0:0:0] disk VirtualH VHD 0 /dev/sdb
>
> So "id=3" doesn't look the target identifier. If not, what
> is it?
>
>

Actually it is not the target number, it can have only one target. This
is just an identification for the scsi_host created inside the kernel.
If you re-run the same command again with same id, the new process would
attach to the same scsi_host. This can be seen as two user process
serving the same virtual host bus adapter. If use a different id with
the same lun file, It will create a new scsi_host and it would appear as
the same LUN on a different host bus adapter.

> Perhaps you could examine the way scsi_debug (or most
> other LLDs) does autosense. This modern technique (used
> for about the last 12 years) relieves the scsi midlevel
> of having to send a follow up REQUEST SENSE.
>
What would i do if the SCSI target does not return any sense code? I
make some thing up or just return no-sense? In the new version, I made
up SK="Illegal request", ASC="Invalid Opcode" if I do not receive any
sense from target. But I think I should return no sense, ie SK=0,
ASC=0, ASCQ=0. Any thoughts?
> It would be easier to read those SCSI commands in the
> debug output if they were trimmed to their actual lengths
> (e.g. the INQUIRY is 12 00 00 00 24 00).
>
I will fix this.

Aboo