Discussion:
[Libstoragemgmt-devel] [PATCH 4/5] ontap.py: Fix calls to Pool constructor
Tony Asleson
2014-08-28 23:13:04 UTC
Permalink
Missing parameter add for unsupported_actions

Signed-off-by: Tony Asleson <***@redhat.com>
---
plugin/ontap/ontap.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py
index dde3dfd..6e18c47 100644
--- a/plugin/ontap/ontap.py
+++ b/plugin/ontap/ontap.py
@@ -414,8 +414,8 @@ class Ontap(IStorageAreaNetwork, INfs):
if pool_name == 'aggr0':
element_type = element_type | Pool.ELEMENT_TYPE_SYS_RESERVED

- return Pool(pool_id, pool_name, element_type, total_space, free_space,
- status, status_info, system_id)
+ return Pool(pool_id, pool_name, element_type, 0, total_space,
+ free_space, status, status_info, system_id)

@staticmethod
def _status_info_of_na_vol(na_vol):
@@ -451,8 +451,8 @@ class Ontap(IStorageAreaNetwork, INfs):
if pool_name == '/vol/vol0':
element_type |= Pool.ELEMENT_TYPE_SYS_RESERVED

- return Pool(pool_id, pool_name, element_type, 0, total_space, free_space,
- status, status_info, system_id)
+ return Pool(pool_id, pool_name, element_type, 0, total_space,
+ free_space, status, status_info, system_id)

@handle_ontap_errors
def capabilities(self, system, flags=0):
--
1.8.2.1
Tony Asleson
2014-08-28 23:13:03 UTC
Permalink
Signed-off-by: Tony Asleson <***@redhat.com>
---
python_binding/lsm/_iplugin.py | 2 +-
tools/lsmcli/cmdline.py | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/python_binding/lsm/_iplugin.py b/python_binding/lsm/_iplugin.py
index 17d99ee..a612ba4 100644
--- a/python_binding/lsm/_iplugin.py
+++ b/python_binding/lsm/_iplugin.py
@@ -17,7 +17,7 @@

from abc import ABCMeta as _ABCMeta
from abc import abstractmethod as _abstractmethod
-from lsm import LsmError, ErrorNumber, Pool
+from lsm import LsmError, ErrorNumber


class IPlugin(object):
diff --git a/tools/lsmcli/cmdline.py b/tools/lsmcli/cmdline.py
index fa90080..f0d282b 100644
--- a/tools/lsmcli/cmdline.py
+++ b/tools/lsmcli/cmdline.py
@@ -39,8 +39,7 @@ from lsm import (Client, Pool, VERSION, LsmError, Disk,

from lsm.lsmcli.data_display import (
DisplayData, PlugData, out,
- vol_provision_str_to_type, vol_rep_type_str_to_type,
- ag_init_type_str_to_lsm)
+ vol_provision_str_to_type, vol_rep_type_str_to_type)


## Wraps the invocation to the command line
--
1.8.2.1
Tony Asleson
2014-08-28 23:13:05 UTC
Permalink
Initialize these variables so users will know they exist before they
get setup in a separate method.

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

diff --git a/tools/lsmcli/cmdline.py b/tools/lsmcli/cmdline.py
index f0d282b..d24f8f3 100644
--- a/tools/lsmcli/cmdline.py
+++ b/tools/lsmcli/cmdline.py
@@ -1360,6 +1360,8 @@ class CmdLine:
def __init__(self):
self.uri = None
self.c = None
+ self.parser = None
+ self.unknown_args = None
self.args = self.cli()

self.cleanup = None
--
1.8.2.1
Tony Asleson
2014-08-28 23:13:02 UTC
Permalink
Signed-off-by: Tony Asleson <***@redhat.com>
---
plugin/ontap/ontap.py | 2 +-
plugin/sim/simarray.py | 70 +++++++++++++++++++++------------------------
plugin/smispy/dmtf.py | 2 --
plugin/smispy/smis.py | 2 ++
python_binding/lsm/_data.py | 7 +++--
tools/lsmcli/cmdline.py | 7 +++--
6 files changed, 43 insertions(+), 47 deletions(-)

diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py
index 02e7a33..dde3dfd 100644
--- a/plugin/ontap/ontap.py
+++ b/plugin/ontap/ontap.py
@@ -203,7 +203,7 @@ class Ontap(IStorageAreaNetwork, INfs):
'EATA': Disk.TYPE_ATA,
'FCAL': Disk.TYPE_FC,
'FSAS': Disk.TYPE_NL_SAS,
- 'LUN': Disk.TYPE_OTHER,
+ 'LUN': Disk.TYPE_OTHER,
'MSATA': Disk.TYPE_SATA,
'SAS': Disk.TYPE_SAS,
'SATA': Disk.TYPE_SATA,
diff --git a/plugin/sim/simarray.py b/plugin/sim/simarray.py
index 1d5f517..0d38e73 100644
--- a/plugin/sim/simarray.py
+++ b/plugin/sim/simarray.py
@@ -610,45 +610,39 @@ class SimData(object):
System.STATUS_OK, '')]
pool_size_200g = size_human_2_size_bytes('200GiB')
self.pool_dict = {
- 'POO1': {
- 'pool_id': 'POO1',
- 'name': 'Pool 1',
- 'member_type': PoolRAID.MEMBER_TYPE_DISK_SATA,
- 'member_ids': [SimData._disk_id(0), SimData._disk_id(1)],
- 'raid_type': PoolRAID.RAID_TYPE_RAID1,
- 'status': SimData.SIM_DATA_POOL_STATUS,
- 'status_info': SimData.SIM_DATA_POOL_STATUS_INFO,
- 'sys_id': SimData.SIM_DATA_SYS_ID,
- 'element_type': SimData.SIM_DATA_SYS_POOL_ELEMENT_TYPE,
- 'unsupported_actions': Pool.UNSUPPORTED_VOLUME_EXPAND | \
- Pool.UNSUPPORTED_VOLUME_SHRINK
- },
- 'POO2': {
- 'pool_id': 'POO2',
- 'name': 'Pool 2',
- 'member_type': PoolRAID.MEMBER_TYPE_POOL,
- 'member_ids': ['POO1'],
- 'member_size': pool_size_200g,
- 'raid_type': PoolRAID.RAID_TYPE_NOT_APPLICABLE,
- 'status': Pool.STATUS_OK,
- 'status_info': SimData.SIM_DATA_POOL_STATUS_INFO,
- 'sys_id': SimData.SIM_DATA_SYS_ID,
- 'element_type': SimData.SIM_DATA_POOL_ELEMENT_TYPE,
- 'unsupported_actions': SimData.SIM_DATA_POOL_UNSUPPORTED_ACTIONS
- },
+ 'POO1': dict(
+ pool_id='POO1', name='Pool 1',
+ member_type=PoolRAID.MEMBER_TYPE_DISK_SATA,
+ member_ids=[SimData._disk_id(0), SimData._disk_id(1)],
+ raid_type=PoolRAID.RAID_TYPE_RAID1,
+ status=SimData.SIM_DATA_POOL_STATUS,
+ status_info=SimData.SIM_DATA_POOL_STATUS_INFO,
+ sys_id=SimData.SIM_DATA_SYS_ID,
+ element_type=SimData.SIM_DATA_SYS_POOL_ELEMENT_TYPE,
+ unsupported_actions=Pool.UNSUPPORTED_VOLUME_EXPAND |
+ Pool.UNSUPPORTED_VOLUME_SHRINK),
+ 'POO2': dict(
+ pool_id='POO2', name='Pool 2',
+ member_type=PoolRAID.MEMBER_TYPE_POOL,
+ member_ids=['POO1'], member_size=pool_size_200g,
+ raid_type=PoolRAID.RAID_TYPE_NOT_APPLICABLE,
+ status=Pool.STATUS_OK,
+ status_info=SimData.SIM_DATA_POOL_STATUS_INFO,
+ sys_id=SimData.SIM_DATA_SYS_ID,
+ element_type=SimData.SIM_DATA_POOL_ELEMENT_TYPE,
+ unsupported_actions=SimData.SIM_DATA_POOL_UNSUPPORTED_ACTIONS),
# lsm_test_aggr pool is required by test/runtest.sh
- 'lsm_test_aggr': {
- 'pool_id': 'lsm_test_aggr',
- 'name': 'lsm_test_aggr',
- 'member_type': PoolRAID.MEMBER_TYPE_DISK_SAS,
- 'member_ids': [SimData._disk_id(2), SimData._disk_id(3)],
- 'raid_type': PoolRAID.RAID_TYPE_RAID0,
- 'status': Pool.STATUS_OK,
- 'status_info': SimData.SIM_DATA_POOL_STATUS_INFO,
- 'sys_id': SimData.SIM_DATA_SYS_ID,
- 'element_type': SimData.SIM_DATA_POOL_ELEMENT_TYPE,
- 'unsupported_actions': SimData.SIM_DATA_POOL_UNSUPPORTED_ACTIONS
- },
+ 'lsm_test_aggr': dict(
+ pool_id='lsm_test_aggr',
+ name='lsm_test_aggr',
+ member_type=PoolRAID.MEMBER_TYPE_DISK_SAS,
+ member_ids=[SimData._disk_id(2), SimData._disk_id(3)],
+ raid_type=PoolRAID.RAID_TYPE_RAID0,
+ status=Pool.STATUS_OK,
+ status_info=SimData.SIM_DATA_POOL_STATUS_INFO,
+ sys_id=SimData.SIM_DATA_SYS_ID,
+ element_type=SimData.SIM_DATA_POOL_ELEMENT_TYPE,
+ unsupported_actions=SimData.SIM_DATA_POOL_UNSUPPORTED_ACTIONS),
}
self.vol_dict = {
}
diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 7c89ba2..c06811d 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -104,7 +104,6 @@ class DMTF(object):
status = unknown_value
return status, " ".join(status_info_list)

-
@staticmethod
def cim_sys_status_of(dmtf_op_status_list):
"""
@@ -154,7 +153,6 @@ class DMTF(object):
DMTF._LSM_DISK_OP_STATUS_CONV, dmtf_op_status_list,
Disk.STATUS_UNKNOWN, Disk.STATUS_OTHER)[0]

-
# CIM_StorageHardwareID['IDType']
ID_TYPE_OTHER = Uint16(1)
ID_TYPE_WWPN = Uint16(2)
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 048de69..6f43c14 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -150,6 +150,7 @@ def _lsm_init_id_to_snia(lsm_init_id):
return lsm_init_id.replace(':', '').upper()
return lsm_init_id

+
def _dmtf_init_type_to_lsm(cim_init):
if 'IDType' in cim_init:
if cim_init['IDType'] == DMTF.ID_TYPE_WWPN:
@@ -184,6 +185,7 @@ def _lsm_init_type_to_dmtf(init_type):
raise LsmError(ErrorNumber.NO_SUPPORT,
"Does not support provided init_type: %d" % init_type)

+
class SNIA(object):
BLK_ROOT_PROFILE = 'Array'
BLK_SRVS_PROFILE = 'Block Services'
diff --git a/python_binding/lsm/_data.py b/python_binding/lsm/_data.py
index 43614b9..3d902f3 100644
--- a/python_binding/lsm/_data.py
+++ b/python_binding/lsm/_data.py
@@ -244,7 +244,7 @@ class Volume(IData):
REPLICATE_CLONE = 2
REPLICATE_COPY = 3
REPLICATE_MIRROR_SYNC = 4
- REPLICATE_MIRROR_ASYNC =5
+ REPLICATE_MIRROR_ASYNC = 5

#Provisioning types
PROVISION_UNKNOWN = -1
@@ -308,7 +308,8 @@ class System(IData):
@default_property('system_id', doc="System identifier")
@default_property("plugin_data", doc="Plug-in private data")
@default_property("element_type", doc="What pool can be used for")
-@default_property("unsupported_actions", doc="What cannot be done with this pool")
+@default_property("unsupported_actions",
+ doc="What cannot be done with this pool")
class Pool(IData):
"""
Pool specific information
@@ -354,7 +355,7 @@ class Pool(IData):
self._id = _id # Identifier
self._name = _name # Human recognisable name
self._element_type = _element_type # What pool can be used to create
- self._unsupported_actions = _unsupported_actions # What pool cannot be
+ self._unsupported_actions = _unsupported_actions # What pool cannot be
# used for
self._total_space = _total_space # Total size
self._free_space = _free_space # Free space available
diff --git a/tools/lsmcli/cmdline.py b/tools/lsmcli/cmdline.py
index 287f7f1..fa90080 100644
--- a/tools/lsmcli/cmdline.py
+++ b/tools/lsmcli/cmdline.py
@@ -91,6 +91,7 @@ def parse_convert_init(init_id):

raise ArgError("--init-id %s is not a valid WWPN or iSCSI IQN" % init_id)

+
## This class represents a command line argument error
class ArgError(Exception):
def __init__(self, message, *args, **kwargs):
@@ -601,8 +602,8 @@ aliases = (
['ld', 'list --type disks'],
['la', 'list --type access_groups'],
['lf', 'list --type fs'],
- ['c', 'capabilities'],
- ['p', 'plugin-info'],
+ ['c', 'capabilities'],
+ ['p', 'plugin-info'],
['vc', 'volume-create'],
['vd', 'volume-delete'],
['vr', 'volume-resize'],
@@ -782,7 +783,7 @@ class CmdLine:

for alias in aliases:
sub_parser = subparsers.add_parser(
- alias[0], help="Alias of '%s'"% alias[1],
+ alias[0], help="Alias of '%s'" % alias[1],
parents=[parent_parser],
formatter_class=RawTextHelpFormatter, add_help=False)
sub_parser.set_defaults(
--
1.8.2.1
Tony Asleson
2014-08-28 23:13:01 UTC
Permalink
Signed-off-by: Tony Asleson <***@redhat.com>
---
plugin/simc/simc_lsmplugin.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/plugin/simc/simc_lsmplugin.c b/plugin/simc/simc_lsmplugin.c
index e2e28da..d0d7170 100644
--- a/plugin/simc/simc_lsmplugin.c
+++ b/plugin/simc/simc_lsmplugin.c
@@ -1085,13 +1085,10 @@ static int access_group_delete( lsm_plugin_ptr c,
const char *id = lsm_access_group_id_get(group);

rc = vol_accessible_by_ag(c, group, &volumes, &count, LSM_CLIENT_FLAG_RSVD);
+ lsm_volume_record_array_free(volumes, count);
+ volumes = NULL;

- if( rc == LSM_ERR_OK && count ) {
- lsm_volume_record_array_free(volumes, count);
- }
-
- if( LSM_ERR_OK == rc ) {
-
+ if( rc == LSM_ERR_OK ) {
if( count ) {
rc = lsm_log_error_basic(c, LSM_ERR_IS_MASKED,
"access group has masked volumes!");
@@ -1236,8 +1233,8 @@ static int volume_mask(lsm_plugin_ptr c,
if( !vol_id ) {
vol_id = strdup(lsm_volume_id_get(volume));
int *val = (int*) malloc(sizeof(int));
- *val = 1;
if( vol_id && val ) {
+ *val = 1;
g_hash_table_insert(grants, vol_id, val);
} else {
rc = LSM_ERR_NO_MEMORY;
@@ -1873,7 +1870,7 @@ static int nfs_auth_types(lsm_plugin_ptr c, lsm_string_list **types,
int rc = LSM_ERR_OK;
*types = lsm_string_list_alloc(1);
if( *types ) {
- lsm_string_list_elem_set(*types, 0, "standard");
+ rc = lsm_string_list_elem_set(*types, 0, "standard");
} else {
rc = LSM_ERR_NO_MEMORY;
}
--
1.8.2.1
Loading...