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
545 stars 82 forks source link

piscsi: Add remote command to relinquish/re-establish bus control #1386

Closed uweseimet closed 1 year ago

uweseimet commented 1 year ago

While piscsi is running, tools like scsidump cannot access the GPIO bus. This is in particular annoying when you have to run systemd commands manually in order to shut down and later restart piscsi when you want to run scsidump.

Adding a remote interface command that tells piscsi to relinquish the bus makes the bus accessible for other tools, especially those running in initiator mode, like scsidump. The piscsi process would not have to be stopped. It is effectively paused, but the remote interface is still active.

This change also paves the way for the web UI to support a convenient usage of scsidump, which is hard to use by an ordinary user. Currently the only way to use it (at least I think so) is on the command line, and only when piscsi is not running. If there was a web interface for scsidump, ordinary users would benefit and could make more use of the PiSCSI functionality already available.

Use case:

  1. The user wants to launch a backup/restore.
  2. She/He tells the web UI what kind of operation shall be executed, and for which device.
  3. The web UI checks whether there are any attached devices. If not it suspends piscsi (without stopping it) by having piscsi relinquish the bus. piscsi might be aware of th enhanced capabilites and would do everything required to launche scsidump automatically. The web UI might ask the user whether all attached devices shall be attached and automatically re-attached later.
  4. The web UI launches scsidump with command line parameters that reflect the kind of backup/restore to be executed.
  5. When done the UI tells piscsi to re-establish bus control.

If possible, piscsi should launch scsidump in the background, so that the process that triggers the backup/restore, e.g. the web UI, does not need to know at all that the new capabilites are not directly executed by piscsi. The client just sends a remote interface command to piscsi just like now, and that's it. piscsi passes the command to scsidump. This would also enable scsidump to be run by an app, for instance.