PiSCSI / piscsi

PiSCSI allows a Raspberry Pi to function as emulated SCSI devices (hard disk, CD-ROM, and others) for vintage SCSI-based computers and devices. This is a fork of the RaSCSI project by GIMONS.
https://piscsi.org
BSD 3-Clause "New" or "Revised" License
535 stars 82 forks source link

Say hello to Streamer (tape) device support #1477

Open bog-dan-ro opened 1 month ago

bog-dan-ro commented 1 month ago

Implements the mandatory and most of the optional commands for tandberd see

https://bitsavers.org/pdf/tandbergData/TDC4100/6047-1_TDC-4100_SCSI-2_Interface_Functional_Specification_Aug1991.pdf for more info.

Fixed #480

I tested this code on my Altos 386 Series 1000. Read, Write, Rewind, ModeSense/Select, etc. operations worked fine.

Also, I didn't used the caching mecanism from Disk as the streamers are sequential and there is no chance to read/write the same block more than once in a very short period of time.

Personally I wanted to use the posix file api, but I thought it might be way too low level ;-)

akuker commented 1 month ago

Thank you for the pull request!! Could you please take a look at the sonarcloud issues that were reported?

rdmark commented 1 month ago

Good stuff! The python linter reports a minor issue. You can fix it automatically by running black. Please see https://github.com/PiSCSI/piscsi/blob/develop/python/README.md#static-analysis-and-formatting

rdmark commented 1 month ago

Also, you have 20 failed python tests, typically indicative of tests needing to be adjusted for the new feature.

bog-dan-ro commented 1 month ago

Also, you have 20 failed python tests, typically indicative of tests needing to be adjusted for the new feature.

Regarding that, there is another issue besides the tests.

The web support for streamer is far from ideal ...:

Sadly my python and HTML skills are closed to zero, I can do small changes by instinct but no more than that. So, if anyone can help in this area, it will be highly appreciated!

bog-dan-ro commented 1 month ago

Thank you for the pull request!! Could you please take a look at the sonarcloud issues that were reported?

I fixed two warnings, and I left one as I'm not going to screw the code readability for this https://sonarcloud.io/project/issues?issues=AZF7JkDXShDQxsHwFJxz&open=AZF7JkDXShDQxsHwFJxz&pullRequest=1477&id=akuker-PISCSI :)

Right now I really don't have time to add unit test for all the new code, so the code coverage will remain as it is.

rdmark commented 1 month ago

I could not managed link the tape files extensions (.tar, .tap) to the SCST (scisi streamer)

The extension mapping is handled in https://github.com/PiSCSI/piscsi/blob/develop/cpp/devices/device_factory.h

The Python client is just a dumb front end in this aspect.

I could not managed to add a list of common tape sizes for uses to create new images

I see that you added the one Tandberg device profile with 250MB image size to device_properties.json. This is the one mechanism we have for providing common image sizes presently. Do you have another mechanism in mind?

After I eject the current streamer file, I can not pick a new one, the drop down combobox is empty.

You need to add a new if block here for the SCST device type: https://github.com/PiSCSI/piscsi/blob/657d22a491a80ed27fd4bf04e3780b00cbf8b3e3/python/web/src/templates/index.html#L101

bog-dan-ro commented 1 month ago

I could not managed link the tape files extensions (.tar, .tap) to the SCST (scisi streamer)

The extension mapping is handled in https://github.com/PiSCSI/piscsi/blob/develop/cpp/devices/device_factory.h

The Python client is just a dumb front end in this aspect.

Done.

I could not managed to add a list of common tape sizes for uses to create new images

I see that you added the one Tandberg device profile with 250MB image size to device_properties.json. This is the one mechanism we have for providing common image sizes presently. Do you have another mechanism in mind?

Nope, it's actually fine as it's very easy for users to add new images without recompiling the cpp bits.

After I eject the current streamer file, I can not pick a new one, the drop down combobox is empty.

You need to add a new if block here for the SCST device type:

https://github.com/PiSCSI/piscsi/blob/657d22a491a80ed27fd4bf04e3780b00cbf8b3e3/python/web/src/templates/index.html#L101

I added an entry also here https://github.com/PiSCSI/piscsi/blob/657d22a491a80ed27fd4bf04e3780b00cbf8b3e3/python/web/src/templates/index.html#L483

Sadly I did all the web changes blindly as I could not test it because docker compose from docker folder didn't worked for me.

Also for the next two week I'll not have a computer near by, so either you'll wait for me to comeback, or please feel free to fix the patch for me.

sonarcloud[bot] commented 1 month ago

Quality Gate Failed Quality Gate failed

Failed conditions
10.8% Coverage on New Code (required ≥ 60%)
13.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

rdmark commented 1 month ago

Did you follow the docker instructions in https://github.com/PiSCSI/piscsi/tree/develop/docker ? What issues did you run into? If there is something that’s broken then I’d like to try fixing it!

bog-dan-ro commented 1 month ago

Did you follow the docker instructions in https://github.com/PiSCSI/piscsi/tree/develop/docker ? What issues did you run into? If there is something that’s broken then I’d like to try fixing it!

Yup, I think I did that. I can see the main page but I can not login with user: pi pass:

rdmark commented 1 month ago

I think the most sure way to get it to work is to define the BACKEND_PASSWORD environment variable with the password of your choice.

bog-dan-ro commented 1 month ago

It didn't work... I'll check it again once I'm back.