For efficiency, rtslib may have caches (today for the data
in configfs). A client may need to clear out these caches
such as via the refresh option in targetcli.
* Add new invalidate_caches method to RTSRoot. While this only
has a single cache today, it gives the ability to extend to
any future caches.
* While bs_cache really should be private, it probably
shouldn't be changed given that this is a library and may be
used elsewhere.
Signed-off-by: Amartey Pearson <apearson@us.ibm.com>
Fix crash due to trying to get/set the ALUA group on
passthrough backends. Instead of raising an exception
return None/-1 on failure.
Signed-off-by: Mike Christie <mchristi@redhat.com>
Passthrough backends like pscsi and user do not support ALUA
managment through configfs. You can create groups, but writing
to files can cause the kernel crashes.
This adds a alua_supported method that backends can override
and return False to indicate they do not support ALUA.
Signed-off-by: Mike Christie <mchristi@redhat.com>
For efficiency, rtslib may have caches (today for the data
in configfs). A client may need to clear out these caches
such as via the refresh option in targetcli.
* Add new invalidate_caches method to RTSRoot. While this only
has a single cache today, it gives the ability to extend to
any future caches.
* While bs_cache really should be private, it probably
shouldn't be changed given that this is a library and may be
used elsewhere.
Signed-off-by: Amartey Pearson <apearson@us.ibm.com>
Pass through backends do not support alua_tg_pt_gp and writing to
the file will hang the system. Trying to read from them will
cause a rtslib crash because they are empty. This patch fixes
both issues by detecting the empty file and failing writes.
This patch adds support for creating ALUA groups for storage objects
and setting up their state.
The next patch will add support to map these groups to LUNs.
This patchset does not add support for LU groups and secondary
groups.
Signed-off-by: Mike Christie <mchristi@redhat.com>
Adds support for the IBM PowerVM virtual SCSI fabric. This uses the
ibmvscsis kernel module that merged in 4.8 and later kernels.
Signed-off-by: Steven Royer <seroyer@us.ibm.com>
In v2.1.fb60 an unconditional dependency to pyudev was added,
which needs to be specified in the egg info, otherwise pip install might fail with e.g.
File "local/lib/python2.7/site-packages/rtslib/utils.py", line 30, in <module>
import pyudev
ImportError: No module named pyudev
Remove the "example-debian" and "example-rpm" directories because our
in-repo packaging is less complete than the packaging made by
distributions.
Finally, this patch adds a few links to RPM and Debian build scripts in
our README.md.
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
Just like the 'iser' value within np/, save and restore the 'cxgbit' value.
However, the property is called 'offload'. This will let us handle other
offloads with the same property in the future if and when they are
supported.
Signed-off-by: Andy Grover <agrover@redhat.com>
Do not check for type=disk, this is not a requirement.
Raise an RTSLibError if not found, rather than returning None.
Rework PSCSIStorageObject._configure to use the new semantics, and avoid
else clauses in try blocks, since they are confusing and not strictly
needed.
Properly qualify DeviceNotFoundError as pyudev.DeviceNotFoundError.
Signed-off-by: Andy Grover <agrover@redhat.com>
Attempt to do the thing that would require the module first, and if it
fails then attempt to load the module and retry. This should handle all
combinations of modules, compiled-in etc. and return an error if a needed
component is neither compiled in or as a module.
Fixes #64
Signed-off-by: Andy Grover <agrover@redhat.com>
On systems where loading the configfs module (modprobe configfs) automatically mounts /sys/kernel/config, a race condition can occur in the mount_configfs() function in utils.py.
As that function is called immediately after the modprode function, the os.path.ismount check can be called before configfs is finished mounting. The mount command is then run but fails because the mount is busy as it's mounted.
One possible workaround is to make a second os.path.ismount check if the mount command fails, and if it is mounted then we don't raise an exception.
if process.returncode != 0 and not os.path.ismount("/sys/kernel/config"):
raise RTSLibError("Cannot mount configfs")
parse_fileio was a cut-n-paste from block, missing key attributes like
size and buffered. Fixed.
Also, bodge up better handling for single vs multiple tpgs. Clarify
referring to tpgs versus the tpg tag (tpgt, an integer).
Signed-off-by: Andy Grover <agrover@redhat.com>
This script attempts to convert from Datera 3.0's scsi_target.lio format
to rtslib-fb's json format. It currently is not fully parsing the .lio
file according to its grammar, it's kind of ad-hoc, shall we say, so that
it hopefully works on most existing .lio files.
Signed-off-by: Andy Grover <agrover@redhat.com>
Return None if device path is a partition in convert_scsi_path_to_hctl.
In convert_scsi_hctl_to_path ensure that device is not a partition in the
most correct and efficient way. Get exactly the set of devices that are
descendants of the scsi device and are block devices and have type disk.
This should be a singleton, or the empty set.
Signed-off-by: mulhern <amulhern@redhat.com>
Better, because it is sure to find the scsi parent.
You never know what intermediate parent might get interposed.
Better, becaus it does not rely on subsystem property
(which sometimes raises an AttributeError (fixed in pyudev 0.19)).
Signed-off-by: mulhern <amulhern@redhat.com>