change spec_dir to /var/lib/target

Signed-off-by: Andy Grover <agrover@redhat.com>
Use python-ethtool instead of python-netifaces

Signed-off-by: Andy Grover <agrover@redhat.com>
Remove support for RD_DR backstore & storage objects

They are no longer supported in LIO.

Signed-off-by: Andy Grover <agrover@redhat.com>
Change gen_wwn parameter to wwn

Change sense of gen_wwn parameter to wwn -- before gen_wwn was
a boolean, and we generated a WWN if it was true. Now, wwn is the
WWN for the storageobject, and if it is None, then we generate one.

Signed-off-by: Andy Grover <agrover@redhat.com>
Change 'mode' attribute to 'buffered_mode'

Instead of returning 'buffered' or 'synchronous', returns True if
buffered, else False. This helps it line up better with the buffered_mode
param to the FileIOStorageObject ctor.

Signed-off-by: Andy Grover <agrover@redhat.com>
Remove duplicate plugin property

One "feature" of Python is that it lets you redeclare functions in
the same scope. Pretty sure this was unintentional, here.

Signed-off-by: Andy Grover <agrover@redhat.com>
Move consecutive number generation/checking from targetcli to rtslib

This lets other users of rtslib (notably the save/restore code) take
advantage of the code.

Signed-off-by: Andy Grover <agrover@redhat.com>
Change IBlockBackstore's name to 'block' from 'iblock'

Although the underlying CFS node is still iblock, we can change the
plugin name string such that the cmdline and save/restore refer to the
backstore as 'block'. This should be less confusing for users, since
nobody knows what the 'i' stands for. :)

Signed-off-by: Andy Grover <agrover@redhat.com>
Rename IBlockBackstore and IBlockStorageObject

Signed-off-by: Andy Grover <agrover@redhat.com>
Implement save/restore for backstores and fabrics

As discussed on the list, this adds save and restore commands to the root.
When saving, the object hierarchy generates a dict of its state via dump()
methods, which is saved to a file.

The restore command reads in a saved file and reconstitutes the objects
based on it.

Signed-off-by: Andy Grover <agrover@redhat.com>
Update README for free-branch

Signed-off-by: Andy Grover <agrover@redhat.com>
Add docs. Add clear_existing()

Signed-off-by: Andy Grover <agrover@redhat.com>
Rename convert_human_to_bytes(). Add bytes_to_human()

x_to_y already connotes conversion, so omit the "convert_" prefix for
brevity.

Add a corresponding bytes_to_human(), which targetcli uses.

Signed-off-by: Andy Grover <agrover@redhat.com>
Clean up deleted backstores properly

Cleaning up backstores instead of storage objects ensures that configfs
doesn't get cluttered with no-so backstores.

Signed-off-by: Andy Grover <agrover@redhat.com>
Remove get_main_ip and list_eth_names from utils

There is no need to get the "main" ip to establish a portal, so targetcli
no longer calls get_main_ip. list_eth_names() is also unused, so remove
it.

Signed-off-by: Andy Grover <agrover@redhat.com>
Properties return generators instead of lists

Remove flattern_nested_list() and gen_list_item()

The things that needed flatten_nested_list are more suited to using
generators directly, rather than indirectly via gen_list_item. There are
a few instances where the code really *does* want a list instead of an
iterator, so some callsite changes were also needed.

Signed-off-by: Andy Grover <agrover@redhat.com>
Return "rtslib" instead of "rtsadmin" from RTSRoot.__str__

I have no idea if this is used anywhere, but it seems like the right
thing to do.

Signed-off-by: Andy Grover <agrover@redhat.com>
Do not generate WWNs for fabrics that need specified WWNs

Some fabrics need WWNs to match with hardware values, and therefore
cannot be generated.

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

"if not self" should never be true, and this the is_valid_wwn check
was never taking place.

Signed-off-by: Andy Grover <agrover@redhat.com>
add save/restore support for FabricModules

Fabric modules track discovery auth settings. These need to be persisted.

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