Discussion:
[Libstoragemgmt-devel] [PATCH 0/3] Use lsm.System instead of system_id in access_group_create()
Gris Ge
2014-07-24 12:20:39 UTC
Permalink
Patch set based on these patch sets:
[PATCH 1/3] nstor: Remove commented out non-existant constant
[PATCH 1/4] Python library: Better error numbers to indicate bugs


Gris Ge (3):
Python library: Use lsm.System instead of system_id in
access_group_create()
lsmcli: Use lsm.System instead of system_id in access_group_create()
Plugins: Use lsm.System instead of system_id in access_group_create()

plugin/nstor/nstor.py | 8 ++++----
plugin/ontap/ontap.py | 5 ++++-
plugin/sim/simulator.py | 4 ++--
python_binding/lsm/_client.py | 4 ++--
python_binding/lsm/_iplugin.py | 2 +-
tools/lsmcli/cmdline.py | 3 ++-
6 files changed, 15 insertions(+), 11 deletions(-)
--
1.8.3.1
Gris Ge
2014-07-24 12:20:40 UTC
Permalink
Use lsm.System instead of system_id in access_group_create().
Just be the same with volume_create().

Signed-off-by: Gris Ge <***@redhat.com>
---
python_binding/lsm/_client.py | 4 ++--
python_binding/lsm/_iplugin.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/python_binding/lsm/_client.py b/python_binding/lsm/_client.py
index 7a8f4fd..61a7aa2 100644
--- a/python_binding/lsm/_client.py
+++ b/python_binding/lsm/_client.py
@@ -642,11 +642,11 @@ class Client(INetworkAttachedStorage):
# @param name The initiator group name
# @param init_id Initiator id
# @param init_type Type of initiator (Enumeration)
- # @param system_id Which system to create this group on
+ # @param system Which system to create this group on
# @param flags Reserved for future use, must be zero.
# @returns AccessGroup on success, else raises LsmError
@_return_requires(AccessGroup)
- def access_group_create(self, name, init_id, init_type, system_id,
+ def access_group_create(self, name, init_id, init_type, system,
flags=0):
"""
Creates an access group and add the specified initiator id,
diff --git a/python_binding/lsm/_iplugin.py b/python_binding/lsm/_iplugin.py
index 9e0af9e..e1f7d4c 100644
--- a/python_binding/lsm/_iplugin.py
+++ b/python_binding/lsm/_iplugin.py
@@ -286,7 +286,7 @@ class IStorageAreaNetwork(IPlugin):
"""
raise LsmError(ErrorNumber.NO_SUPPORT, "Not supported")

- def access_group_create(self, name, init_id, init_type, system_id,
+ def access_group_create(self, name, init_id, init_type, system,
flags=0):
"""
Returns a list of access groups, raises LsmError on errors.
--
1.8.3.1
Gris Ge
2014-07-24 12:20:41 UTC
Permalink
Use lsm.System instead of system_id in access_group_create().

Signed-off-by: Gris Ge <***@redhat.com>
---
tools/lsmcli/cmdline.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/lsmcli/cmdline.py b/tools/lsmcli/cmdline.py
index 58c7f5d..4e6be67 100644
--- a/tools/lsmcli/cmdline.py
+++ b/tools/lsmcli/cmdline.py
@@ -949,8 +949,9 @@ class CmdLine:
## Creates an access group.
def access_group_create(self, args):
init_type = ag_init_type_str_to_lsm(args.init_type)
+ sys = _get_item(self.c.systems(), args.sys, "system id")
access_group = self.c.access_group_create(args.name, args.init,
- init_type, args.sys)
+ init_type, sys)
self.display_data([access_group])

def _add_rm_access_grp_init(self, args, op):
--
1.8.3.1
Gris Ge
2014-07-24 12:20:42 UTC
Permalink
Updated this plugins for access_group_create() changes of system_id:

nstor
ontap
sim

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/nstor/nstor.py | 8 ++++----
plugin/ontap/ontap.py | 5 ++++-
plugin/sim/simulator.py | 4 ++--
3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/plugin/nstor/nstor.py b/plugin/nstor/nstor.py
index 7ce9d73..c008d55 100644
--- a/plugin/nstor/nstor.py
+++ b/plugin/nstor/nstor.py
@@ -696,14 +696,14 @@ class NexentaStor(INfs, IStorageAreaNetwork):
return search_property(ag_list, search_key, search_value)

@handle_nstor_errors
- def access_group_create(self, name, init_id, init_type, system_id,
+ def access_group_create(self, name, init_id, init_type, system,
flags=0):
"""
Creates of access group
"""
- if system_id != self.system.id:
+ if system.id != self.system.id:
raise LsmError(ErrorNumber.NOT_FOUND_SYSTEM,
- "System %s not found" % system_id)
+ "System %s not found" % system.id)
if init_type != AccessGroup.INIT_TYPE_ISCSI_IQN:
raise LsmError(ErrorNumber.NO_SUPPORT,
"Nstor only support iSCSI Access Group")
@@ -716,7 +716,7 @@ class NexentaStor(INfs, IStorageAreaNetwork):
self._request("create_hostgroup", "stmf", [name])
self._add_initiator(name, init_id)

- return AccessGroup(name, name, [init_id], init_type, system_id)
+ return AccessGroup(name, name, [init_id], init_type, system.id)

@handle_nstor_errors
def access_group_delete(self, access_group, flags=0):
diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py
index bf5159c..b490e78 100644
--- a/plugin/ontap/ontap.py
+++ b/plugin/ontap/ontap.py
@@ -705,8 +705,11 @@ class Ontap(IStorageAreaNetwork, INfs):
[self._access_group(g) for g in groups], search_key, search_value)

@handle_ontap_errors
- def access_group_create(self, name, init_id, init_type, system_id,
+ def access_group_create(self, name, init_id, init_type, system,
flags=0):
+ if self.sys_info.id != system.id:
+ raise LsmError(ErrorNumber.NOT_FOUND_SYSTEM,
+ "System %s not found" % system.id)
cur_groups = self.access_groups()
for cg in cur_groups:
if cg.name == name:
diff --git a/plugin/sim/simulator.py b/plugin/sim/simulator.py
index bdcf24c..f6c26de 100644
--- a/plugin/sim/simulator.py
+++ b/plugin/sim/simulator.py
@@ -178,10 +178,10 @@ class SimPlugin(INfs, IStorageAreaNetwork):
[SimPlugin._sim_data_2_lsm(a) for a in sim_ags],
search_key, search_value)

- def access_group_create(self, name, init_id, init_type, system_id,
+ def access_group_create(self, name, init_id, init_type, system,
flags=0):
sim_ag = self.sim_array.access_group_create(
- name, init_id, init_type, system_id, flags)
+ name, init_id, init_type, system.id, flags)
return SimPlugin._sim_data_2_lsm(sim_ag)

def access_group_delete(self, access_group, flags=0):
--
1.8.3.1
Tony Asleson
2014-07-24 21:05:17 UTC
Permalink
Patch series committed.

Thanks,
Tony
Post by Gris Ge
[PATCH 1/3] nstor: Remove commented out non-existant constant
[PATCH 1/4] Python library: Better error numbers to indicate bugs
Python library: Use lsm.System instead of system_id in
access_group_create()
lsmcli: Use lsm.System instead of system_id in access_group_create()
Plugins: Use lsm.System instead of system_id in access_group_create()
plugin/nstor/nstor.py | 8 ++++----
plugin/ontap/ontap.py | 5 ++++-
plugin/sim/simulator.py | 4 ++--
python_binding/lsm/_client.py | 4 ++--
python_binding/lsm/_iplugin.py | 2 +-
tools/lsmcli/cmdline.py | 3 ++-
6 files changed, 15 insertions(+), 11 deletions(-)
Loading...