Re: Fwd: initiator group support in rtslib
by Andy Grover
On 11/26/2014 01:17 AM, Gris Ge wrote:
> On Tue, Nov 25, 2014 at 07:54:50AM -0800, Andy Grover wrote:
>> Hi Gris, saw your irc msg.
>>
>> Fwding an email I sent to targetcli-fb and targetd lists, not sure
>> if you're on those. But yes, I was not going to merge the rtslib
>> changes until we knew that they were what we needed for targetd. It
>> sounds like you're signed up for the targetd work, so please let me
>> know of any bugs you find or API changes to rtslib that would make
>> your work easier.
>>
>> And then once we're happy with both, we can commit to both repos.
>>
>> Thanks! -- Andy
>>
> Hi Andy,
Hi Gris. I'm CCing the lists on my response, just for the sake of having
good technical discussions like this in public.
> These might make targetd life easier:
>
> 1. Change NodeACLGroup._node_acls as a public property.
> # It is require to get a list of group member NodeACL
I did agree, but then changed my mind, based on the below.
> 2. How about let NodeACLGroup.remove_acl() remove mapping status
> also?
> # If not, targetd have to do the mapping removal when remove a
> # initiator(ACL) from a initiator group(NodeACLGroup).
nodeacl.delete() deletes the nodeacl as well as any mappedluns within it.
> # It means targetd will use both initiator mapping and group
> # mapping.
> #
> # I thought the intention of adding NodeACLGroup and MappedLUNGroup is
> # to hide/replace the NodeACL and MappedLUN. Is it?
I wasn't sure, to be honest. How would this work? No methods in
NodeACLGroup or MappedLUNGroup would take or return NodeACLs or
MappedLUNs. This would mean #1 suggestion above should not be done.
NodeACL and MappedLUN are still used internally, but the API can be
*Group classes and wwn strings entirely I think. It could be good.
> #
> # My understanding of initiator group is:
> # * Volume mapping status is maintained at group level.
> # * Initiator in this group just inherit that mapping status.
> # * Initiator add or remove means grant or revoke that inheritance.
>
> 3. It seems we have no quick way to query masked NodeACLGroup for
> given LUN.
> # We have the revert one:
> # nag = NodeACLGroup(tpg, nag_name)
> # nag.mapped_luns()
> #
> # I am expecting something like this:
> # lun = LUN(tpg, lun=<target_lun_id>, storage_object=<st_obj>)
> # lun.mapped_node_acl_groups()
That's not the reverse, nag.mapped_luns gives MappedLUNGroups. The
reverse is MappedLUNGroup.parent_nodeaclgroup. (Should we change
nag.mapped_luns property name to nag.mapped_lun_groups perhaps?)
> 4. NodeACLGroup.add_acl() didn't override old iSCSI CHAP setting.
It doesn't? That's what the "if model.has_feature("auth")" section was
supposed to do. Is that not working right? Or are you referring to
something else that was missed?
OK I'm going to update the dev-groups branch to change the usage model
to be more that users just use Group'd class versions exclusively. I
think just add_acl and remove_acl have to change.
Not tested, sorry. BTW USA workers have Thursday and Friday off so I
won't be around, but if this change is an improvement then we can sync
up on Monday, and if it's not, then we can also sync up on Monday :)
Thanks! -- Regards -- Andy
9 years, 3 months
initiator group support in rtslib
by Andy Grover
Hi all,
I've pushed a "dev-groups" branch to rtslib-fb github, and opened a pull
request:
https://github.com/agrover/rtslib-fb/pull/56
which implements NodeACLGroup and MappedLUNGroup classes. These present
grouped views of the underlying NodeACL and MappedLUN objects.
I've done some unit testing but I'm planning on using adding initiator
group support to targetd to find gaps and usability issues with this new
rtslib code before merging it.
We will also want to switch targetcli from using its own code to support
groups, to using the support in rtslib, but that work need not be done
immediately.
Thanks -- Regards -- Andy
9 years, 5 months
[PATCH] Block.py: New methods: initiators, initiator_create and initiator_delete
by Gris Ge
* New method 'initiators':
Usage: Return a list of iSCSI initiator.
Parameter: NULL
Return: [{'initiator_wwn': initiator_wwn, 'wwn_type': wwn_type},]
* New method 'initiator_create':
Usage: Create a initiators.
Parameter: initiator_wwn # iSCSI IQN
Return: [{'initiator_wwn': initiator_wwn, 'wwn_type': wwn_type},]
* New method 'initiator_delete':
Usage: Delete a initiators along with masking information.
Parameter: initiator_wwn # iSCSI IQN
Return: None
* With these methods, libstoragemgmt can use routine method to do
volume masking:
1. Create access group(for targetd, each initiator is a access group).
2. Mask volume to this new access group.
This can simplify volume mask design of libstoragemgmt as all found storage
array are following above way to do volume masking.
* Tested via libstoragemgmt targetd plugin.
Signed-off-by: Gris Ge <fge(a)redhat.com>
---
targetd/block.py | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/targetd/block.py b/targetd/block.py
index e8206b2..cbcfaee 100644
--- a/targetd/block.py
+++ b/targetd/block.py
@@ -105,6 +105,9 @@ def initialize(config_dict):
export_create=export_create,
export_destroy=export_destroy,
initiator_set_auth=initiator_set_auth,
+ initiators=initiators,
+ initiator_create=initiator_create,
+ initiator_delete=initiator_delete,
)
@@ -277,6 +280,39 @@ def export_destroy(req, pool, vol, initiator_wwn):
RTSRoot().save_to_file()
+def initiators(req):
+ try:
+ fm = FabricModule('iscsi')
+ t = Target(fm, target_name, mode='lookup')
+ tpg = TPG(t, 1, mode='lookup')
+ except RTSLibNotInCFS:
+ return []
+
+ initiators = []
+ for na in tpg.node_acls:
+ initiators.append(
+ dict(initiator_wwn=na.node_wwn, wwn_type=na.wwn_type))
+ return initiators
+
+
+def initiator_create(req, initiator_wwn):
+ fm = FabricModule('iscsi')
+ t = Target(fm, target_name)
+ tpg = TPG(t, 1)
+ na = NodeACL(tpg, initiator_wwn)
+ RTSRoot().save_to_file()
+ return dict(initiator_wwn=na.node_wwn, wwn_type=na.wwn_type)
+
+
+def initiator_delete(req, initiator_wwn):
+ fm = FabricModule('iscsi')
+ t = Target(fm, target_name)
+ tpg = TPG(t, 1)
+ na = NodeACL(tpg, initiator_wwn)
+ na.delete()
+ RTSRoot().save_to_file()
+
+
def initiator_set_auth(req, initiator_wwn, in_user, in_pass, out_user,
out_pass):
fm = FabricModule('iscsi')
--
1.8.3.1
9 years, 5 months