-
Notifications
You must be signed in to change notification settings - Fork 27
Roadmap
Markus Rosjat edited this page Jan 30, 2018
·
6 revisions
-
Removing Dependency between SCSICommand and SCSI / SCSIDevice
- Remove SCSI object from SCSICommand
- done, we now have a scsi object that has methods to create the suported scsi commands
- Move execution from SCSICommand to SCSI object and there with a explizit call to the SCSIDevice execute method
- done, the SCSI object get passed a SCSIDevice object the SCSI wrapper methods call the corresponding methods on the device
- SCSICommand only provides the command related properies and methods
- done
- With these changes it should be possible to write code even without a SCSI instance created. In the end the SCSI class is just a nice little helper that takes care of the following steps
- create a SCSIDevice
- create a SCSICommand
- pass the SCSICommand to the SCSIDevice.execute method
- call the marshall/unmarshall methods of the SCSICommand
- Remove SCSI object from SCSICommand
-
Adding a ContextManager to SCSIDevice
- This is just a small addition to the SCSIDevice class but it enables the use of the with keyword. It also provides a teardown mechanism for closing the filedescriptor create in the init method. In the actual code we never close the file descriptor properly
-
info
- In the branch refactor_device I added context manager logic
- There is also a refactoring for SCSIDevice, I refactored the iscsi code into a seperate module and let the SCSI class figure out if we have a iscsi device or a parallel scsi device. The device classes have context manger logic too so it could be used outside the SCSI class still.
-
Making unmarshall_cdb, marshall_cdb and build_cdb a classmethod of SCSICommand
- After a closer look we see that there is a DRY problem so we should refactor the methods as Baseclass methods
- One solution is to hold a _cdb_bits dict in SCSICommand and override it in the subclasses.
- For build_cdb method we can pass kwargs and build a cdb dict to pass to the marshall_cdb method