Merge pull request #44 from cvubrugier/master

For partitions, retrieve the logical block size of the parent device
Update version to 2.1.fb43

Signed-off-by: Andy Grover <agrover@redhat.com>
Improve performance when adding many backstores

The old cache code was effective for lookups, but each cache miss caused
the cache to be regenerated by reading the filesystem. This causes O(n^2)
creation times.

Now, only fetch the cache once, then keep bs_cache updated.

Signed-off-by: Andy Grover <agrover@redhat.com>
Increase MAX_LUN to 16383

255 is too low. rtslib should be ready if the kernel lun-per-tpg limit
is raised.

Signed-off-by: Andy Grover <agrover@redhat.com>
str.replace() is not the same as str.translate()

If we want to remove both : and -, then we can futz around with translate
or we can just call replace() twice.

Signed-off-by: Andy Grover <agrover@redhat.com>
Fix fcoe from_fabric_wwn

Add comment for from_fabric_wwn to attempt to explain where all the
issues are coming from.

from_fabric_wwn is to convert tcm_fc wwn format to canonical. What's in
/sys/class/fc_host/.. is a different format and should be converted
to canonical separately.

Signed-off-by: Andy Grover <agrover@redhat.com>
Don't call from_fabric_wwn from wwns()

from_fabric_wwn and wwns() do two slightly different things, and it's
better if we keep them separate. from/to_fabric_wwn() convert our
canonical wwn format from/to the format the fabric in configfs expects.
wwns() reads from somewhere else to get a list of wwns. The format of
WWNs may not be the same as what the fabric uses, and it should convert
whatever it reads to canonical format without referencing what the
fabric's WWN format is.

I really hope this is the last ever commit on this stupid cesspool of
my own making.

Signed-off-by: Andy Grover <agrover@redhat.com>
WWNs are case-insensitive

Convert all incoming WWNs to lowercase for comparison.

Signed-off-by: Andy Grover <agrover@redhat.com>
update version to 2.1.fb44

Signed-off-by: Andy Grover <agrover@redhat.com>
Fix some typos in reprs

NetworkPortal and LUN both missing '>'s at the end.

Signed-off-by: Andy Grover <agrover@redhat.com>
Add a tutorial for rtslib use

Add a walkthrough that demonstrates how to get started using rtslib.

Signed-off-by: Andy Grover <agrover@redhat.com>
Merge pull request #47 from agrover/walkthrough

Add a walkthrough for rtslib use
Add support for RTSRoot().mapped_luns

Added for completeness.

Signed-off-by: Andy Grover <agrover@redhat.com>
Make setup() err_funcs return more info from exceptions

Instead of just saying there was an error, also include the string text
from the RTSLibError exception.

Signed-off-by: Andy Grover <agrover@redhat.com>
Do not check WWN is present in normalize_wwn

For tcm_fc and maybe others, it should be possible to configure a target
for a hw-based WWN before the WWN shows up in the list of WWNs. The kernel
code allows and handles this case.

The only downside is that a user might have a typo in entering a hw wwn by
hand, and experience confusion when it is allowed but things don't work
right. Clients may wish to warn the user if so.

Signed-off-by: Andy Grover <agrover@redhat.com>
Remove 3rd argument to normalize_wwn

possible_wwns is no longer used by any callers.

Signed-off-by: Andy Grover <agrover@redhat.com>
Use to_normalized_wwn in _set_nexus

We can now use to_normalized_wwn, since it no longer checks against
wwn_list.

Signed-off-by: Andy Grover <agrover@redhat.com>
update version to 2.1.fb45

Signed-off-by: Andy Grover <agrover@redhat.com>
Improve error message when NetworkPortal restore fails

Also print the original exception message.

Signed-off-by: Andy Grover <agrover@redhat.com>
targetctl: A missing restore file is not an error

Also, fix whitespace.

Signed-off-by: Andy Grover <agrover@redhat.com>