open-iscsi / rtslib-fb

Python library for configuring the Linux kernel-based multiprotocol SCSI target (LIO)
Apache License 2.0
73 stars 90 forks source link

code deduplication (LUN) #8

Closed JonnyJD closed 12 years ago

JonnyJD commented 12 years ago

There is loop.LUN and target.LUN.

I see that they are different, but they do share a LOT of code.__init__ is quite similar, _configure , _get_alias,`_get_storage_object are completely the same. Maybe even more, I didn't check.

This needs a single LUN class and LoopLUN and TargetLUN that inherit from it. That LUN class should probably go in tcm.py.

If we don't want to change the API we might keep the class names, but we should still have a super class. I would prefer changing the names, because having two (or 3) different LUN classes in the lib is not optimal.

agrover commented 12 years ago

woah, it doesn't look like anything uses loop.py??

Maybe we can just delete it!

JonnyJD commented 12 years ago

I didn't even check for that, but I was quite confused why there is a different codebase for the loop targets. I just thougth that must be me, missing some understanding of the underlying structure.

But yes, I couldn't find a place either where this was used (in rtslib and targetcli) and a quick test (having a loop target) seems to confirm that just deleting this works quite well.