Discussion:
[Libstoragemgmt-devel] [PATCH 00/15] Merge smis_constants.py into dmtf.py and smis_common.py
Gris Ge
2014-10-09 07:28:32 UTC
Permalink
* Remove smis_constants.py by moving its constants to:
1. dmtf.py: DMTF CIM/WBEM constants
2. smis_common.py: SNIA constants, plugin internal constants and misc.

This patch set is based on these patchset:

[PATCH 0/7] SMI-S plugin refactor (squashed commits)
[PATCH 1/4] Fix mem leaks in lsm_daemon.c, simc_lsmplugin.c

Gris Ge (15):
SMI-S Plugin: Move job state constants to dmtf.py
SMI-S Plugin: Replace JOB_XX with dmtf.OP_STATUS_XXX
SMI-S Plugin: Move InvokeMethod() return code to SmisCommon
SMI-S Plugin: Remove unused method: _get_supported_sync_and_mode()
SMI-S Plugin: Move cim_vol VPD83 constants to dmtf.py
SMI-S Plugin: Move JOB_RETRIEVE_XXX into SmisCommon
SMI-S Plugin: Move WBEM port number constants to SmisCommon
SMI-S Plugin: Fix Capabilities.VOLUME_REPLICATE
SMI-S Plugin: Remove smis_constants.RepSvc class
SMI-S Plugin: Remove smis_constants.CopyStates class
SMI-S Plugin: Move smis_constants.CopyTypes to dmtf.py
SMI-S Plugin: Remove smis_constants.Synchronized class
SMI-S Plugin: Remove unused constants of smis_constants.py
SMI-S Plugin: Replace smis_constants.EXPOSE_PATHS_DA_READ_WRITE
SMI-S Plugin: Remove smis_constants.py

packaging/libstoragemgmt.spec.in | 1 -
plugin/Makefile.am | 1 -
plugin/smispy/dmtf.py | 46 +++++++++++
plugin/smispy/smis.py | 165 +++++++++++++-------------------------
plugin/smispy/smis_cap.py | 38 +++------
plugin/smispy/smis_common.py | 17 ++++
plugin/smispy/smis_constants.py | 131 ------------------------------
7 files changed, 132 insertions(+), 267 deletions(-)
delete mode 100644 plugin/smispy/smis_constants.py
Gris Ge
2014-10-09 07:28:33 UTC
Permalink
* Move smis_constants.JS_XXX to dmtf.py:
smis_constants.JS_NEW -> dmtf.JOB_STATE_NEW
smis_constants.JS_STARTING -> dmtf.JOB_STATE_STARTING
smis_constants.JS_RUNNING -> dmtf.JOB_STATE_RUNNING
smis_constants.JS_COMPLETED -> dmtf.JOB_STATE_COMPLETED

* Removed unused smis_constants.JS_XXX constatns:
smis_constants.JS_SUSPENDED
smis_constants.JS_SHUTTING_DOWN
smis_constants.JS_TERMINATED
smis_constants.JS_KILLED
smis_constants.JS_EXCEPTION

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 8 ++++++++
plugin/smispy/smis.py | 11 ++++++-----
plugin/smispy/smis_constants.py | 5 -----
3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 18a8a8f..39f4942 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -155,6 +155,7 @@ _OP_STATUS_STR_CONV = {
OP_STATUS_POWER_MODE: "POWER_MODE",
}

+
def _op_status_to_str(dmtf_op_status):
"""
Just convert integer to string. NOT ALLOWING provide a list.
@@ -165,6 +166,7 @@ def _op_status_to_str(dmtf_op_status):
except KeyError:
return ''

+
def op_status_list_conv(conv_dict, dmtf_op_status_list,
unknown_value, other_value):
status = 0
@@ -180,3 +182,9 @@ def op_status_list_conv(conv_dict, dmtf_op_status_list,
if status == 0:
status = unknown_value
return status, " ".join(status_info_list)
+
+# CIM_ConcreteJob['JobState']
+JOB_STATE_NEW = 2
+JOB_STATE_STARTING = 3
+JOB_STATE_RUNNING = 4
+JOB_STATE_COMPLETED = 7
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 2cee221..beab30e 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -325,7 +325,8 @@ class Smis(IStorageAreaNetwork):

job_state = cim_job['JobState']

- if job_state in (JS_NEW, JS_STARTING, JS_RUNNING):
+ if job_state in (dmtf.JOB_STATE_NEW, dmtf.JOB_STATE_STARTING,
+ dmtf.JOB_STATE_RUNNING):
status = JobStatus.INPROGRESS

pc = cim_job['PercentComplete']
@@ -334,7 +335,7 @@ class Smis(IStorageAreaNetwork):
else:
percent_complete = pc

- elif job_state == JS_COMPLETED:
+ elif job_state == dmtf.JOB_STATE_COMPLETED:
status = JobStatus.COMPLETE
percent_complete = 100

@@ -2538,12 +2539,12 @@ class Smis(IStorageAreaNetwork):
PropertyList=job_pros,
LocalOnly=False)
job_state = cim_job['JobState']
- if job_state in (JS_NEW, JS_STARTING,
- JS_RUNNING):
+ if job_state in (dmtf.JOB_STATE_NEW, dmtf.JOB_STATE_STARTING,
+ dmtf.JOB_STATE_RUNNING):
loop_counter += 1
time.sleep(Smis._INVOKE_CHECK_INTERVAL)
continue
- elif job_state == JS_COMPLETED:
+ elif job_state == dmtf.JOB_STATE_COMPLETED:
if expect_class is None:
return None
cim_xxxs_path = self._c.AssociatorNames(
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 2df9144..97268c6 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,11 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

- # SMI-S job 'JobState' enumerations
-(JS_NEW, JS_STARTING, JS_RUNNING, JS_SUSPENDED, JS_SHUTTING_DOWN,
- JS_COMPLETED,
- JS_TERMINATED, JS_KILLED, JS_EXCEPTION) = (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
# SMI-S job 'OperationalStatus' enumerations
(JOB_OK, JOB_ERROR, JOB_STOPPED, JOB_COMPLETE) = (2, 6, 10, 17)
--
1.7.1
Gris Ge
2014-10-09 07:28:34 UTC
Permalink
* Replace these constants:
smis_constants.JOB_OK => dmtf.OP_STATUS_OK
smis_constants.JOB_COMPLETE => dmtf.OP_STATUS_COMPLETED

* Removed Unused constants:
smis_constants.JOB_ERROR
smis_constants.JOB_STOPPED

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis.py | 6 ++++--
plugin/smispy/smis_constants.py | 3 ---
2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index beab30e..7484b24 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -303,8 +303,10 @@ class Smis(IStorageAreaNetwork):
op = status['OperationalStatus']

if (len(op) > 1 and
- ((op[0] == JOB_OK and op[1] == JOB_COMPLETE) or
- (op[0] == JOB_COMPLETE and op[1] == JOB_OK))):
+ ((op[0] == dmtf.OP_STATUS_OK and
+ op[1] == dmtf.OP_STATUS_COMPLETED) or
+ (op[0] == dmtf.OP_STATUS_COMPLETED and
+ op[1] == dmtf.OP_STATUS_OK))):
rc = True

return rc
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 97268c6..7af4832 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,9 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-# SMI-S job 'OperationalStatus' enumerations
-(JOB_OK, JOB_ERROR, JOB_STOPPED, JOB_COMPLETE) = (2, 6, 10, 17)
-
# SMI-S invoke return values we are interested in
# Reference: Page 54 in 1.5 SMI-S block specification
(INVOKE_OK,
--
1.7.1
Gris Ge
2014-10-09 07:28:35 UTC
Permalink
* Move these InvokeMethod() return code to SmisCommon:
smis_constants.INVOKE_OK => SmisCommon.SNIA_INVOKE_OK
smis_constants.INVOKE_ASYNC => SmisCommon.SNIA_INVOKE_ASYNC
smis_constants.INVOKE_NOT_SUPPORTED =>
SmisCommon.SNIA_INVOKE_NOT_SUPPORTED
smis_constants.INVOKE_FAILED => SmisCommon.SNIA_INVOKE_FAILED

* Removed these InvokeMethod() return code as unused:
smis_constants.INVOKE_TIMEOUT
smis_constants.INVOKE_FAILED
smis_constants.INVOKE_INVALID_PARAMETER
smis_constants.INVOKE_IN_USE
smis_constants.INVOKE_SIZE_NOT_SUPPORTED

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis.py | 19 ++++++++++---------
plugin/smispy/smis_common.py | 11 +++++++++++
plugin/smispy/smis_constants.py | 11 -----------
3 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 7484b24..56c3ca1 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -180,17 +180,17 @@ class Smis(IStorageAreaNetwork):
Handle the the process of invoking an operation.
"""
# Check to see if operation is done
- if rc == INVOKE_OK:
+ if rc == SmisCommon.SNIA_INVOKE_OK:
if retrieve_data == JOB_RETRIEVE_VOLUME:
return None, self._new_vol_from_name(out)
else:
return None, None

- elif rc == INVOKE_ASYNC:
+ elif rc == SmisCommon.SNIA_INVOKE_ASYNC:
# We have an async operation
job_id = self._job_id(out['Job'], retrieve_data)
return job_id, None
- elif rc == INVOKE_NOT_SUPPORTED:
+ elif rc == SmisCommon.SNIA_INVOKE_NOT_SUPPORTED:
raise LsmError(
ErrorNumber.NO_SUPPORT,
'SMI-S error code indicates operation not supported')
@@ -1201,7 +1201,7 @@ class Smis(IStorageAreaNetwork):

def _cim_dev_mg_path_create(self, cim_gmm_path, name, cim_vol_path,
vol_id):
- rc = INVOKE_FAILED
+ rc = SmisCommon.SNIA_INVOKE_FAILED
out = None

in_params = {
@@ -1236,7 +1236,7 @@ class Smis(IStorageAreaNetwork):
we will mask to all target ports.
Return CIMInstanceName of CIM_TargetMaskingGroup
"""
- rc = INVOKE_FAILED
+ rc = SmisCommon.SNIA_INVOKE_FAILED
out = None

in_params = {
@@ -2509,13 +2509,14 @@ class Smis(IStorageAreaNetwork):
def _wait_invoke(self, rc, out, out_key=None, expect_class=None,
flag_out_array=False,):
"""
- Return out[out_key] if found rc == INVOKE_OK.
- For rc == INVOKE_ASYNC, we check every Smis.INVOKE_CHECK_INTERVAL
+ Return out[out_key] if found rc == SmisCommon.SNIA_INVOKE_OK.
+ For rc == SmisCommon.SNIA_INVOKE_ASYNC, we check every
+ Smis._INVOKE_CHECK_INTERVAL
seconds until done. Then return association via CIM_AffectedJobElement
Return CIM_InstanceName
Assuming only one CIM_InstanceName will get.
"""
- if rc == INVOKE_OK:
+ if rc == SmisCommon.SNIA_INVOKE_OK:
if out_key is None:
return None
if out_key in out:
@@ -2530,7 +2531,7 @@ class Smis(IStorageAreaNetwork):
raise LsmError(ErrorNumber.PLUGIN_BUG,
"_wait_invoke(), %s not exist in out %s" %
(out_key, out.items()))
- elif rc == INVOKE_ASYNC:
+ elif rc == SmisCommon.SNIA_INVOKE_ASYNC:
cim_job_path = out['Job']
loop_counter = 0
job_pros = ['JobState', 'PercentComplete', 'ErrorDescription',
diff --git a/plugin/smispy/smis_common.py b/plugin/smispy/smis_common.py
index e497b29..059d838 100644
--- a/plugin/smispy/smis_common.py
+++ b/plugin/smispy/smis_common.py
@@ -142,6 +142,17 @@ def _profile_spec_ver_to_num(spec_ver_str):


class SmisCommon(object):
+ # Even many CIM_XXX_Service in DMTF shared the same return value
+ # defination as SNIA do, but there is no DMTF standard metioned
+ # InvokeMethod() should follow that list of return value.
+ # We use SNIA defination here.
+ # SNIA 1.6 rev4 Block book, BSP 5.5.3.12 Return Values section.
+ SNIA_INVOKE_OK = 0
+ SNIA_INVOKE_NOT_SUPPORTED = 1
+ SNIA_INVOKE_FAILED = 4
+ SNIA_INVOKE_ASYNC = 4096
+
+
SNIA_BLK_ROOT_PROFILE = 'Array'
SNIA_BLK_SRVS_PROFILE = 'Block Services'
SNIA_DISK_LITE_PROFILE = 'Disk Drive Lite'
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 7af4832..6b5630f 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,17 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-# SMI-S invoke return values we are interested in
-# Reference: Page 54 in 1.5 SMI-S block specification
-(INVOKE_OK,
- INVOKE_NOT_SUPPORTED,
- INVOKE_TIMEOUT,
- INVOKE_FAILED,
- INVOKE_INVALID_PARAMETER,
- INVOKE_IN_USE,
- INVOKE_ASYNC,
- INVOKE_SIZE_NOT_SUPPORTED) = (0, 1, 3, 4, 5, 6, 4096, 4097)
-
# SMI-S replication enumerations
(SYNC_TYPE_MIRROR, SYNC_TYPE_SNAPSHOT, SYNC_TYPE_CLONE) = (6, 7, 8)
--
1.7.1
Gris Ge
2014-10-09 07:28:36 UTC
Permalink
* Remove Smis._get_supported_sync_and_mode() which
is unused as it's return value has been ignored by volume_replicate().

* Remove these constants used by Smis._get_supported_sync_and_mode():
smis_constants.SYNC_TYPE_MIRROR
smis_constants.SYNC_TYPE_SNAPSHOT
smis_constants.SYNC_TYPE_CLONE

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis.py | 55 -------------------------------------------------
1 files changed, 0 insertions(+), 55 deletions(-)

diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 56c3ca1..ca92608 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1078,57 +1078,6 @@ class Smis(IStorageAreaNetwork):
'CreateOrModifyElementFromStoragePool',
scs.path, **in_params)))

- def _get_supported_sync_and_mode(self, system_id, rep_type):
- """
- Converts from a library capability to a suitable array capability
-
- returns a tuple (sync, mode)
- """
- rc = [None, None]
-
- rs = self._c.get_class_instance("CIM_ReplicationService", 'SystemName',
- system_id, raise_error=False)
-
- if rs:
- rs_cap = self._c.Associators(
- rs.path,
- AssocClass='CIM_ElementCapabilities',
- ResultClass='CIM_ReplicationServiceCapabilities')[0]
-
- s_rt = rs_cap['SupportedReplicationTypes']
-
- if rep_type == Volume.REPLICATE_COPY:
- if RepSvc.RepTypes.SYNC_CLONE_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_CLONE
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_SYNC
- elif RepSvc.RepTypes.ASYNC_CLONE_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_CLONE
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_ASYNC
-
- elif rep_type == Volume.REPLICATE_MIRROR_ASYNC:
- if RepSvc.RepTypes.ASYNC_MIRROR_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_MIRROR
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_ASYNC
-
- elif rep_type == Volume.REPLICATE_MIRROR_SYNC:
- if RepSvc.RepTypes.SYNC_MIRROR_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_MIRROR
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_SYNC
-
- elif rep_type == Volume.REPLICATE_CLONE:
- if RepSvc.RepTypes.SYNC_CLONE_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_SNAPSHOT
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_SYNC
- elif RepSvc.RepTypes.ASYNC_CLONE_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_SNAPSHOT
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_ASYNC
-
- if rc[0] is None:
- raise LsmError(ErrorNumber.NO_SUPPORT,
- "Replication type not supported")
-
- return tuple(rc)
-
@handle_cim_errors
def volume_replicate(self, pool, rep_type, volume_src, name, flags=0):
"""
@@ -1150,12 +1099,8 @@ class Smis(IStorageAreaNetwork):
if rs:
method = 'CreateElementReplica'

- sync, mode = self._get_supported_sync_and_mode(
- volume_src.system_id, rep_type)
-
in_params = {'ElementName': name,
'SyncType': pywbem.Uint16(sync),
- #'Mode': pywbem.Uint16(mode),
'SourceElement': lun.path,
'WaitForCopyState':
pywbem.Uint16(CopyStates.SYNCHRONIZED)}
--
1.7.1
Tony Asleson
2014-10-09 20:41:52 UTC
Permalink
Post by Gris Ge
* Remove Smis._get_supported_sync_and_mode() which
is unused as it's return value has been ignored by volume_replicate().
smis_constants.SYNC_TYPE_MIRROR
smis_constants.SYNC_TYPE_SNAPSHOT
smis_constants.SYNC_TYPE_CLONE
This is not correct.

sync, mode = self._get_supported_sync_and_mode(
volume_src.system_id, rep_type)

returns a tuple.

Mode was not being used, but sync is and it is needed. This patch
results in broken plug-in, please fix.

Thanks,
Tony
Gris Ge
2014-10-11 08:56:16 UTC
Permalink
* Move smis_constants.JS_XXX to dmtf.py:
smis_constants.JS_NEW -> dmtf.JOB_STATE_NEW
smis_constants.JS_STARTING -> dmtf.JOB_STATE_STARTING
smis_constants.JS_RUNNING -> dmtf.JOB_STATE_RUNNING
smis_constants.JS_COMPLETED -> dmtf.JOB_STATE_COMPLETED

* Removed unused smis_constants.JS_XXX constatns:
smis_constants.JS_SUSPENDED
smis_constants.JS_SHUTTING_DOWN
smis_constants.JS_TERMINATED
smis_constants.JS_KILLED
smis_constants.JS_EXCEPTION

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 8 ++++++++
plugin/smispy/smis.py | 11 ++++++-----
plugin/smispy/smis_constants.py | 5 -----
3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 18a8a8f..39f4942 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -155,6 +155,7 @@ _OP_STATUS_STR_CONV = {
OP_STATUS_POWER_MODE: "POWER_MODE",
}

+
def _op_status_to_str(dmtf_op_status):
"""
Just convert integer to string. NOT ALLOWING provide a list.
@@ -165,6 +166,7 @@ def _op_status_to_str(dmtf_op_status):
except KeyError:
return ''

+
def op_status_list_conv(conv_dict, dmtf_op_status_list,
unknown_value, other_value):
status = 0
@@ -180,3 +182,9 @@ def op_status_list_conv(conv_dict, dmtf_op_status_list,
if status == 0:
status = unknown_value
return status, " ".join(status_info_list)
+
+# CIM_ConcreteJob['JobState']
+JOB_STATE_NEW = 2
+JOB_STATE_STARTING = 3
+JOB_STATE_RUNNING = 4
+JOB_STATE_COMPLETED = 7
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 2cee221..beab30e 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -325,7 +325,8 @@ class Smis(IStorageAreaNetwork):

job_state = cim_job['JobState']

- if job_state in (JS_NEW, JS_STARTING, JS_RUNNING):
+ if job_state in (dmtf.JOB_STATE_NEW, dmtf.JOB_STATE_STARTING,
+ dmtf.JOB_STATE_RUNNING):
status = JobStatus.INPROGRESS

pc = cim_job['PercentComplete']
@@ -334,7 +335,7 @@ class Smis(IStorageAreaNetwork):
else:
percent_complete = pc

- elif job_state == JS_COMPLETED:
+ elif job_state == dmtf.JOB_STATE_COMPLETED:
status = JobStatus.COMPLETE
percent_complete = 100

@@ -2538,12 +2539,12 @@ class Smis(IStorageAreaNetwork):
PropertyList=job_pros,
LocalOnly=False)
job_state = cim_job['JobState']
- if job_state in (JS_NEW, JS_STARTING,
- JS_RUNNING):
+ if job_state in (dmtf.JOB_STATE_NEW, dmtf.JOB_STATE_STARTING,
+ dmtf.JOB_STATE_RUNNING):
loop_counter += 1
time.sleep(Smis._INVOKE_CHECK_INTERVAL)
continue
- elif job_state == JS_COMPLETED:
+ elif job_state == dmtf.JOB_STATE_COMPLETED:
if expect_class is None:
return None
cim_xxxs_path = self._c.AssociatorNames(
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 2df9144..97268c6 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,11 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

- # SMI-S job 'JobState' enumerations
-(JS_NEW, JS_STARTING, JS_RUNNING, JS_SUSPENDED, JS_SHUTTING_DOWN,
- JS_COMPLETED,
- JS_TERMINATED, JS_KILLED, JS_EXCEPTION) = (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
# SMI-S job 'OperationalStatus' enumerations
(JOB_OK, JOB_ERROR, JOB_STOPPED, JOB_COMPLETE) = (2, 6, 10, 17)
--
1.7.1
Gris Ge
2014-10-11 08:56:15 UTC
Permalink
* Remove smis_constants.py by moving its constants to:
1. dmtf.py: DMTF CIM/WBEM constants
2. smis_common.py: SNIA constants, plugin internal constants and misc.

This patch set is based on these patchset:

[PATCH 0/7] SMI-S plugin refactor (squashed commits)
[PATCH 1/4] Fix mem leaks in lsm_daemon.c, simc_lsmplugin.c

Changes in V2:

* In V1, Patch 4/15 incorrectly removed _get_supported_sync_and_mode().
In V2, Patch 4/15 just move constants used by
_get_supported_sync_and_mode() into dmtf.py

Gris Ge (15):
SMI-S Plugin: Move job state constants to dmtf.py
SMI-S Plugin: Replace JOB_XX with dmtf.OP_STATUS_XXX
SMI-S Plugin: Move InvokeMethod() return code to SmisCommon
SMI-S Plugin: Move CreateElementReplica() constants to dmtf.py
SMI-S Plugin: Move cim_vol VPD83 constants to dmtf.py
SMI-S Plugin: Move JOB_RETRIEVE_XXX into SmisCommon
SMI-S Plugin: Move WBEM port number constants to SmisCommon
SMI-S Plugin: Fix Capabilities.VOLUME_REPLICATE
SMI-S Plugin: Remove smis_constants.RepSvc class
SMI-S Plugin: Remove smis_constants.CopyStates class
SMI-S Plugin: Move smis_constants.CopyTypes to dmtf.py
SMI-S Plugin: Remove smis_constants.Synchronized class
SMI-S Plugin: Remove unused constants of smis_constants.py
SMI-S Plugin: Replace smis_constants.EXPOSE_PATHS_DA_READ_WRITE
SMI-S Plugin: Remove smis_constants.py

packaging/libstoragemgmt.spec.in | 1 -
plugin/Makefile.am | 1 -
plugin/smispy/dmtf.py | 57 ++++++++++++++++
plugin/smispy/smis.py | 138 +++++++++++++++++++------------------
plugin/smispy/smis_cap.py | 38 +++-------
plugin/smispy/smis_common.py | 17 +++++
plugin/smispy/smis_constants.py | 131 ------------------------------------
7 files changed, 157 insertions(+), 226 deletions(-)
delete mode 100644 plugin/smispy/smis_constants.py
Gris Ge
2014-10-11 08:56:17 UTC
Permalink
* Replace these constants:
smis_constants.JOB_OK => dmtf.OP_STATUS_OK
smis_constants.JOB_COMPLETE => dmtf.OP_STATUS_COMPLETED

* Removed Unused constants:
smis_constants.JOB_ERROR
smis_constants.JOB_STOPPED

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis.py | 6 ++++--
plugin/smispy/smis_constants.py | 3 ---
2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index beab30e..7484b24 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -303,8 +303,10 @@ class Smis(IStorageAreaNetwork):
op = status['OperationalStatus']

if (len(op) > 1 and
- ((op[0] == JOB_OK and op[1] == JOB_COMPLETE) or
- (op[0] == JOB_COMPLETE and op[1] == JOB_OK))):
+ ((op[0] == dmtf.OP_STATUS_OK and
+ op[1] == dmtf.OP_STATUS_COMPLETED) or
+ (op[0] == dmtf.OP_STATUS_COMPLETED and
+ op[1] == dmtf.OP_STATUS_OK))):
rc = True

return rc
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 97268c6..7af4832 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,9 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-# SMI-S job 'OperationalStatus' enumerations
-(JOB_OK, JOB_ERROR, JOB_STOPPED, JOB_COMPLETE) = (2, 6, 10, 17)
-
# SMI-S invoke return values we are interested in
# Reference: Page 54 in 1.5 SMI-S block specification
(INVOKE_OK,
--
1.7.1
Gris Ge
2014-10-11 08:56:18 UTC
Permalink
* Move these InvokeMethod() return code to SmisCommon:
smis_constants.INVOKE_OK => SmisCommon.SNIA_INVOKE_OK
smis_constants.INVOKE_ASYNC => SmisCommon.SNIA_INVOKE_ASYNC
smis_constants.INVOKE_NOT_SUPPORTED =>
SmisCommon.SNIA_INVOKE_NOT_SUPPORTED
smis_constants.INVOKE_FAILED => SmisCommon.SNIA_INVOKE_FAILED

* Removed these InvokeMethod() return code as unused:
smis_constants.INVOKE_TIMEOUT
smis_constants.INVOKE_FAILED
smis_constants.INVOKE_INVALID_PARAMETER
smis_constants.INVOKE_IN_USE
smis_constants.INVOKE_SIZE_NOT_SUPPORTED

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis.py | 19 ++++++++++---------
plugin/smispy/smis_common.py | 11 +++++++++++
plugin/smispy/smis_constants.py | 11 -----------
3 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 7484b24..56c3ca1 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -180,17 +180,17 @@ class Smis(IStorageAreaNetwork):
Handle the the process of invoking an operation.
"""
# Check to see if operation is done
- if rc == INVOKE_OK:
+ if rc == SmisCommon.SNIA_INVOKE_OK:
if retrieve_data == JOB_RETRIEVE_VOLUME:
return None, self._new_vol_from_name(out)
else:
return None, None

- elif rc == INVOKE_ASYNC:
+ elif rc == SmisCommon.SNIA_INVOKE_ASYNC:
# We have an async operation
job_id = self._job_id(out['Job'], retrieve_data)
return job_id, None
- elif rc == INVOKE_NOT_SUPPORTED:
+ elif rc == SmisCommon.SNIA_INVOKE_NOT_SUPPORTED:
raise LsmError(
ErrorNumber.NO_SUPPORT,
'SMI-S error code indicates operation not supported')
@@ -1201,7 +1201,7 @@ class Smis(IStorageAreaNetwork):

def _cim_dev_mg_path_create(self, cim_gmm_path, name, cim_vol_path,
vol_id):
- rc = INVOKE_FAILED
+ rc = SmisCommon.SNIA_INVOKE_FAILED
out = None

in_params = {
@@ -1236,7 +1236,7 @@ class Smis(IStorageAreaNetwork):
we will mask to all target ports.
Return CIMInstanceName of CIM_TargetMaskingGroup
"""
- rc = INVOKE_FAILED
+ rc = SmisCommon.SNIA_INVOKE_FAILED
out = None

in_params = {
@@ -2509,13 +2509,14 @@ class Smis(IStorageAreaNetwork):
def _wait_invoke(self, rc, out, out_key=None, expect_class=None,
flag_out_array=False,):
"""
- Return out[out_key] if found rc == INVOKE_OK.
- For rc == INVOKE_ASYNC, we check every Smis.INVOKE_CHECK_INTERVAL
+ Return out[out_key] if found rc == SmisCommon.SNIA_INVOKE_OK.
+ For rc == SmisCommon.SNIA_INVOKE_ASYNC, we check every
+ Smis._INVOKE_CHECK_INTERVAL
seconds until done. Then return association via CIM_AffectedJobElement
Return CIM_InstanceName
Assuming only one CIM_InstanceName will get.
"""
- if rc == INVOKE_OK:
+ if rc == SmisCommon.SNIA_INVOKE_OK:
if out_key is None:
return None
if out_key in out:
@@ -2530,7 +2531,7 @@ class Smis(IStorageAreaNetwork):
raise LsmError(ErrorNumber.PLUGIN_BUG,
"_wait_invoke(), %s not exist in out %s" %
(out_key, out.items()))
- elif rc == INVOKE_ASYNC:
+ elif rc == SmisCommon.SNIA_INVOKE_ASYNC:
cim_job_path = out['Job']
loop_counter = 0
job_pros = ['JobState', 'PercentComplete', 'ErrorDescription',
diff --git a/plugin/smispy/smis_common.py b/plugin/smispy/smis_common.py
index e497b29..059d838 100644
--- a/plugin/smispy/smis_common.py
+++ b/plugin/smispy/smis_common.py
@@ -142,6 +142,17 @@ def _profile_spec_ver_to_num(spec_ver_str):


class SmisCommon(object):
+ # Even many CIM_XXX_Service in DMTF shared the same return value
+ # defination as SNIA do, but there is no DMTF standard metioned
+ # InvokeMethod() should follow that list of return value.
+ # We use SNIA defination here.
+ # SNIA 1.6 rev4 Block book, BSP 5.5.3.12 Return Values section.
+ SNIA_INVOKE_OK = 0
+ SNIA_INVOKE_NOT_SUPPORTED = 1
+ SNIA_INVOKE_FAILED = 4
+ SNIA_INVOKE_ASYNC = 4096
+
+
SNIA_BLK_ROOT_PROFILE = 'Array'
SNIA_BLK_SRVS_PROFILE = 'Block Services'
SNIA_DISK_LITE_PROFILE = 'Disk Drive Lite'
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 7af4832..6b5630f 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,17 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-# SMI-S invoke return values we are interested in
-# Reference: Page 54 in 1.5 SMI-S block specification
-(INVOKE_OK,
- INVOKE_NOT_SUPPORTED,
- INVOKE_TIMEOUT,
- INVOKE_FAILED,
- INVOKE_INVALID_PARAMETER,
- INVOKE_IN_USE,
- INVOKE_ASYNC,
- INVOKE_SIZE_NOT_SUPPORTED) = (0, 1, 3, 4, 5, 6, 4096, 4097)
-
# SMI-S replication enumerations
(SYNC_TYPE_MIRROR, SYNC_TYPE_SNAPSHOT, SYNC_TYPE_CLONE) = (6, 7, 8)
--
1.7.1
Gris Ge
2014-10-11 08:56:19 UTC
Permalink
* Replaced these constants used by CreateElementReplica():
smis_constants.SYNC_TYPE_MIRROR
-> dmtf.SYNC_TYPE_MIRROR
smis_constants.SYNC_TYPE_SNAPSHOT
-> dmtf.SYNC_TYPE_SNAPSHOT
smis_constants.SYNC_TYPE_CLONE
-> dmtf.SYNC_TYPE_CLONE
smis_constants.CREATE_ELEMENT_REPLICA_MODE_SYNC
-> dmtf.REPLICA_MODE_SYNC
smis_constants.CREATE_ELEMENT_REPLICA_MODE_ASYNC
-> dmtf.REPLICA_MODE_ASYNC

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 11 +++++++++++
plugin/smispy/smis.py | 28 ++++++++++++++--------------
plugin/smispy/smis_constants.py | 7 -------
3 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 39f4942..00ca05f 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -188,3 +188,14 @@ JOB_STATE_NEW = 2
JOB_STATE_STARTING = 3
JOB_STATE_RUNNING = 4
JOB_STATE_COMPLETED = 7
+
+# CIM_Synchronized['SyncType'] also used by
+# CIM_ReplicationService.CreateElementReplica() 'SyncType' parameter.
+SYNC_TYPE_MIRROR = Uint16(6)
+SYNC_TYPE_SNAPSHOT = Uint16(7)
+SYNC_TYPE_CLONE = Uint16(8)
+
+# CIM_Synchronized['Mode'] also used by
+# CIM_ReplicationService.CreateElementReplica() 'Mode' parameter.
+REPLICA_MODE_SYNC = Uint16(2)
+REPLICA_MODE_ASYNC = Uint16(3)
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 56c3ca1..ab5fd1b 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1099,29 +1099,29 @@ class Smis(IStorageAreaNetwork):

if rep_type == Volume.REPLICATE_COPY:
if RepSvc.RepTypes.SYNC_CLONE_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_CLONE
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_SYNC
+ rc[0] = dmtf.SYNC_TYPE_CLONE
+ rc[1] = dmtf.REPLICA_MODE_SYNC
elif RepSvc.RepTypes.ASYNC_CLONE_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_CLONE
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_ASYNC
+ rc[0] = dmtf.SYNC_TYPE_CLONE
+ rc[1] = dmtf.REPLICA_MODE_ASYNC

elif rep_type == Volume.REPLICATE_MIRROR_ASYNC:
if RepSvc.RepTypes.ASYNC_MIRROR_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_MIRROR
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_ASYNC
+ rc[0] = dmtf.SYNC_TYPE_MIRROR
+ rc[1] = dmtf.REPLICA_MODE_ASYNC

elif rep_type == Volume.REPLICATE_MIRROR_SYNC:
if RepSvc.RepTypes.SYNC_MIRROR_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_MIRROR
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_SYNC
+ rc[0] = dmtf.SYNC_TYPE_MIRROR
+ rc[1] = dmtf.REPLICA_MODE_SYNC

elif rep_type == Volume.REPLICATE_CLONE:
if RepSvc.RepTypes.SYNC_CLONE_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_SNAPSHOT
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_SYNC
+ rc[0] = dmtf.SYNC_TYPE_SNAPSHOT
+ rc[1] = dmtf.REPLICA_MODE_SYNC
elif RepSvc.RepTypes.ASYNC_CLONE_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_SNAPSHOT
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_ASYNC
+ rc[0] = dmtf.SYNC_TYPE_SNAPSHOT
+ rc[1] = dmtf.REPLICA_MODE_ASYNC

if rc[0] is None:
raise LsmError(ErrorNumber.NO_SUPPORT,
@@ -1154,8 +1154,8 @@ class Smis(IStorageAreaNetwork):
volume_src.system_id, rep_type)

in_params = {'ElementName': name,
- 'SyncType': pywbem.Uint16(sync),
- #'Mode': pywbem.Uint16(mode),
+ 'SyncType': sync,
+ #'Mode': mode,
'SourceElement': lun.path,
'WaitForCopyState':
pywbem.Uint16(CopyStates.SYNCHRONIZED)}
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 6b5630f..2725762 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,9 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-# SMI-S replication enumerations
-(SYNC_TYPE_MIRROR, SYNC_TYPE_SNAPSHOT, SYNC_TYPE_CLONE) = (6, 7, 8)
-
# DMTF 2.29.1 (which SNIA SMI-S 1.6 based on)
# CIM_StorageVolume['NameFormat']
VOL_NAME_FORMAT_OTHER = 1
@@ -99,10 +96,6 @@ class Synchronized(object):
FROZEN = 14
COPY_IN_PROGRESS = 15

-# SMI-S mode for mirror updates
-(CREATE_ELEMENT_REPLICA_MODE_SYNC,
- CREATE_ELEMENT_REPLICA_MODE_ASYNC) = (2, 3)
-
# SMI-S volume 'OperationalStatus' enumerations
(VOL_OP_STATUS_OK, VOL_OP_STATUS_DEGRADED, VOL_OP_STATUS_ERR,
VOL_OP_STATUS_STARTING,
--
1.7.1
Gris Ge
2014-10-11 08:56:20 UTC
Permalink
* Move these constants into dmtf.
VOL_NAME_FORMAT_OTHER
VOL_NAME_FORMAT_NNA
VOL_NAME_FORMAT_EUI64
VOL_NAME_FORMAT_T10VID

VOL_NAME_SPACE_OTHER
VOL_NAME_SPACE_VPD83_TYPE3
VOL_NAME_SPACE_VPD83_TYPE2
VOL_NAME_SPACE_VPD83_TYPE1

* Removed these unused constants:
VOL_NAME_FORMAT_VPD83_NNA6
VOL_NAME_FORMAT_VPD83_NNA5
VOL_NAME_FORMAT_VPD83_TYPE2
VOL_NAME_FORMAT_VPD83_TYPE1
VOL_NAME_FORMAT_VPD83_TYPE0
VOL_NAME_FORMAT_SNVM
VOL_NAME_FORMAT_NODE_WWN

VOL_NAME_SPACE_OTHER
VOL_NAME_SPACE_VPD80
VOL_NAME_SPACE_NODE_WWN
VOL_NAME_SPACE_SNVM

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 12 ++++++++++++
plugin/smispy/smis.py | 20 ++++++++++----------
plugin/smispy/smis_constants.py | 23 -----------------------
3 files changed, 22 insertions(+), 33 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 00ca05f..fbee538 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -199,3 +199,15 @@ SYNC_TYPE_CLONE = Uint16(8)
# CIM_ReplicationService.CreateElementReplica() 'Mode' parameter.
REPLICA_MODE_SYNC = Uint16(2)
REPLICA_MODE_ASYNC = Uint16(3)
+
+# CIM_StorageVolume['NameFormat']
+VOL_NAME_FORMAT_OTHER = 1
+VOL_NAME_FORMAT_NNA = 9
+VOL_NAME_FORMAT_EUI64 = 10
+VOL_NAME_FORMAT_T10VID = 11
+
+# CIM_StorageVolume['NameNamespace']
+VOL_NAME_SPACE_OTHER = 1
+VOL_NAME_SPACE_VPD83_TYPE3 = 2
+VOL_NAME_SPACE_VPD83_TYPE2 = 3
+VOL_NAME_SPACE_VPD83_TYPE1 = 4
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index ab5fd1b..5e9285b 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -587,17 +587,17 @@ class Smis(IStorageAreaNetwork):
if not (nf and nn and name):
return None
# SNIA might have miss documented VPD83Type3(1), it should be
- # VOL_NAME_FORMAT_OTHER(1) based on dmtf.
- # Will remove the Smis.VOL_NAME_FORMAT_OTHER condition if confirmed as
+ # dmtf.VOL_NAME_FORMAT_OTHER(1) based on dmtf.
+ # Will remove the Smis.dmtf.VOL_NAME_FORMAT_OTHER condition if confirmed as
# SNIA document fault.
- if (nf == VOL_NAME_FORMAT_NNA and
- nn == VOL_NAME_FORMAT_OTHER) or \
- (nf == VOL_NAME_FORMAT_NNA and
- nn == VOL_NAME_SPACE_VPD83_TYPE3) or \
- (nf == VOL_NAME_FORMAT_EUI64 and
- nn == VOL_NAME_SPACE_VPD83_TYPE2) or \
- (nf == VOL_NAME_FORMAT_T10VID and
- nn == VOL_NAME_SPACE_VPD83_TYPE1):
+ if (nf == dmtf.VOL_NAME_FORMAT_NNA and
+ nn == dmtf.VOL_NAME_FORMAT_OTHER) or \
+ (nf == dmtf.VOL_NAME_FORMAT_NNA and
+ nn == dmtf.VOL_NAME_SPACE_VPD83_TYPE3) or \
+ (nf == dmtf.VOL_NAME_FORMAT_EUI64 and
+ nn == dmtf.VOL_NAME_SPACE_VPD83_TYPE2) or \
+ (nf == dmtf.VOL_NAME_FORMAT_T10VID and
+ nn == dmtf.VOL_NAME_SPACE_VPD83_TYPE1):
return name

@staticmethod
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 2725762..1e3d7b5 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,29 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-# DMTF 2.29.1 (which SNIA SMI-S 1.6 based on)
-# CIM_StorageVolume['NameFormat']
-VOL_NAME_FORMAT_OTHER = 1
-VOL_NAME_FORMAT_VPD83_NNA6 = 2
-VOL_NAME_FORMAT_VPD83_NNA5 = 3
-VOL_NAME_FORMAT_VPD83_TYPE2 = 4
-VOL_NAME_FORMAT_VPD83_TYPE1 = 5
-VOL_NAME_FORMAT_VPD83_TYPE0 = 6
-VOL_NAME_FORMAT_SNVM = 7
-VOL_NAME_FORMAT_NODE_WWN = 8
-VOL_NAME_FORMAT_NNA = 9
-VOL_NAME_FORMAT_EUI64 = 10
-VOL_NAME_FORMAT_T10VID = 11
-
-# CIM_StorageVolume['NameNamespace']
-VOL_NAME_SPACE_OTHER = 1
-VOL_NAME_SPACE_VPD83_TYPE3 = 2
-VOL_NAME_SPACE_VPD83_TYPE2 = 3
-VOL_NAME_SPACE_VPD83_TYPE1 = 4
-VOL_NAME_SPACE_VPD80 = 5
-VOL_NAME_SPACE_NODE_WWN = 6
-VOL_NAME_SPACE_SNVM = 7
-
JOB_RETRIEVE_NONE = 0
JOB_RETRIEVE_VOLUME = 1
--
1.7.1
Gris Ge
2014-10-11 08:56:21 UTC
Permalink
* Move these constants to SmisCommon:
smis_constants.JOB_RETRIEVE_NONE => SmisCommon.JOB_RETRIEVE_NONE
smis_constants.JOB_RETRIEVE_VOLUME => SmisCommon.JOB_RETRIEVE_VOLUME
# These two constants is just for plugin internal use, not a SNIA or DMTF
# constant.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis.py | 26 +++++++++++++++-----------
plugin/smispy/smis_common.py | 3 +++
plugin/smispy/smis_constants.py | 3 ---
3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 5e9285b..d8fc9dd 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -181,7 +181,7 @@ class Smis(IStorageAreaNetwork):
"""
# Check to see if operation is done
if rc == SmisCommon.SNIA_INVOKE_OK:
- if retrieve_data == JOB_RETRIEVE_VOLUME:
+ if retrieve_data == SmisCommon.JOB_RETRIEVE_VOLUME:
return None, self._new_vol_from_name(out)
else:
return None, None
@@ -343,7 +343,7 @@ class Smis(IStorageAreaNetwork):

if Smis._job_completed_ok(cim_job):
(ignore, retrieve_data) = self._parse_job_id(job_id)
- if retrieve_data == JOB_RETRIEVE_VOLUME:
+ if retrieve_data == SmisCommon.JOB_RETRIEVE_VOLUME:
completed_item = self._new_vol_from_job(cim_job)
else:
status = JobStatus.ERROR
@@ -431,7 +431,8 @@ class Smis(IStorageAreaNetwork):
"""
Return the MD5 has of CIM_ConcreteJob['InstanceID'] in conjunction
with '@%s' % retrieve_data
- retrieve_data should be JOB_RETRIEVE_NONE or JOB_RETRIEVE_VOLUME or etc
+ retrieve_data should be SmisCommon.JOB_RETRIEVE_NONE or
+ SmisCommon.JOB_RETRIEVE_VOLUME or etc
"""
return "%s@%d" % (self._id('Job', cim_job), int(retrieve_data))

@@ -482,7 +483,7 @@ class Smis(IStorageAreaNetwork):
"""
tmp_list = job_id.split('@', 2)
md5_str = tmp_list[0]
- retrieve_data = JOB_RETRIEVE_NONE
+ retrieve_data = SmisCommon.JOB_RETRIEVE_NONE
if len(tmp_list) == 2:
retrieve_data = int(tmp_list[1])
return (md5_str, retrieve_data)
@@ -872,7 +873,8 @@ class Smis(IStorageAreaNetwork):
'Size': pywbem.Uint64(size_bytes)}

try:
- return self._pi("volume_create", JOB_RETRIEVE_VOLUME,
+ return self._pi("volume_create",
+ SmisCommon.JOB_RETRIEVE_VOLUME,
*(self._c.InvokeMethod(
'CreateOrModifyElementFromStoragePool',
scs.path, **in_params)))
@@ -902,7 +904,8 @@ class Smis(IStorageAreaNetwork):
in_params = {'Operation': pywbem.Uint16(2),
'Synchronization': sync.path}

- job_id = self._pi("_detach", JOB_RETRIEVE_NONE,
+ job_id = self._pi("_detach",
+ SmisCommon.JOB_RETRIEVE_NONE,
*(self._c.InvokeMethod(
'ModifySynchronization', scs.path,
**in_params)))[0]
@@ -920,7 +923,7 @@ class Smis(IStorageAreaNetwork):
in_params = {'Operation': pywbem.Uint16(8),
'Synchronization': sync.path}

- job_id = self._pi("_detach", JOB_RETRIEVE_NONE,
+ job_id = self._pi("_detach", SmisCommon.JOB_RETRIEVE_NONE,
*(self._c.InvokeMethod(
'ModifyReplicaSynchronization', rs.path,
**in_params)))[0]
@@ -1028,7 +1031,7 @@ class Smis(IStorageAreaNetwork):
in_params = {'TheElement': lun.path}

#Delete returns None or Job number
- return self._pi("volume_delete", JOB_RETRIEVE_NONE,
+ return self._pi("volume_delete", SmisCommon.JOB_RETRIEVE_NONE,
*(self._c.InvokeMethod('ReturnToStoragePool',
scs.path, **in_params)))[0]

@@ -1055,7 +1058,7 @@ class Smis(IStorageAreaNetwork):
in_params = {'TheElement': lun.path}

# Delete returns None or Job number
- return self._pi("volume_delete", JOB_RETRIEVE_NONE,
+ return self._pi("volume_delete", SmisCommon.JOB_RETRIEVE_NONE,
*(self._c.InvokeMethod('ReturnToStoragePool',
scs.path,
**in_params)))[0]
@@ -1073,7 +1076,7 @@ class Smis(IStorageAreaNetwork):
'TheElement': lun.path,
'Size': pywbem.Uint64(new_size_bytes)}

- return self._pi("volume_resize", JOB_RETRIEVE_VOLUME,
+ return self._pi("volume_resize", SmisCommon.JOB_RETRIEVE_VOLUME,
*(self._c.InvokeMethod(
'CreateOrModifyElementFromStoragePool',
scs.path, **in_params)))
@@ -1190,7 +1193,8 @@ class Smis(IStorageAreaNetwork):

try:

- return self._pi("volume_replicate", JOB_RETRIEVE_VOLUME,
+ return self._pi("volume_replicate",
+ SmisCommon.JOB_RETRIEVE_VOLUME,
*(self._c.InvokeMethod(method,
rs.path, **in_params)))
except CIMError:
diff --git a/plugin/smispy/smis_common.py b/plugin/smispy/smis_common.py
index 059d838..bd80a9d 100644
--- a/plugin/smispy/smis_common.py
+++ b/plugin/smispy/smis_common.py
@@ -170,6 +170,9 @@ class SmisCommon(object):
_PRODUCT_MEGARAID = 'LSI MegaRAID'
_PRODUCT_NETAPP_E = 'NetApp-E'

+ JOB_RETRIEVE_NONE = 0
+ JOB_RETRIEVE_VOLUME = 1
+
def __init__(self, url, username, password,
namespace=dmtf.DEFAULT_NAMESPACE,
no_ssl_verify=False, debug=False, system_list=None):
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 1e3d7b5..a58e25b 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,9 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-JOB_RETRIEVE_NONE = 0
-JOB_RETRIEVE_VOLUME = 1
-
IAAN_WBEM_HTTP_PORT = 5988
IAAN_WBEM_HTTPS_PORT = 5989
--
1.7.1
Gris Ge
2014-10-11 08:56:22 UTC
Permalink
* Move these constants into SmisCommon:
smis_constants.IAAN_WBEM_HTTP_PORT => SmisCommon.IAAN_WBEM_HTTP_PORT
smis_constants.IAAN_WBEM_HTTPS_PORT => SmisCommon.IAAN_WBEM_HTTPS_PORT
# These two constant is defined by IETF IAAN. Store in SmisCommon class
# which was supposed to hold non-dmtf constants.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis.py | 4 ++--
plugin/smispy/smis_common.py | 3 +++
plugin/smispy/smis_constants.py | 3 ---
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index d8fc9dd..be00810 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -233,12 +233,12 @@ class Smis(IStorageAreaNetwork):
Enumerate CIM_RegisteredProfile in userdefined namespace.
"""
protocol = 'http'
- port = IAAN_WBEM_HTTP_PORT
+ port = SmisCommon.IAAN_WBEM_HTTP_PORT
u = uri_parse(uri, ['scheme', 'netloc', 'host'], None)

if u['scheme'].lower() == 'smispy+ssl':
protocol = 'https'
- port = IAAN_WBEM_HTTPS_PORT
+ port = SmisCommon.IAAN_WBEM_HTTPS_PORT

if 'port' in u:
port = u['port']
diff --git a/plugin/smispy/smis_common.py b/plugin/smispy/smis_common.py
index bd80a9d..decbb51 100644
--- a/plugin/smispy/smis_common.py
+++ b/plugin/smispy/smis_common.py
@@ -173,6 +173,9 @@ class SmisCommon(object):
JOB_RETRIEVE_NONE = 0
JOB_RETRIEVE_VOLUME = 1

+ IAAN_WBEM_HTTP_PORT = 5988
+ IAAN_WBEM_HTTPS_PORT = 5989
+
def __init__(self, url, username, password,
namespace=dmtf.DEFAULT_NAMESPACE,
no_ssl_verify=False, debug=False, system_list=None):
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index a58e25b..74b270e 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,9 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-IAAN_WBEM_HTTP_PORT = 5988
-IAAN_WBEM_HTTPS_PORT = 5989
-

class RepSvc(object):
--
1.7.1
Gris Ge
2014-10-11 08:56:23 UTC
Permalink
* Previously:
incorrect use
CIM_ReplicationServiceCapabilities['SupportedReplicationTypes'] --
2(Synchronous Mirror Local) for Capabilities.VOLUME_REPLICATE
capability.
Now:
Use CIM_ReplicationServiceCapabilities['SupportedSynchronousActions'] and
['SupportedAsynchronousActions'] -- 2(CreateElementReplica) for
Capabilities.VOLUME_REPLICATE capability.

* Remove smis_constants.RepSvc.Action class.
* Add dmtf.REPLICA_CAP_ACTION_CREATE_ELEMENT for 2(CreateElementReplica)
in CIM_ReplicationServiceCapabilities['SupportedSynchronousActions'] and
['SupportedAsynchronousActions'].

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 4 ++++
plugin/smispy/smis_cap.py | 8 ++++++--
plugin/smispy/smis_constants.py | 3 ---
3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index fbee538..8c81402 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -211,3 +211,7 @@ VOL_NAME_SPACE_OTHER = 1
VOL_NAME_SPACE_VPD83_TYPE3 = 2
VOL_NAME_SPACE_VPD83_TYPE2 = 3
VOL_NAME_SPACE_VPD83_TYPE1 = 4
+
+# CIM_ReplicationServiceCapabilities['SupportedAsynchronousActions']
+# or CIM_ReplicationServiceCapabilities['SupportedSynchronousActions']
+REPLICA_CAP_ACTION_CREATE_ELEMENT = 2
diff --git a/plugin/smispy/smis_cap.py b/plugin/smispy/smis_cap.py
index 0c9751d..4e9b9f1 100644
--- a/plugin/smispy/smis_cap.py
+++ b/plugin/smispy/smis_cap.py
@@ -37,10 +37,14 @@ def _rs_supported_capabilities(smis_common, system, cap):
ResultClass='CIM_ReplicationServiceCapabilities')[0]

s_rt = rs_cap['SupportedReplicationTypes']
+ async_actions = rs_cap['SupportedAsynchronousActions']
+ sync_actions = rs_cap['SupportedSynchronousActions']

- if RepSvc.Action.CREATE_ELEMENT_REPLICA in s_rt or \
- RepSvc.Action.CREATE_ELEMENT_REPLICA in s_rt:
+ if dmtf.REPLICA_CAP_ACTION_CREATE_ELEMENT in async_actions or \
+ dmtf.REPLICA_CAP_ACTION_CREATE_ELEMENT in sync_actions :
cap.set(Capabilities.VOLUME_REPLICATE)
+ else:
+ return

# Mirror support is not working and is not supported at this time.
# if RepSvc.RepTypes.SYNC_MIRROR_LOCAL in s_rt:
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 74b270e..141820d 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -17,9 +17,6 @@

class RepSvc(object):

- class Action(object):
- CREATE_ELEMENT_REPLICA = 2
-
class RepTypes(object):
# SMI-S replication service capabilities
SYNC_MIRROR_LOCAL = 2
--
1.7.1
Gris Ge
2014-10-11 08:56:24 UTC
Permalink
* Replace smis_constants.RepSvc with these constants in dmtf.py:
RepSvc.RepTypes.SYNC_SNAPSHOT_LOCAL
-> dmtf.REPLICA_CAP_TYPE_SYNC_SNAPSHOT_LOCAL
RepSvc.RepTypes.ASYNC_SNAPSHOT_LOCAL
-> dmtf.REPLICA_CAP_TYPE_ASYNC_SNAPSHOT_LOCAL
RepSvc.RepTypes.SYNC_CLONE_LOCAL
-> dmtf.REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL
RepSvc.RepTypes.ASYNC_CLONE_LOCAL
-> dmtf.REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL

* Removed these unused constants:
RepSvc.RepTypes.SYNC_MIRROR_LOCAL
RepSvc.RepTypes.ASYNC_MIRROR_LOCAL
RepSvc.RepTypes.SYNC_MIRROR_REMOTE
RepSvc.RepTypes.ASYNC_MIRROR_REMOTE
RepSvc.RepTypes.SYNC_CLONE_REMOTE
RepSvc.RepTypes.ASYNC_CLONE_REMOTE

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 7 +++++++
plugin/smispy/smis_cap.py | 16 ++++------------
plugin/smispy/smis_constants.py | 18 ------------------
3 files changed, 11 insertions(+), 30 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 8c81402..8432715 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -215,3 +215,10 @@ VOL_NAME_SPACE_VPD83_TYPE1 = 4
# CIM_ReplicationServiceCapabilities['SupportedAsynchronousActions']
# or CIM_ReplicationServiceCapabilities['SupportedSynchronousActions']
REPLICA_CAP_ACTION_CREATE_ELEMENT = 2
+
+# CIM_ReplicationServiceCapabilities['SupportedReplicationTypes']
+REPLICA_CAP_TYPE_SYNC_SNAPSHOT_LOCAL = 6
+REPLICA_CAP_TYPE_ASYNC_SNAPSHOT_LOCAL = 7
+
+REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL = 10
+REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL = 11
diff --git a/plugin/smispy/smis_cap.py b/plugin/smispy/smis_cap.py
index 4e9b9f1..cff4745 100644
--- a/plugin/smispy/smis_cap.py
+++ b/plugin/smispy/smis_cap.py
@@ -46,20 +46,12 @@ def _rs_supported_capabilities(smis_common, system, cap):
else:
return

- # Mirror support is not working and is not supported at this time.
- # if RepSvc.RepTypes.SYNC_MIRROR_LOCAL in s_rt:
- # cap.set(Capabilities.DeviceID)
-
- # if RepSvc.RepTypes.ASYNC_MIRROR_LOCAL \
- # in s_rt:
- # cap.set(Capabilities.VOLUME_REPLICATE_MIRROR_ASYNC)
-
- if RepSvc.RepTypes.SYNC_SNAPSHOT_LOCAL in s_rt or \
- RepSvc.RepTypes.ASYNC_SNAPSHOT_LOCAL in s_rt:
+ if dmtf.REPLICA_CAP_TYPE_SYNC_SNAPSHOT_LOCAL in s_rt or \
+ dmtf.REPLICA_CAP_TYPE_ASYNC_SNAPSHOT_LOCAL in s_rt:
cap.set(Capabilities.VOLUME_REPLICATE_CLONE)

- if RepSvc.RepTypes.SYNC_CLONE_LOCAL in s_rt or \
- RepSvc.RepTypes.ASYNC_CLONE_LOCAL in s_rt:
+ if dmtf.REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL in s_rt or \
+ dmtf.REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL in s_rt:
cap.set(Capabilities.VOLUME_REPLICATE_COPY)
else:
# Try older storage configuration service
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 141820d..a2fbe84 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -15,24 +15,6 @@
# USA


-class RepSvc(object):
-
- class RepTypes(object):
- # SMI-S replication service capabilities
- SYNC_MIRROR_LOCAL = 2
- ASYNC_MIRROR_LOCAL = 3
- SYNC_MIRROR_REMOTE = 4
- ASYNC_MIRROR_REMOTE = 5
- SYNC_SNAPSHOT_LOCAL = 6
- ASYNC_SNAPSHOT_LOCAL = 7
- SYNC_SNAPSHOT_REMOTE = 8
- ASYNC_SNAPSHOT_REMOTE = 9
- SYNC_CLONE_LOCAL = 10
- ASYNC_CLONE_LOCAL = 11
- SYNC_CLONE_REMOTE = 12
- ASYNC_CLONE_REMOTE = 13
-
-
class CopyStates(object):
INITIALIZED = 2
UNSYNCHRONIZED = 3
--
1.7.1
Tony Asleson
2014-10-13 16:39:00 UTC
Permalink
Post by Gris Ge
RepSvc.RepTypes.SYNC_SNAPSHOT_LOCAL
-> dmtf.REPLICA_CAP_TYPE_SYNC_SNAPSHOT_LOCAL
RepSvc.RepTypes.ASYNC_SNAPSHOT_LOCAL
-> dmtf.REPLICA_CAP_TYPE_ASYNC_SNAPSHOT_LOCAL
RepSvc.RepTypes.SYNC_CLONE_LOCAL
-> dmtf.REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL
RepSvc.RepTypes.ASYNC_CLONE_LOCAL
-> dmtf.REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL
RepSvc.RepTypes.SYNC_MIRROR_LOCAL
RepSvc.RepTypes.ASYNC_MIRROR_LOCAL
RepSvc.RepTypes.SYNC_MIRROR_REMOTE
RepSvc.RepTypes.ASYNC_MIRROR_REMOTE
RepSvc.RepTypes.SYNC_CLONE_REMOTE
RepSvc.RepTypes.ASYNC_CLONE_REMOTE
You missed reworking the constants in the function:

_get_supported_sync_and_mode

RepSvc.RepTypes.SYNC_CLONE_LOCAL
RepSvc.RepTypes.ASYNC_CLONE_LOCAL
RepSvc.RepTypes.ASYNC_MIRROR_LOCAL
RepSvc.RepTypes.SYNC_MIRROR_LOCAL
RepSvc.RepTypes.SYNC_CLONE_LOCAL
RepSvc.RepTypes.ASYNC_CLONE_LOCAL

Need to be changed to new dmtf location.

Fails unit tests in SNIA lab:

- {msg: "PLUGIN_BUG(2): global name 'RepSvc' is not defined Data:
Traceback (most\
\ recent call last):\n File
\"/home/tasleson/libstoragemgmt-code/python_binding/lsm/plugin/smispy/utils.py\"\
, line 31, in cim_wrapper\n return method(*args, **kwargs)\n
File
\"/home/tasleson/libstoragemgmt-code/python_binding/lsm/plugin/smispy/smis.py\"\
, line 1156, in volume_replicate\n volume_src.system_id,
rep_type)\n File\
\
\"/home/tasleson/libstoragemgmt-code/python_binding/lsm/plugin/smispy/smis.py\"\
, line 1121, in _get_supported_sync_and_mode\n if
RepSvc.RepTypes.SYNC_CLONE_LOCAL\
\ in s_rt:\nNameError: global name 'RepSvc' is not defined\n", rc:
false, stack_trace: "Traceback\
\ (most recent call last):\n File \"./plugin_test.py\", line 183,
in present\n\
\ rc = getattr(self.o, _proxy_method_name)(*args, **kwargs)\n
File \"/home/tasleson/libstoragemgmt-code/python_binding/lsm/_common.py\"\
, line 537, in inner\n r = func(*args, **kwargs)\n File
\"/home/tasleson/libstoragemgmt-code/python_binding/lsm/_client.py\"\
, line 415, in volume_replicate\n return
self._tp.rpc('volume_replicate',\
\ _del_self(locals()))\n File
\"/home/tasleson/libstoragemgmt-code/python_binding/lsm/_transport.py\"\
, line 154, in rpc\n (reply, msg_id) = self.read_resp()\n File
\"/home/tasleson/libstoragemgmt-code/python_binding/lsm/_transport.py\"\
, line 181, in read_resp\n raise LsmError(**e)\nLsmError:
PLUGIN_BUG(2):\
\ global name 'RepSvc' is not defined Data: Traceback (most recent
call last):\n\
\ File
\"/home/tasleson/libstoragemgmt-code/python_binding/lsm/plugin/smispy/utils.py\"\
, line 31, in cim_wrapper\n return method(*args, **kwargs)\n
File
\"/home/tasleson/libstoragemgmt-code/python_binding/lsm/plugin/smispy/smis.py\"\
, line 1156, in volume_replicate\n volume_src.system_id,
rep_type)\n File\
\
\"/home/tasleson/libstoragemgmt-code/python_binding/lsm/plugin/smispy/smis.py\"\
, line 1121, in _get_supported_sync_and_mode\n if
RepSvc.RepTypes.SYNC_CLONE_LOCAL\
\ in s_rt:\nNameError: global name 'RepSvc' is not defined\n\n"}

Please remember to unit test patches before submitting for review &
inclusion.

Thanks!

Regards,
Tony
Gris Ge
2014-10-14 10:02:36 UTC
Permalink
Post by Gris Ge
_get_supported_sync_and_mode
RepSvc.RepTypes.SYNC_CLONE_LOCAL
RepSvc.RepTypes.ASYNC_CLONE_LOCAL
RepSvc.RepTypes.ASYNC_MIRROR_LOCAL
RepSvc.RepTypes.SYNC_MIRROR_LOCAL
RepSvc.RepTypes.SYNC_CLONE_LOCAL
RepSvc.RepTypes.ASYNC_CLONE_LOCAL
Need to be changed to new dmtf location.
Please remember to unit test patches before submitting for review &
inclusion.
Thanks!
Regards,
Tony
Hi Tony,
I will make sure it pass plugin test in SNIA lab.
Sorry for wasting your time. V3 is coming.

Thank you for the detailed review.
Best regards.
--
Gris Ge
Gris Ge
2014-10-14 10:06:21 UTC
Permalink
* Remove smis_constants.py by moving its constants to:
1. dmtf.py: DMTF CIM/WBEM constants
2. smis_common.py: SNIA constants, plugin internal constants and misc.

This patch set is based on these patchset:

[PATCH 0/7] SMI-S plugin refactor (squashed commits)
[PATCH 1/4] Fix mem leaks in lsm_daemon.c, simc_lsmplugin.c

Changes in V2:

* In V1, Patch 4/15 incorrectly removed _get_supported_sync_and_mode().
In V2, Patch 4/15 just move constants used by
_get_supported_sync_and_mode() into dmtf.py

Changes in V2:
* In V2, Patch 9/15 failed to replace constants in
_get_supported_sync_and_mode(), V3 fixed it.
* Plugin tested passed on HP 3PAR.

Gris Ge (15):
SMI-S Plugin: Move job state constants to dmtf.py
SMI-S Plugin: Replace JOB_XX with dmtf.OP_STATUS_XXX
SMI-S Plugin: Move InvokeMethod() return code to SmisCommon
SMI-S Plugin: Move CreateElementReplica() constants to dmtf.py
SMI-S Plugin: Move cim_vol VPD83 constants to dmtf.py
SMI-S Plugin: Move JOB_RETRIEVE_XXX into SmisCommon
SMI-S Plugin: Move WBEM port number constants to SmisCommon
SMI-S Plugin: Fix Capabilities.VOLUME_REPLICATE
SMI-S Plugin: Remove smis_constants.RepSvc class
SMI-S Plugin: Remove smis_constants.CopyStates class
SMI-S Plugin: Move smis_constants.CopyTypes to dmtf.py
SMI-S Plugin: Remove smis_constants.Synchronized class
SMI-S Plugin: Remove unused constants of smis_constants.py
SMI-S Plugin: Replace smis_constants.EXPOSE_PATHS_DA_READ_WRITE
SMI-S Plugin: Remove smis_constants.py

packaging/libstoragemgmt.spec.in | 1 -
plugin/Makefile.am | 1 -
plugin/smispy/dmtf.py | 60 ++++++++++++++++
plugin/smispy/smis.py | 150 ++++++++++++++++++++-------------------
plugin/smispy/smis_cap.py | 38 ++++------
plugin/smispy/smis_common.py | 17 +++++
plugin/smispy/smis_constants.py | 131 ----------------------------------
7 files changed, 166 insertions(+), 232 deletions(-)
delete mode 100644 plugin/smispy/smis_constants.py
--
1.8.3.1
Gris Ge
2014-10-14 10:06:23 UTC
Permalink
* Replace these constants:
smis_constants.JOB_OK => dmtf.OP_STATUS_OK
smis_constants.JOB_COMPLETE => dmtf.OP_STATUS_COMPLETED

* Removed Unused constants:
smis_constants.JOB_ERROR
smis_constants.JOB_STOPPED

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis.py | 6 ++++--
plugin/smispy/smis_constants.py | 3 ---
2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index beab30e..7484b24 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -303,8 +303,10 @@ class Smis(IStorageAreaNetwork):
op = status['OperationalStatus']

if (len(op) > 1 and
- ((op[0] == JOB_OK and op[1] == JOB_COMPLETE) or
- (op[0] == JOB_COMPLETE and op[1] == JOB_OK))):
+ ((op[0] == dmtf.OP_STATUS_OK and
+ op[1] == dmtf.OP_STATUS_COMPLETED) or
+ (op[0] == dmtf.OP_STATUS_COMPLETED and
+ op[1] == dmtf.OP_STATUS_OK))):
rc = True

return rc
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 97268c6..7af4832 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,9 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-# SMI-S job 'OperationalStatus' enumerations
-(JOB_OK, JOB_ERROR, JOB_STOPPED, JOB_COMPLETE) = (2, 6, 10, 17)
-
# SMI-S invoke return values we are interested in
# Reference: Page 54 in 1.5 SMI-S block specification
(INVOKE_OK,
--
1.8.3.1
Gris Ge
2014-10-14 10:06:22 UTC
Permalink
* Move smis_constants.JS_XXX to dmtf.py:
smis_constants.JS_NEW -> dmtf.JOB_STATE_NEW
smis_constants.JS_STARTING -> dmtf.JOB_STATE_STARTING
smis_constants.JS_RUNNING -> dmtf.JOB_STATE_RUNNING
smis_constants.JS_COMPLETED -> dmtf.JOB_STATE_COMPLETED

* Removed unused smis_constants.JS_XXX constatns:
smis_constants.JS_SUSPENDED
smis_constants.JS_SHUTTING_DOWN
smis_constants.JS_TERMINATED
smis_constants.JS_KILLED
smis_constants.JS_EXCEPTION

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 8 ++++++++
plugin/smispy/smis.py | 11 ++++++-----
plugin/smispy/smis_constants.py | 5 -----
3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 18a8a8f..39f4942 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -155,6 +155,7 @@ _OP_STATUS_STR_CONV = {
OP_STATUS_POWER_MODE: "POWER_MODE",
}

+
def _op_status_to_str(dmtf_op_status):
"""
Just convert integer to string. NOT ALLOWING provide a list.
@@ -165,6 +166,7 @@ def _op_status_to_str(dmtf_op_status):
except KeyError:
return ''

+
def op_status_list_conv(conv_dict, dmtf_op_status_list,
unknown_value, other_value):
status = 0
@@ -180,3 +182,9 @@ def op_status_list_conv(conv_dict, dmtf_op_status_list,
if status == 0:
status = unknown_value
return status, " ".join(status_info_list)
+
+# CIM_ConcreteJob['JobState']
+JOB_STATE_NEW = 2
+JOB_STATE_STARTING = 3
+JOB_STATE_RUNNING = 4
+JOB_STATE_COMPLETED = 7
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 2cee221..beab30e 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -325,7 +325,8 @@ class Smis(IStorageAreaNetwork):

job_state = cim_job['JobState']

- if job_state in (JS_NEW, JS_STARTING, JS_RUNNING):
+ if job_state in (dmtf.JOB_STATE_NEW, dmtf.JOB_STATE_STARTING,
+ dmtf.JOB_STATE_RUNNING):
status = JobStatus.INPROGRESS

pc = cim_job['PercentComplete']
@@ -334,7 +335,7 @@ class Smis(IStorageAreaNetwork):
else:
percent_complete = pc

- elif job_state == JS_COMPLETED:
+ elif job_state == dmtf.JOB_STATE_COMPLETED:
status = JobStatus.COMPLETE
percent_complete = 100

@@ -2538,12 +2539,12 @@ class Smis(IStorageAreaNetwork):
PropertyList=job_pros,
LocalOnly=False)
job_state = cim_job['JobState']
- if job_state in (JS_NEW, JS_STARTING,
- JS_RUNNING):
+ if job_state in (dmtf.JOB_STATE_NEW, dmtf.JOB_STATE_STARTING,
+ dmtf.JOB_STATE_RUNNING):
loop_counter += 1
time.sleep(Smis._INVOKE_CHECK_INTERVAL)
continue
- elif job_state == JS_COMPLETED:
+ elif job_state == dmtf.JOB_STATE_COMPLETED:
if expect_class is None:
return None
cim_xxxs_path = self._c.AssociatorNames(
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 2df9144..97268c6 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,11 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

- # SMI-S job 'JobState' enumerations
-(JS_NEW, JS_STARTING, JS_RUNNING, JS_SUSPENDED, JS_SHUTTING_DOWN,
- JS_COMPLETED,
- JS_TERMINATED, JS_KILLED, JS_EXCEPTION) = (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
# SMI-S job 'OperationalStatus' enumerations
(JOB_OK, JOB_ERROR, JOB_STOPPED, JOB_COMPLETE) = (2, 6, 10, 17)
--
1.8.3.1
Gris Ge
2014-10-14 10:06:24 UTC
Permalink
* Move these InvokeMethod() return code to SmisCommon:
smis_constants.INVOKE_OK => SmisCommon.SNIA_INVOKE_OK
smis_constants.INVOKE_ASYNC => SmisCommon.SNIA_INVOKE_ASYNC
smis_constants.INVOKE_NOT_SUPPORTED =>
SmisCommon.SNIA_INVOKE_NOT_SUPPORTED
smis_constants.INVOKE_FAILED => SmisCommon.SNIA_INVOKE_FAILED

* Removed these InvokeMethod() return code as unused:
smis_constants.INVOKE_TIMEOUT
smis_constants.INVOKE_FAILED
smis_constants.INVOKE_INVALID_PARAMETER
smis_constants.INVOKE_IN_USE
smis_constants.INVOKE_SIZE_NOT_SUPPORTED

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis.py | 19 ++++++++++---------
plugin/smispy/smis_common.py | 11 +++++++++++
plugin/smispy/smis_constants.py | 11 -----------
3 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 7484b24..56c3ca1 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -180,17 +180,17 @@ class Smis(IStorageAreaNetwork):
Handle the the process of invoking an operation.
"""
# Check to see if operation is done
- if rc == INVOKE_OK:
+ if rc == SmisCommon.SNIA_INVOKE_OK:
if retrieve_data == JOB_RETRIEVE_VOLUME:
return None, self._new_vol_from_name(out)
else:
return None, None

- elif rc == INVOKE_ASYNC:
+ elif rc == SmisCommon.SNIA_INVOKE_ASYNC:
# We have an async operation
job_id = self._job_id(out['Job'], retrieve_data)
return job_id, None
- elif rc == INVOKE_NOT_SUPPORTED:
+ elif rc == SmisCommon.SNIA_INVOKE_NOT_SUPPORTED:
raise LsmError(
ErrorNumber.NO_SUPPORT,
'SMI-S error code indicates operation not supported')
@@ -1201,7 +1201,7 @@ class Smis(IStorageAreaNetwork):

def _cim_dev_mg_path_create(self, cim_gmm_path, name, cim_vol_path,
vol_id):
- rc = INVOKE_FAILED
+ rc = SmisCommon.SNIA_INVOKE_FAILED
out = None

in_params = {
@@ -1236,7 +1236,7 @@ class Smis(IStorageAreaNetwork):
we will mask to all target ports.
Return CIMInstanceName of CIM_TargetMaskingGroup
"""
- rc = INVOKE_FAILED
+ rc = SmisCommon.SNIA_INVOKE_FAILED
out = None

in_params = {
@@ -2509,13 +2509,14 @@ class Smis(IStorageAreaNetwork):
def _wait_invoke(self, rc, out, out_key=None, expect_class=None,
flag_out_array=False,):
"""
- Return out[out_key] if found rc == INVOKE_OK.
- For rc == INVOKE_ASYNC, we check every Smis.INVOKE_CHECK_INTERVAL
+ Return out[out_key] if found rc == SmisCommon.SNIA_INVOKE_OK.
+ For rc == SmisCommon.SNIA_INVOKE_ASYNC, we check every
+ Smis._INVOKE_CHECK_INTERVAL
seconds until done. Then return association via CIM_AffectedJobElement
Return CIM_InstanceName
Assuming only one CIM_InstanceName will get.
"""
- if rc == INVOKE_OK:
+ if rc == SmisCommon.SNIA_INVOKE_OK:
if out_key is None:
return None
if out_key in out:
@@ -2530,7 +2531,7 @@ class Smis(IStorageAreaNetwork):
raise LsmError(ErrorNumber.PLUGIN_BUG,
"_wait_invoke(), %s not exist in out %s" %
(out_key, out.items()))
- elif rc == INVOKE_ASYNC:
+ elif rc == SmisCommon.SNIA_INVOKE_ASYNC:
cim_job_path = out['Job']
loop_counter = 0
job_pros = ['JobState', 'PercentComplete', 'ErrorDescription',
diff --git a/plugin/smispy/smis_common.py b/plugin/smispy/smis_common.py
index e497b29..059d838 100644
--- a/plugin/smispy/smis_common.py
+++ b/plugin/smispy/smis_common.py
@@ -142,6 +142,17 @@ def _profile_spec_ver_to_num(spec_ver_str):


class SmisCommon(object):
+ # Even many CIM_XXX_Service in DMTF shared the same return value
+ # defination as SNIA do, but there is no DMTF standard metioned
+ # InvokeMethod() should follow that list of return value.
+ # We use SNIA defination here.
+ # SNIA 1.6 rev4 Block book, BSP 5.5.3.12 Return Values section.
+ SNIA_INVOKE_OK = 0
+ SNIA_INVOKE_NOT_SUPPORTED = 1
+ SNIA_INVOKE_FAILED = 4
+ SNIA_INVOKE_ASYNC = 4096
+
+
SNIA_BLK_ROOT_PROFILE = 'Array'
SNIA_BLK_SRVS_PROFILE = 'Block Services'
SNIA_DISK_LITE_PROFILE = 'Disk Drive Lite'
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 7af4832..6b5630f 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,17 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-# SMI-S invoke return values we are interested in
-# Reference: Page 54 in 1.5 SMI-S block specification
-(INVOKE_OK,
- INVOKE_NOT_SUPPORTED,
- INVOKE_TIMEOUT,
- INVOKE_FAILED,
- INVOKE_INVALID_PARAMETER,
- INVOKE_IN_USE,
- INVOKE_ASYNC,
- INVOKE_SIZE_NOT_SUPPORTED) = (0, 1, 3, 4, 5, 6, 4096, 4097)
-
# SMI-S replication enumerations
(SYNC_TYPE_MIRROR, SYNC_TYPE_SNAPSHOT, SYNC_TYPE_CLONE) = (6, 7, 8)
--
1.8.3.1
Gris Ge
2014-10-14 10:06:26 UTC
Permalink
* Move these constants into dmtf.
VOL_NAME_FORMAT_OTHER
VOL_NAME_FORMAT_NNA
VOL_NAME_FORMAT_EUI64
VOL_NAME_FORMAT_T10VID

VOL_NAME_SPACE_OTHER
VOL_NAME_SPACE_VPD83_TYPE3
VOL_NAME_SPACE_VPD83_TYPE2
VOL_NAME_SPACE_VPD83_TYPE1

* Removed these unused constants:
VOL_NAME_FORMAT_VPD83_NNA6
VOL_NAME_FORMAT_VPD83_NNA5
VOL_NAME_FORMAT_VPD83_TYPE2
VOL_NAME_FORMAT_VPD83_TYPE1
VOL_NAME_FORMAT_VPD83_TYPE0
VOL_NAME_FORMAT_SNVM
VOL_NAME_FORMAT_NODE_WWN

VOL_NAME_SPACE_OTHER
VOL_NAME_SPACE_VPD80
VOL_NAME_SPACE_NODE_WWN
VOL_NAME_SPACE_SNVM

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 12 ++++++++++++
plugin/smispy/smis.py | 20 ++++++++++----------
plugin/smispy/smis_constants.py | 23 -----------------------
3 files changed, 22 insertions(+), 33 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 00ca05f..fbee538 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -199,3 +199,15 @@ SYNC_TYPE_CLONE = Uint16(8)
# CIM_ReplicationService.CreateElementReplica() 'Mode' parameter.
REPLICA_MODE_SYNC = Uint16(2)
REPLICA_MODE_ASYNC = Uint16(3)
+
+# CIM_StorageVolume['NameFormat']
+VOL_NAME_FORMAT_OTHER = 1
+VOL_NAME_FORMAT_NNA = 9
+VOL_NAME_FORMAT_EUI64 = 10
+VOL_NAME_FORMAT_T10VID = 11
+
+# CIM_StorageVolume['NameNamespace']
+VOL_NAME_SPACE_OTHER = 1
+VOL_NAME_SPACE_VPD83_TYPE3 = 2
+VOL_NAME_SPACE_VPD83_TYPE2 = 3
+VOL_NAME_SPACE_VPD83_TYPE1 = 4
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index ab5fd1b..5e9285b 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -587,17 +587,17 @@ class Smis(IStorageAreaNetwork):
if not (nf and nn and name):
return None
# SNIA might have miss documented VPD83Type3(1), it should be
- # VOL_NAME_FORMAT_OTHER(1) based on dmtf.
- # Will remove the Smis.VOL_NAME_FORMAT_OTHER condition if confirmed as
+ # dmtf.VOL_NAME_FORMAT_OTHER(1) based on dmtf.
+ # Will remove the Smis.dmtf.VOL_NAME_FORMAT_OTHER condition if confirmed as
# SNIA document fault.
- if (nf == VOL_NAME_FORMAT_NNA and
- nn == VOL_NAME_FORMAT_OTHER) or \
- (nf == VOL_NAME_FORMAT_NNA and
- nn == VOL_NAME_SPACE_VPD83_TYPE3) or \
- (nf == VOL_NAME_FORMAT_EUI64 and
- nn == VOL_NAME_SPACE_VPD83_TYPE2) or \
- (nf == VOL_NAME_FORMAT_T10VID and
- nn == VOL_NAME_SPACE_VPD83_TYPE1):
+ if (nf == dmtf.VOL_NAME_FORMAT_NNA and
+ nn == dmtf.VOL_NAME_FORMAT_OTHER) or \
+ (nf == dmtf.VOL_NAME_FORMAT_NNA and
+ nn == dmtf.VOL_NAME_SPACE_VPD83_TYPE3) or \
+ (nf == dmtf.VOL_NAME_FORMAT_EUI64 and
+ nn == dmtf.VOL_NAME_SPACE_VPD83_TYPE2) or \
+ (nf == dmtf.VOL_NAME_FORMAT_T10VID and
+ nn == dmtf.VOL_NAME_SPACE_VPD83_TYPE1):
return name

@staticmethod
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 2725762..1e3d7b5 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,29 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-# DMTF 2.29.1 (which SNIA SMI-S 1.6 based on)
-# CIM_StorageVolume['NameFormat']
-VOL_NAME_FORMAT_OTHER = 1
-VOL_NAME_FORMAT_VPD83_NNA6 = 2
-VOL_NAME_FORMAT_VPD83_NNA5 = 3
-VOL_NAME_FORMAT_VPD83_TYPE2 = 4
-VOL_NAME_FORMAT_VPD83_TYPE1 = 5
-VOL_NAME_FORMAT_VPD83_TYPE0 = 6
-VOL_NAME_FORMAT_SNVM = 7
-VOL_NAME_FORMAT_NODE_WWN = 8
-VOL_NAME_FORMAT_NNA = 9
-VOL_NAME_FORMAT_EUI64 = 10
-VOL_NAME_FORMAT_T10VID = 11
-
-# CIM_StorageVolume['NameNamespace']
-VOL_NAME_SPACE_OTHER = 1
-VOL_NAME_SPACE_VPD83_TYPE3 = 2
-VOL_NAME_SPACE_VPD83_TYPE2 = 3
-VOL_NAME_SPACE_VPD83_TYPE1 = 4
-VOL_NAME_SPACE_VPD80 = 5
-VOL_NAME_SPACE_NODE_WWN = 6
-VOL_NAME_SPACE_SNVM = 7
-
JOB_RETRIEVE_NONE = 0
JOB_RETRIEVE_VOLUME = 1
--
1.8.3.1
Gris Ge
2014-10-14 10:06:28 UTC
Permalink
* Move these constants into SmisCommon:
smis_constants.IAAN_WBEM_HTTP_PORT => SmisCommon.IAAN_WBEM_HTTP_PORT
smis_constants.IAAN_WBEM_HTTPS_PORT => SmisCommon.IAAN_WBEM_HTTPS_PORT
# These two constant is defined by IETF IAAN. Store in SmisCommon class
# which was supposed to hold non-dmtf constants.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis.py | 4 ++--
plugin/smispy/smis_common.py | 3 +++
plugin/smispy/smis_constants.py | 3 ---
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index d8fc9dd..be00810 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -233,12 +233,12 @@ class Smis(IStorageAreaNetwork):
Enumerate CIM_RegisteredProfile in userdefined namespace.
"""
protocol = 'http'
- port = IAAN_WBEM_HTTP_PORT
+ port = SmisCommon.IAAN_WBEM_HTTP_PORT
u = uri_parse(uri, ['scheme', 'netloc', 'host'], None)

if u['scheme'].lower() == 'smispy+ssl':
protocol = 'https'
- port = IAAN_WBEM_HTTPS_PORT
+ port = SmisCommon.IAAN_WBEM_HTTPS_PORT

if 'port' in u:
port = u['port']
diff --git a/plugin/smispy/smis_common.py b/plugin/smispy/smis_common.py
index bd80a9d..decbb51 100644
--- a/plugin/smispy/smis_common.py
+++ b/plugin/smispy/smis_common.py
@@ -173,6 +173,9 @@ class SmisCommon(object):
JOB_RETRIEVE_NONE = 0
JOB_RETRIEVE_VOLUME = 1

+ IAAN_WBEM_HTTP_PORT = 5988
+ IAAN_WBEM_HTTPS_PORT = 5989
+
def __init__(self, url, username, password,
namespace=dmtf.DEFAULT_NAMESPACE,
no_ssl_verify=False, debug=False, system_list=None):
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index a58e25b..74b270e 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,9 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-IAAN_WBEM_HTTP_PORT = 5988
-IAAN_WBEM_HTTPS_PORT = 5989
-

class RepSvc(object):
--
1.8.3.1
Gris Ge
2014-10-14 10:06:31 UTC
Permalink
* Replace smis_constants.CopyStates with dmtf.py constants:
smis_constants.CopyStates.SYNCHRONIZED
-> dmtf.COPY_STATE_SYNC

* Removed smis_constants.CopyStates unused constants:
smis_constants.CopyStates.INITIALIZED
smis_constants.CopyStates.UNSYNCHRONIZED
smis_constants.CopyStates.INACTIVE

* Remove smis_constants.CopyStates class.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 3 +++
plugin/smispy/smis.py | 3 +--
plugin/smispy/smis_constants.py | 7 -------
3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 2b572af..6805586 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -225,3 +225,6 @@ REPLICA_CAP_TYPE_ASYNC_SNAPSHOT_LOCAL = 7

REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL = 10
REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL = 11
+
+# CIM_Synchronized['CopyState']
+COPY_STATE_SYNC = Uint16(4)
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 974b956..147d417 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1160,8 +1160,7 @@ class Smis(IStorageAreaNetwork):
'SyncType': sync,
#'Mode': mode,
'SourceElement': lun.path,
- 'WaitForCopyState':
- pywbem.Uint16(CopyStates.SYNCHRONIZED)}
+ 'WaitForCopyState': dmtf.COPY_STATE_SYNC}

else:
# Check for older support via storage configuration service
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index a2fbe84..60f91b4 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -15,13 +15,6 @@
# USA


-class CopyStates(object):
- INITIALIZED = 2
- UNSYNCHRONIZED = 3
- SYNCHRONIZED = 4
- INACTIVE = 8
-
-
class CopyTypes(object):
ASYNC = 2 # Async. mirror
SYNC = 3 # Sync. mirror
--
1.8.3.1
Gris Ge
2014-10-14 10:06:29 UTC
Permalink
* Previously:
incorrect use
CIM_ReplicationServiceCapabilities['SupportedReplicationTypes'] --
2(Synchronous Mirror Local) for Capabilities.VOLUME_REPLICATE
capability.
Now:
Use CIM_ReplicationServiceCapabilities['SupportedSynchronousActions'] and
['SupportedAsynchronousActions'] -- 2(CreateElementReplica) for
Capabilities.VOLUME_REPLICATE capability.

* Remove smis_constants.RepSvc.Action class.
* Add dmtf.REPLICA_CAP_ACTION_CREATE_ELEMENT for 2(CreateElementReplica)
in CIM_ReplicationServiceCapabilities['SupportedSynchronousActions'] and
['SupportedAsynchronousActions'].

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 4 ++++
plugin/smispy/smis_cap.py | 8 ++++++--
plugin/smispy/smis_constants.py | 3 ---
3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index fbee538..8c81402 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -211,3 +211,7 @@ VOL_NAME_SPACE_OTHER = 1
VOL_NAME_SPACE_VPD83_TYPE3 = 2
VOL_NAME_SPACE_VPD83_TYPE2 = 3
VOL_NAME_SPACE_VPD83_TYPE1 = 4
+
+# CIM_ReplicationServiceCapabilities['SupportedAsynchronousActions']
+# or CIM_ReplicationServiceCapabilities['SupportedSynchronousActions']
+REPLICA_CAP_ACTION_CREATE_ELEMENT = 2
diff --git a/plugin/smispy/smis_cap.py b/plugin/smispy/smis_cap.py
index 0c9751d..4e9b9f1 100644
--- a/plugin/smispy/smis_cap.py
+++ b/plugin/smispy/smis_cap.py
@@ -37,10 +37,14 @@ def _rs_supported_capabilities(smis_common, system, cap):
ResultClass='CIM_ReplicationServiceCapabilities')[0]

s_rt = rs_cap['SupportedReplicationTypes']
+ async_actions = rs_cap['SupportedAsynchronousActions']
+ sync_actions = rs_cap['SupportedSynchronousActions']

- if RepSvc.Action.CREATE_ELEMENT_REPLICA in s_rt or \
- RepSvc.Action.CREATE_ELEMENT_REPLICA in s_rt:
+ if dmtf.REPLICA_CAP_ACTION_CREATE_ELEMENT in async_actions or \
+ dmtf.REPLICA_CAP_ACTION_CREATE_ELEMENT in sync_actions :
cap.set(Capabilities.VOLUME_REPLICATE)
+ else:
+ return

# Mirror support is not working and is not supported at this time.
# if RepSvc.RepTypes.SYNC_MIRROR_LOCAL in s_rt:
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 74b270e..141820d 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -17,9 +17,6 @@

class RepSvc(object):

- class Action(object):
- CREATE_ELEMENT_REPLICA = 2
-
class RepTypes(object):
# SMI-S replication service capabilities
SYNC_MIRROR_LOCAL = 2
--
1.8.3.1
Gris Ge
2014-10-14 10:06:32 UTC
Permalink
* Replaced smis_constants.CopyTypes by dmtf constants:
smis_constants.CopyTypes.ASYNC
-> dmtf.ST_CONF_CAP_COPY_TYPE_ASYNC
smis_constants.CopyTypes.SYNC
-> dmtf.ST_CONF_CAP_COPY_TYPE_SYNC
smis_constants.CopyTypes.UNSYNCASSOC
-> dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC
smis_constants.CopyTypes.UNSYNCUNASSOC
-> dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC

* Removed smis_constants.CopyTypes as all its constants moved out.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 6 ++++++
plugin/smispy/smis.py | 17 +++++++++--------
plugin/smispy/smis_cap.py | 13 ++-----------
plugin/smispy/smis_constants.py | 7 -------
4 files changed, 17 insertions(+), 26 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 6805586..08e8880 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -228,3 +228,9 @@ REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL = 11

# CIM_Synchronized['CopyState']
COPY_STATE_SYNC = Uint16(4)
+
+# CIM_StorageConfigurationCapabilities['SupportedCopyTypes']
+ST_CONF_CAP_COPY_TYPE_ASYNC = Uint16(2)
+ST_CONF_CAP_COPY_TYPE_SYNC = Uint16(3)
+ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC = Uint16(4)
+ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC = Uint16(5)
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 147d417..0a3b9e6 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1005,9 +1005,10 @@ class Smis(IStorageAreaNetwork):
# range of array vendors.

if 'SyncState' in s and 'CopyType' in s:
- if s['SyncState'] == \
- Synchronized.SyncState.SYNCHRONIZED and \
- (s['CopyType'] != CopyTypes.UNSYNCASSOC):
+ if s['SyncState'] == Synchronized.SyncState.SYNCHRONIZED \
+ and \
+ s['CopyType'] != \
+ dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC:
if 'SyncedElement' in s:
item = s['SyncedElement']

@@ -1174,16 +1175,16 @@ class Smis(IStorageAreaNetwork):

ct = Volume.REPLICATE_CLONE
if rep_type == Volume.REPLICATE_CLONE:
- ct = CopyTypes.UNSYNCASSOC
+ ct = dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC
elif rep_type == Volume.REPLICATE_COPY:
- ct = CopyTypes.UNSYNCUNASSOC
+ ct = dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC
elif rep_type == Volume.REPLICATE_MIRROR_ASYNC:
- ct = CopyTypes.ASYNC
+ ct = dmtf.ST_CONF_CAP_COPY_TYPE_ASYNC
elif rep_type == Volume.REPLICATE_MIRROR_SYNC:
- ct = CopyTypes.SYNC
+ ct = dmtf.ST_CONF_CAP_COPY_TYPE_SYNC

in_params = {'ElementName': name,
- 'CopyType': pywbem.Uint16(ct),
+ 'CopyType': ct,
'SourceElement': lun.path}
if rs:

diff --git a/plugin/smispy/smis_cap.py b/plugin/smispy/smis_cap.py
index cff4745..11efbc1 100644
--- a/plugin/smispy/smis_cap.py
+++ b/plugin/smispy/smis_cap.py
@@ -72,19 +72,10 @@ def _rs_supported_capabilities(smis_common, system, cap):
if sct and len(sct):
cap.set(Capabilities.VOLUME_REPLICATE)

- # Mirror support is not working and is not supported at
- # this time.
-
- # if CopyTypes.ASYNC in sct:
- # cap.set(Capabilities.VOLUME_REPLICATE_MIRROR_ASYNC)
-
- # if CopyTypes.SYNC in sct:
- # cap.set(Capabilities.VOLUME_REPLICATE_MIRROR_SYNC)
-
- if CopyTypes.UNSYNCASSOC in sct:
+ if dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC in sct:
cap.set(Capabilities.VOLUME_REPLICATE_CLONE)

- if CopyTypes.UNSYNCUNASSOC in sct:
+ if dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC in sct:
cap.set(Capabilities.VOLUME_REPLICATE_COPY)


diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 60f91b4..da701b7 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -15,13 +15,6 @@
# USA


-class CopyTypes(object):
- ASYNC = 2 # Async. mirror
- SYNC = 3 # Sync. mirror
- UNSYNCASSOC = 4 # lsm Clone
- UNSYNCUNASSOC = 5 # lsm Copy
-
-
class Synchronized(object):
class SyncState(object):
INITIALIZED = 2
--
1.8.3.1
Gris Ge
2014-10-14 10:06:25 UTC
Permalink
* Replaced these constants used by CreateElementReplica():
smis_constants.SYNC_TYPE_MIRROR
-> dmtf.SYNC_TYPE_MIRROR
smis_constants.SYNC_TYPE_SNAPSHOT
-> dmtf.SYNC_TYPE_SNAPSHOT
smis_constants.SYNC_TYPE_CLONE
-> dmtf.SYNC_TYPE_CLONE
smis_constants.CREATE_ELEMENT_REPLICA_MODE_SYNC
-> dmtf.REPLICA_MODE_SYNC
smis_constants.CREATE_ELEMENT_REPLICA_MODE_ASYNC
-> dmtf.REPLICA_MODE_ASYNC

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 11 +++++++++++
plugin/smispy/smis.py | 28 ++++++++++++++--------------
plugin/smispy/smis_constants.py | 7 -------
3 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 39f4942..00ca05f 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -188,3 +188,14 @@ JOB_STATE_NEW = 2
JOB_STATE_STARTING = 3
JOB_STATE_RUNNING = 4
JOB_STATE_COMPLETED = 7
+
+# CIM_Synchronized['SyncType'] also used by
+# CIM_ReplicationService.CreateElementReplica() 'SyncType' parameter.
+SYNC_TYPE_MIRROR = Uint16(6)
+SYNC_TYPE_SNAPSHOT = Uint16(7)
+SYNC_TYPE_CLONE = Uint16(8)
+
+# CIM_Synchronized['Mode'] also used by
+# CIM_ReplicationService.CreateElementReplica() 'Mode' parameter.
+REPLICA_MODE_SYNC = Uint16(2)
+REPLICA_MODE_ASYNC = Uint16(3)
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 56c3ca1..ab5fd1b 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1099,29 +1099,29 @@ class Smis(IStorageAreaNetwork):

if rep_type == Volume.REPLICATE_COPY:
if RepSvc.RepTypes.SYNC_CLONE_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_CLONE
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_SYNC
+ rc[0] = dmtf.SYNC_TYPE_CLONE
+ rc[1] = dmtf.REPLICA_MODE_SYNC
elif RepSvc.RepTypes.ASYNC_CLONE_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_CLONE
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_ASYNC
+ rc[0] = dmtf.SYNC_TYPE_CLONE
+ rc[1] = dmtf.REPLICA_MODE_ASYNC

elif rep_type == Volume.REPLICATE_MIRROR_ASYNC:
if RepSvc.RepTypes.ASYNC_MIRROR_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_MIRROR
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_ASYNC
+ rc[0] = dmtf.SYNC_TYPE_MIRROR
+ rc[1] = dmtf.REPLICA_MODE_ASYNC

elif rep_type == Volume.REPLICATE_MIRROR_SYNC:
if RepSvc.RepTypes.SYNC_MIRROR_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_MIRROR
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_SYNC
+ rc[0] = dmtf.SYNC_TYPE_MIRROR
+ rc[1] = dmtf.REPLICA_MODE_SYNC

elif rep_type == Volume.REPLICATE_CLONE:
if RepSvc.RepTypes.SYNC_CLONE_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_SNAPSHOT
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_SYNC
+ rc[0] = dmtf.SYNC_TYPE_SNAPSHOT
+ rc[1] = dmtf.REPLICA_MODE_SYNC
elif RepSvc.RepTypes.ASYNC_CLONE_LOCAL in s_rt:
- rc[0] = SYNC_TYPE_SNAPSHOT
- rc[1] = CREATE_ELEMENT_REPLICA_MODE_ASYNC
+ rc[0] = dmtf.SYNC_TYPE_SNAPSHOT
+ rc[1] = dmtf.REPLICA_MODE_ASYNC

if rc[0] is None:
raise LsmError(ErrorNumber.NO_SUPPORT,
@@ -1154,8 +1154,8 @@ class Smis(IStorageAreaNetwork):
volume_src.system_id, rep_type)

in_params = {'ElementName': name,
- 'SyncType': pywbem.Uint16(sync),
- #'Mode': pywbem.Uint16(mode),
+ 'SyncType': sync,
+ #'Mode': mode,
'SourceElement': lun.path,
'WaitForCopyState':
pywbem.Uint16(CopyStates.SYNCHRONIZED)}
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 6b5630f..2725762 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,9 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-# SMI-S replication enumerations
-(SYNC_TYPE_MIRROR, SYNC_TYPE_SNAPSHOT, SYNC_TYPE_CLONE) = (6, 7, 8)
-
# DMTF 2.29.1 (which SNIA SMI-S 1.6 based on)
# CIM_StorageVolume['NameFormat']
VOL_NAME_FORMAT_OTHER = 1
@@ -99,10 +96,6 @@ class Synchronized(object):
FROZEN = 14
COPY_IN_PROGRESS = 15

-# SMI-S mode for mirror updates
-(CREATE_ELEMENT_REPLICA_MODE_SYNC,
- CREATE_ELEMENT_REPLICA_MODE_ASYNC) = (2, 3)
-
# SMI-S volume 'OperationalStatus' enumerations
(VOL_OP_STATUS_OK, VOL_OP_STATUS_DEGRADED, VOL_OP_STATUS_ERR,
VOL_OP_STATUS_STARTING,
--
1.8.3.1
Gris Ge
2014-10-14 10:06:33 UTC
Permalink
* Replaced this constants by dmtf one:
smis_constants.Synchronized.SyncState.SYNCHRONIZED
-> dmtf.ST_SYNC_STATE_SYNCHRONIZED

* Removed unused constants in smis_constants.py:
smis_constants.Synchronized.SyncState.INITIALIZED
smis_constants.Synchronized.SyncState.PREPAREINPROGRESS
smis_constants.Synchronized.SyncState.PREPARED
smis_constants.Synchronized.SyncState.RESYNCINPROGRESS
smis_constants.Synchronized.SyncState.FRACTURE_IN_PROGRESS
smis_constants.Synchronized.SyncState.QUIESCEINPROGRESS
smis_constants.Synchronized.SyncState.QUIESCED
smis_constants.Synchronized.SyncState.RESTORE_IN_PROGRESSS
smis_constants.Synchronized.SyncState.IDLE
smis_constants.Synchronized.SyncState.BROKEN
smis_constants.Synchronized.SyncState.FRACTURED
smis_constants.Synchronized.SyncState.FROZEN
smis_constants.Synchronized.SyncState.COPY_IN_PROGRESS

* Remove smis_constants.Synchronized class as all its constants moved out.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 3 +++
plugin/smispy/smis.py | 3 +--
plugin/smispy/smis_constants.py | 17 -----------------
3 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 08e8880..6ab0a9f 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -234,3 +234,6 @@ ST_CONF_CAP_COPY_TYPE_ASYNC = Uint16(2)
ST_CONF_CAP_COPY_TYPE_SYNC = Uint16(3)
ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC = Uint16(4)
ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC = Uint16(5)
+
+# CIM_StorageSynchronized['SyncState']
+ST_SYNC_STATE_SYNCHRONIZED = 6
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 0a3b9e6..5e6d5d3 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1005,8 +1005,7 @@ class Smis(IStorageAreaNetwork):
# range of array vendors.

if 'SyncState' in s and 'CopyType' in s:
- if s['SyncState'] == Synchronized.SyncState.SYNCHRONIZED \
- and \
+ if s['SyncState'] == dmtf.ST_SYNC_STATE_SYNCHRONIZED and \
s['CopyType'] != \
dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC:
if 'SyncedElement' in s:
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index da701b7..6732c6f 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -15,23 +15,6 @@
# USA


-class Synchronized(object):
- class SyncState(object):
- INITIALIZED = 2
- PREPAREINPROGRESS = 3
- PREPARED = 4
- RESYNCINPROGRESS = 5
- SYNCHRONIZED = 6
- FRACTURE_IN_PROGRESS = 7
- QUIESCEINPROGRESS = 8
- QUIESCED = 9
- RESTORE_IN_PROGRESSS = 10
- IDLE = 11
- BROKEN = 12
- FRACTURED = 13
- FROZEN = 14
- COPY_IN_PROGRESS = 15
-
# SMI-S volume 'OperationalStatus' enumerations
(VOL_OP_STATUS_OK, VOL_OP_STATUS_DEGRADED, VOL_OP_STATUS_ERR,
VOL_OP_STATUS_STARTING,
--
1.8.3.1
Gris Ge
2014-10-14 10:06:34 UTC
Permalink
* Removed these unused constants of smis_constants.py:
CREATE_ELEMENT_REPLICA_MODE_SYNC
CREATE_ELEMENT_REPLICA_MODE_ASYNC
VOL_OP_STATUS_OK
VOL_OP_STATUS_DEGRADED
VOL_OP_STATUS_ERR
VOL_OP_STATUS_STARTING
VOL_OP_STATUS_DORMANT
EXPOSE_PATHS_DA_READ_ONLY

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis_constants.py | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 6732c6f..a62ddd2 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,11 +14,4 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-
-# SMI-S volume 'OperationalStatus' enumerations
-(VOL_OP_STATUS_OK, VOL_OP_STATUS_DEGRADED, VOL_OP_STATUS_ERR,
- VOL_OP_STATUS_STARTING,
- VOL_OP_STATUS_DORMANT) = (2, 3, 6, 8, 15)
-
-# SMI-S ExposePaths device access enumerations
-(EXPOSE_PATHS_DA_READ_WRITE, EXPOSE_PATHS_DA_READ_ONLY) = (2, 3)
+EXPOSE_PATHS_DA_READ_WRITE = 2
--
1.8.3.1
Gris Ge
2014-10-14 10:06:27 UTC
Permalink
* Move these constants to SmisCommon:
smis_constants.JOB_RETRIEVE_NONE => SmisCommon.JOB_RETRIEVE_NONE
smis_constants.JOB_RETRIEVE_VOLUME => SmisCommon.JOB_RETRIEVE_VOLUME
# These two constants is just for plugin internal use, not a SNIA or DMTF
# constant.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis.py | 26 +++++++++++++++-----------
plugin/smispy/smis_common.py | 3 +++
plugin/smispy/smis_constants.py | 3 ---
3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 5e9285b..d8fc9dd 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -181,7 +181,7 @@ class Smis(IStorageAreaNetwork):
"""
# Check to see if operation is done
if rc == SmisCommon.SNIA_INVOKE_OK:
- if retrieve_data == JOB_RETRIEVE_VOLUME:
+ if retrieve_data == SmisCommon.JOB_RETRIEVE_VOLUME:
return None, self._new_vol_from_name(out)
else:
return None, None
@@ -343,7 +343,7 @@ class Smis(IStorageAreaNetwork):

if Smis._job_completed_ok(cim_job):
(ignore, retrieve_data) = self._parse_job_id(job_id)
- if retrieve_data == JOB_RETRIEVE_VOLUME:
+ if retrieve_data == SmisCommon.JOB_RETRIEVE_VOLUME:
completed_item = self._new_vol_from_job(cim_job)
else:
status = JobStatus.ERROR
@@ -431,7 +431,8 @@ class Smis(IStorageAreaNetwork):
"""
Return the MD5 has of CIM_ConcreteJob['InstanceID'] in conjunction
with '@%s' % retrieve_data
- retrieve_data should be JOB_RETRIEVE_NONE or JOB_RETRIEVE_VOLUME or etc
+ retrieve_data should be SmisCommon.JOB_RETRIEVE_NONE or
+ SmisCommon.JOB_RETRIEVE_VOLUME or etc
"""
return "%s@%d" % (self._id('Job', cim_job), int(retrieve_data))

@@ -482,7 +483,7 @@ class Smis(IStorageAreaNetwork):
"""
tmp_list = job_id.split('@', 2)
md5_str = tmp_list[0]
- retrieve_data = JOB_RETRIEVE_NONE
+ retrieve_data = SmisCommon.JOB_RETRIEVE_NONE
if len(tmp_list) == 2:
retrieve_data = int(tmp_list[1])
return (md5_str, retrieve_data)
@@ -872,7 +873,8 @@ class Smis(IStorageAreaNetwork):
'Size': pywbem.Uint64(size_bytes)}

try:
- return self._pi("volume_create", JOB_RETRIEVE_VOLUME,
+ return self._pi("volume_create",
+ SmisCommon.JOB_RETRIEVE_VOLUME,
*(self._c.InvokeMethod(
'CreateOrModifyElementFromStoragePool',
scs.path, **in_params)))
@@ -902,7 +904,8 @@ class Smis(IStorageAreaNetwork):
in_params = {'Operation': pywbem.Uint16(2),
'Synchronization': sync.path}

- job_id = self._pi("_detach", JOB_RETRIEVE_NONE,
+ job_id = self._pi("_detach",
+ SmisCommon.JOB_RETRIEVE_NONE,
*(self._c.InvokeMethod(
'ModifySynchronization', scs.path,
**in_params)))[0]
@@ -920,7 +923,7 @@ class Smis(IStorageAreaNetwork):
in_params = {'Operation': pywbem.Uint16(8),
'Synchronization': sync.path}

- job_id = self._pi("_detach", JOB_RETRIEVE_NONE,
+ job_id = self._pi("_detach", SmisCommon.JOB_RETRIEVE_NONE,
*(self._c.InvokeMethod(
'ModifyReplicaSynchronization', rs.path,
**in_params)))[0]
@@ -1028,7 +1031,7 @@ class Smis(IStorageAreaNetwork):
in_params = {'TheElement': lun.path}

#Delete returns None or Job number
- return self._pi("volume_delete", JOB_RETRIEVE_NONE,
+ return self._pi("volume_delete", SmisCommon.JOB_RETRIEVE_NONE,
*(self._c.InvokeMethod('ReturnToStoragePool',
scs.path, **in_params)))[0]

@@ -1055,7 +1058,7 @@ class Smis(IStorageAreaNetwork):
in_params = {'TheElement': lun.path}

# Delete returns None or Job number
- return self._pi("volume_delete", JOB_RETRIEVE_NONE,
+ return self._pi("volume_delete", SmisCommon.JOB_RETRIEVE_NONE,
*(self._c.InvokeMethod('ReturnToStoragePool',
scs.path,
**in_params)))[0]
@@ -1073,7 +1076,7 @@ class Smis(IStorageAreaNetwork):
'TheElement': lun.path,
'Size': pywbem.Uint64(new_size_bytes)}

- return self._pi("volume_resize", JOB_RETRIEVE_VOLUME,
+ return self._pi("volume_resize", SmisCommon.JOB_RETRIEVE_VOLUME,
*(self._c.InvokeMethod(
'CreateOrModifyElementFromStoragePool',
scs.path, **in_params)))
@@ -1190,7 +1193,8 @@ class Smis(IStorageAreaNetwork):

try:

- return self._pi("volume_replicate", JOB_RETRIEVE_VOLUME,
+ return self._pi("volume_replicate",
+ SmisCommon.JOB_RETRIEVE_VOLUME,
*(self._c.InvokeMethod(method,
rs.path, **in_params)))
except CIMError:
diff --git a/plugin/smispy/smis_common.py b/plugin/smispy/smis_common.py
index 059d838..bd80a9d 100644
--- a/plugin/smispy/smis_common.py
+++ b/plugin/smispy/smis_common.py
@@ -170,6 +170,9 @@ class SmisCommon(object):
_PRODUCT_MEGARAID = 'LSI MegaRAID'
_PRODUCT_NETAPP_E = 'NetApp-E'

+ JOB_RETRIEVE_NONE = 0
+ JOB_RETRIEVE_VOLUME = 1
+
def __init__(self, url, username, password,
namespace=dmtf.DEFAULT_NAMESPACE,
no_ssl_verify=False, debug=False, system_list=None):
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 1e3d7b5..a58e25b 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,9 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-JOB_RETRIEVE_NONE = 0
-JOB_RETRIEVE_VOLUME = 1
-
IAAN_WBEM_HTTP_PORT = 5988
IAAN_WBEM_HTTPS_PORT = 5989
--
1.8.3.1
Gris Ge
2014-10-14 10:06:35 UTC
Permalink
* Replace smis_constants.EXPOSE_PATHS_DA_READ_WRITE with
dmtf.CTRL_CONF_SRV_DA_RW

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 3 +++
plugin/smispy/smis.py | 4 +---
plugin/smispy/smis_constants.py | 2 --
3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 6ab0a9f..5e30bac 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -237,3 +237,6 @@ ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC = Uint16(5)

# CIM_StorageSynchronized['SyncState']
ST_SYNC_STATE_SYNCHRONIZED = 6
+
+# CIM_ControllerConfigurationService.ExposePaths(DeviceAccesses)
+CTRL_CONF_SRV_DA_RW = Uint16(2)
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 5e6d5d3..3b2a61a 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1416,11 +1416,9 @@ class Smis(IStorageAreaNetwork):
cim_vol = self._get_cim_instance_by_id(
'Volume', volume.id, ['Name'], raise_error=True)

- da = EXPOSE_PATHS_DA_READ_WRITE
-
in_params = {'LUNames': [cim_vol['Name']],
'ProtocolControllers': [cim_spc.path],
- 'DeviceAccesses': [pywbem.Uint16(da)]}
+ 'DeviceAccesses': [dmtf.CTRL_CONF_SRV_DA_RW]}

(rc, out) = self._c.InvokeMethod(
'ExposePaths',
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index a62ddd2..40ebc20 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -13,5 +13,3 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA
-
-EXPOSE_PATHS_DA_READ_WRITE = 2
--
1.8.3.1
Gris Ge
2014-10-14 10:06:36 UTC
Permalink
* Remove empty smis_constants.py file.
* Makefile and rpm SPEC file updated

Signed-off-by: Gris Ge <***@redhat.com>
---
packaging/libstoragemgmt.spec.in | 1 -
plugin/Makefile.am | 1 -
plugin/smispy/smis.py | 1 -
plugin/smispy/smis_cap.py | 1 -
plugin/smispy/smis_constants.py | 15 ---------------
5 files changed, 19 deletions(-)
delete mode 100644 plugin/smispy/smis_constants.py

diff --git a/packaging/libstoragemgmt.spec.in b/packaging/libstoragemgmt.spec.in
index 69f9a3e..f84266c 100644
--- a/packaging/libstoragemgmt.spec.in
+++ b/packaging/libstoragemgmt.spec.in
@@ -322,7 +322,6 @@ fi
%{python_sitelib}/lsm/plugin/smispy/smis.*
%{python_sitelib}/lsm/plugin/smispy/dmtf.*
%{python_sitelib}/lsm/plugin/smispy/utils.*
-%{python_sitelib}/lsm/plugin/smispy/smis_constants.*
%{python_sitelib}/lsm/plugin/smispy/smis_common.*
%{python_sitelib}/lsm/plugin/smispy/smis_cap.*
%{python_sitelib}/lsm/plugin/smispy/smis_sys.*
diff --git a/plugin/Makefile.am b/plugin/Makefile.am
index df8907d..c3084c9 100644
--- a/plugin/Makefile.am
+++ b/plugin/Makefile.am
@@ -26,7 +26,6 @@ smispy_PYTHON = \
smispy/__init__.py \
smispy/smis.py \
smispy/utils.py \
- smispy/smis_constants.py \
smispy/smis_common.py \
smispy/dmtf.py \
smispy/smis_cap.py \
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 3b2a61a..4b78a74 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -28,7 +28,6 @@ import re

import pywbem
from pywbem import CIMError
-from smis_constants import *
import smis_cap
import smis_sys
import smis_pool
diff --git a/plugin/smispy/smis_cap.py b/plugin/smispy/smis_cap.py
index 11efbc1..1309056 100644
--- a/plugin/smispy/smis_cap.py
+++ b/plugin/smispy/smis_cap.py
@@ -15,7 +15,6 @@
# USA

from lsm import Capabilities, LsmError, ErrorNumber
-from smis_constants import *
import dmtf
from smis_common import SmisCommon

diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
deleted file mode 100644
index 40ebc20..0000000
--- a/plugin/smispy/smis_constants.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (C) 2014 Red Hat, Inc.
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
-# USA
--
1.8.3.1
Gris Ge
2014-10-14 10:06:30 UTC
Permalink
* Replace smis_constants.RepSvc with these constants in dmtf.py:
RepSvc.RepTypes.SYNC_SNAPSHOT_LOCAL
-> dmtf.REPLICA_CAP_TYPE_SYNC_SNAPSHOT_LOCAL
RepSvc.RepTypes.ASYNC_SNAPSHOT_LOCAL
-> dmtf.REPLICA_CAP_TYPE_ASYNC_SNAPSHOT_LOCAL
RepSvc.RepTypes.SYNC_CLONE_LOCAL
-> dmtf.REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL
RepSvc.RepTypes.ASYNC_CLONE_LOCAL
-> dmtf.REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL
RepSvc.RepTypes.SYNC_MIRROR_LOCAL
-> dmtf.REPLICA_CAP_TYPE_SYNC_MIRROR_LOCAL
RepSvc.RepTypes.ASYNC_MIRROR_LOCAL
-> dmtf.REPLICA_CAP_TYPE_ASYNC_MIRROR_LOCAL

* Removed these unused constants:
RepSvc.RepTypes.SYNC_MIRROR_REMOTE
RepSvc.RepTypes.ASYNC_MIRROR_REMOTE
RepSvc.RepTypes.SYNC_CLONE_REMOTE
RepSvc.RepTypes.ASYNC_CLONE_REMOTE

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 10 ++++++++++
plugin/smispy/smis.py | 12 ++++++------
plugin/smispy/smis_cap.py | 16 ++++------------
plugin/smispy/smis_constants.py | 18 ------------------
4 files changed, 20 insertions(+), 36 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 8c81402..2b572af 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -215,3 +215,13 @@ VOL_NAME_SPACE_VPD83_TYPE1 = 4
# CIM_ReplicationServiceCapabilities['SupportedAsynchronousActions']
# or CIM_ReplicationServiceCapabilities['SupportedSynchronousActions']
REPLICA_CAP_ACTION_CREATE_ELEMENT = 2
+
+# CIM_ReplicationServiceCapabilities['SupportedReplicationTypes']
+REPLICA_CAP_TYPE_SYNC_MIRROR_LOCAL = 2
+REPLICA_CAP_TYPE_ASYNC_MIRROR_LOCAL = 3
+
+REPLICA_CAP_TYPE_SYNC_SNAPSHOT_LOCAL = 6
+REPLICA_CAP_TYPE_ASYNC_SNAPSHOT_LOCAL = 7
+
+REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL = 10
+REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL = 11
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index be00810..974b956 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1101,28 +1101,28 @@ class Smis(IStorageAreaNetwork):
s_rt = rs_cap['SupportedReplicationTypes']

if rep_type == Volume.REPLICATE_COPY:
- if RepSvc.RepTypes.SYNC_CLONE_LOCAL in s_rt:
+ if dmtf.REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL in s_rt:
rc[0] = dmtf.SYNC_TYPE_CLONE
rc[1] = dmtf.REPLICA_MODE_SYNC
- elif RepSvc.RepTypes.ASYNC_CLONE_LOCAL in s_rt:
+ elif dmtf.REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL in s_rt:
rc[0] = dmtf.SYNC_TYPE_CLONE
rc[1] = dmtf.REPLICA_MODE_ASYNC

elif rep_type == Volume.REPLICATE_MIRROR_ASYNC:
- if RepSvc.RepTypes.ASYNC_MIRROR_LOCAL in s_rt:
+ if dmtf.REPLICA_CAP_TYPE_ASYNC_MIRROR_LOCAL in s_rt:
rc[0] = dmtf.SYNC_TYPE_MIRROR
rc[1] = dmtf.REPLICA_MODE_ASYNC

elif rep_type == Volume.REPLICATE_MIRROR_SYNC:
- if RepSvc.RepTypes.SYNC_MIRROR_LOCAL in s_rt:
+ if dmtf.REPLICA_CAP_TYPE_SYNC_MIRROR_LOCAL in s_rt:
rc[0] = dmtf.SYNC_TYPE_MIRROR
rc[1] = dmtf.REPLICA_MODE_SYNC

elif rep_type == Volume.REPLICATE_CLONE:
- if RepSvc.RepTypes.SYNC_CLONE_LOCAL in s_rt:
+ if dmtf.REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL in s_rt:
rc[0] = dmtf.SYNC_TYPE_SNAPSHOT
rc[1] = dmtf.REPLICA_MODE_SYNC
- elif RepSvc.RepTypes.ASYNC_CLONE_LOCAL in s_rt:
+ elif dmtf.REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL in s_rt:
rc[0] = dmtf.SYNC_TYPE_SNAPSHOT
rc[1] = dmtf.REPLICA_MODE_ASYNC

diff --git a/plugin/smispy/smis_cap.py b/plugin/smispy/smis_cap.py
index 4e9b9f1..cff4745 100644
--- a/plugin/smispy/smis_cap.py
+++ b/plugin/smispy/smis_cap.py
@@ -46,20 +46,12 @@ def _rs_supported_capabilities(smis_common, system, cap):
else:
return

- # Mirror support is not working and is not supported at this time.
- # if RepSvc.RepTypes.SYNC_MIRROR_LOCAL in s_rt:
- # cap.set(Capabilities.DeviceID)
-
- # if RepSvc.RepTypes.ASYNC_MIRROR_LOCAL \
- # in s_rt:
- # cap.set(Capabilities.VOLUME_REPLICATE_MIRROR_ASYNC)
-
- if RepSvc.RepTypes.SYNC_SNAPSHOT_LOCAL in s_rt or \
- RepSvc.RepTypes.ASYNC_SNAPSHOT_LOCAL in s_rt:
+ if dmtf.REPLICA_CAP_TYPE_SYNC_SNAPSHOT_LOCAL in s_rt or \
+ dmtf.REPLICA_CAP_TYPE_ASYNC_SNAPSHOT_LOCAL in s_rt:
cap.set(Capabilities.VOLUME_REPLICATE_CLONE)

- if RepSvc.RepTypes.SYNC_CLONE_LOCAL in s_rt or \
- RepSvc.RepTypes.ASYNC_CLONE_LOCAL in s_rt:
+ if dmtf.REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL in s_rt or \
+ dmtf.REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL in s_rt:
cap.set(Capabilities.VOLUME_REPLICATE_COPY)
else:
# Try older storage configuration service
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 141820d..a2fbe84 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -15,24 +15,6 @@
# USA


-class RepSvc(object):
-
- class RepTypes(object):
- # SMI-S replication service capabilities
- SYNC_MIRROR_LOCAL = 2
- ASYNC_MIRROR_LOCAL = 3
- SYNC_MIRROR_REMOTE = 4
- ASYNC_MIRROR_REMOTE = 5
- SYNC_SNAPSHOT_LOCAL = 6
- ASYNC_SNAPSHOT_LOCAL = 7
- SYNC_SNAPSHOT_REMOTE = 8
- ASYNC_SNAPSHOT_REMOTE = 9
- SYNC_CLONE_LOCAL = 10
- ASYNC_CLONE_LOCAL = 11
- SYNC_CLONE_REMOTE = 12
- ASYNC_CLONE_REMOTE = 13
-
-
class CopyStates(object):
INITIALIZED = 2
UNSYNCHRONIZED = 3
--
1.8.3.1
Gris Ge
2014-10-11 08:56:25 UTC
Permalink
* Replace smis_constants.CopyStates with dmtf.py constants:
smis_constants.CopyStates.SYNCHRONIZED
-> dmtf.COPY_STATE_SYNC

* Removed smis_constants.CopyStates unused constants:
smis_constants.CopyStates.INITIALIZED
smis_constants.CopyStates.UNSYNCHRONIZED
smis_constants.CopyStates.INACTIVE

* Remove smis_constants.CopyStates class.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 3 +++
plugin/smispy/smis.py | 3 +--
plugin/smispy/smis_constants.py | 7 -------
3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 8432715..d3524db 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -222,3 +222,6 @@ REPLICA_CAP_TYPE_ASYNC_SNAPSHOT_LOCAL = 7

REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL = 10
REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL = 11
+
+# CIM_Synchronized['CopyState']
+COPY_STATE_SYNC = Uint16(4)
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index be00810..62aec47 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1160,8 +1160,7 @@ class Smis(IStorageAreaNetwork):
'SyncType': sync,
#'Mode': mode,
'SourceElement': lun.path,
- 'WaitForCopyState':
- pywbem.Uint16(CopyStates.SYNCHRONIZED)}
+ 'WaitForCopyState': dmtf.COPY_STATE_SYNC}

else:
# Check for older support via storage configuration service
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index a2fbe84..60f91b4 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -15,13 +15,6 @@
# USA


-class CopyStates(object):
- INITIALIZED = 2
- UNSYNCHRONIZED = 3
- SYNCHRONIZED = 4
- INACTIVE = 8
-
-
class CopyTypes(object):
ASYNC = 2 # Async. mirror
SYNC = 3 # Sync. mirror
--
1.7.1
Gris Ge
2014-10-11 08:56:26 UTC
Permalink
* Replaced smis_constants.CopyTypes by dmtf constants:
smis_constants.CopyTypes.ASYNC
-> dmtf.ST_CONF_CAP_COPY_TYPE_ASYNC
smis_constants.CopyTypes.SYNC
-> dmtf.ST_CONF_CAP_COPY_TYPE_SYNC
smis_constants.CopyTypes.UNSYNCASSOC
-> dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC
smis_constants.CopyTypes.UNSYNCUNASSOC
-> dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC

* Removed smis_constants.CopyTypes as all its constants moved out.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 6 ++++++
plugin/smispy/smis.py | 17 +++++++++--------
plugin/smispy/smis_cap.py | 13 ++-----------
plugin/smispy/smis_constants.py | 7 -------
4 files changed, 17 insertions(+), 26 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index d3524db..f80320a 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -225,3 +225,9 @@ REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL = 11

# CIM_Synchronized['CopyState']
COPY_STATE_SYNC = Uint16(4)
+
+# CIM_StorageConfigurationCapabilities['SupportedCopyTypes']
+ST_CONF_CAP_COPY_TYPE_ASYNC = Uint16(2)
+ST_CONF_CAP_COPY_TYPE_SYNC = Uint16(3)
+ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC = Uint16(4)
+ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC = Uint16(5)
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 62aec47..fe38276 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1005,9 +1005,10 @@ class Smis(IStorageAreaNetwork):
# range of array vendors.

if 'SyncState' in s and 'CopyType' in s:
- if s['SyncState'] == \
- Synchronized.SyncState.SYNCHRONIZED and \
- (s['CopyType'] != CopyTypes.UNSYNCASSOC):
+ if s['SyncState'] == Synchronized.SyncState.SYNCHRONIZED \
+ and \
+ s['CopyType'] != \
+ dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC:
if 'SyncedElement' in s:
item = s['SyncedElement']

@@ -1174,16 +1175,16 @@ class Smis(IStorageAreaNetwork):

ct = Volume.REPLICATE_CLONE
if rep_type == Volume.REPLICATE_CLONE:
- ct = CopyTypes.UNSYNCASSOC
+ ct = dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC
elif rep_type == Volume.REPLICATE_COPY:
- ct = CopyTypes.UNSYNCUNASSOC
+ ct = dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC
elif rep_type == Volume.REPLICATE_MIRROR_ASYNC:
- ct = CopyTypes.ASYNC
+ ct = dmtf.ST_CONF_CAP_COPY_TYPE_ASYNC
elif rep_type == Volume.REPLICATE_MIRROR_SYNC:
- ct = CopyTypes.SYNC
+ ct = dmtf.ST_CONF_CAP_COPY_TYPE_SYNC

in_params = {'ElementName': name,
- 'CopyType': pywbem.Uint16(ct),
+ 'CopyType': ct,
'SourceElement': lun.path}
if rs:

diff --git a/plugin/smispy/smis_cap.py b/plugin/smispy/smis_cap.py
index cff4745..11efbc1 100644
--- a/plugin/smispy/smis_cap.py
+++ b/plugin/smispy/smis_cap.py
@@ -72,19 +72,10 @@ def _rs_supported_capabilities(smis_common, system, cap):
if sct and len(sct):
cap.set(Capabilities.VOLUME_REPLICATE)

- # Mirror support is not working and is not supported at
- # this time.
-
- # if CopyTypes.ASYNC in sct:
- # cap.set(Capabilities.VOLUME_REPLICATE_MIRROR_ASYNC)
-
- # if CopyTypes.SYNC in sct:
- # cap.set(Capabilities.VOLUME_REPLICATE_MIRROR_SYNC)
-
- if CopyTypes.UNSYNCASSOC in sct:
+ if dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC in sct:
cap.set(Capabilities.VOLUME_REPLICATE_CLONE)

- if CopyTypes.UNSYNCUNASSOC in sct:
+ if dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC in sct:
cap.set(Capabilities.VOLUME_REPLICATE_COPY)


diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 60f91b4..da701b7 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -15,13 +15,6 @@
# USA


-class CopyTypes(object):
- ASYNC = 2 # Async. mirror
- SYNC = 3 # Sync. mirror
- UNSYNCASSOC = 4 # lsm Clone
- UNSYNCUNASSOC = 5 # lsm Copy
-
-
class Synchronized(object):
class SyncState(object):
INITIALIZED = 2
--
1.7.1
Gris Ge
2014-10-11 08:56:27 UTC
Permalink
* Replaced this constants by dmtf one:
smis_constants.Synchronized.SyncState.SYNCHRONIZED
-> dmtf.ST_SYNC_STATE_SYNCHRONIZED

* Removed unused constants in smis_constants.py:
smis_constants.Synchronized.SyncState.INITIALIZED
smis_constants.Synchronized.SyncState.PREPAREINPROGRESS
smis_constants.Synchronized.SyncState.PREPARED
smis_constants.Synchronized.SyncState.RESYNCINPROGRESS
smis_constants.Synchronized.SyncState.FRACTURE_IN_PROGRESS
smis_constants.Synchronized.SyncState.QUIESCEINPROGRESS
smis_constants.Synchronized.SyncState.QUIESCED
smis_constants.Synchronized.SyncState.RESTORE_IN_PROGRESSS
smis_constants.Synchronized.SyncState.IDLE
smis_constants.Synchronized.SyncState.BROKEN
smis_constants.Synchronized.SyncState.FRACTURED
smis_constants.Synchronized.SyncState.FROZEN
smis_constants.Synchronized.SyncState.COPY_IN_PROGRESS

* Remove smis_constants.Synchronized class as all its constants moved out.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 3 +++
plugin/smispy/smis.py | 3 +--
plugin/smispy/smis_constants.py | 17 -----------------
3 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index f80320a..1819f45 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -231,3 +231,6 @@ ST_CONF_CAP_COPY_TYPE_ASYNC = Uint16(2)
ST_CONF_CAP_COPY_TYPE_SYNC = Uint16(3)
ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC = Uint16(4)
ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC = Uint16(5)
+
+# CIM_StorageSynchronized['SyncState']
+ST_SYNC_STATE_SYNCHRONIZED = 6
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index fe38276..d6f53da 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1005,8 +1005,7 @@ class Smis(IStorageAreaNetwork):
# range of array vendors.

if 'SyncState' in s and 'CopyType' in s:
- if s['SyncState'] == Synchronized.SyncState.SYNCHRONIZED \
- and \
+ if s['SyncState'] == dmtf.ST_SYNC_STATE_SYNCHRONIZED and \
s['CopyType'] != \
dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC:
if 'SyncedElement' in s:
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index da701b7..6732c6f 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -15,23 +15,6 @@
# USA


-class Synchronized(object):
- class SyncState(object):
- INITIALIZED = 2
- PREPAREINPROGRESS = 3
- PREPARED = 4
- RESYNCINPROGRESS = 5
- SYNCHRONIZED = 6
- FRACTURE_IN_PROGRESS = 7
- QUIESCEINPROGRESS = 8
- QUIESCED = 9
- RESTORE_IN_PROGRESSS = 10
- IDLE = 11
- BROKEN = 12
- FRACTURED = 13
- FROZEN = 14
- COPY_IN_PROGRESS = 15
-
# SMI-S volume 'OperationalStatus' enumerations
(VOL_OP_STATUS_OK, VOL_OP_STATUS_DEGRADED, VOL_OP_STATUS_ERR,
VOL_OP_STATUS_STARTING,
--
1.7.1
Gris Ge
2014-10-11 08:56:28 UTC
Permalink
* Removed these unused constants of smis_constants.py:
CREATE_ELEMENT_REPLICA_MODE_SYNC
CREATE_ELEMENT_REPLICA_MODE_ASYNC
VOL_OP_STATUS_OK
VOL_OP_STATUS_DEGRADED
VOL_OP_STATUS_ERR
VOL_OP_STATUS_STARTING
VOL_OP_STATUS_DORMANT
EXPOSE_PATHS_DA_READ_ONLY

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis_constants.py | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 6732c6f..a62ddd2 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,11 +14,4 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-
-# SMI-S volume 'OperationalStatus' enumerations
-(VOL_OP_STATUS_OK, VOL_OP_STATUS_DEGRADED, VOL_OP_STATUS_ERR,
- VOL_OP_STATUS_STARTING,
- VOL_OP_STATUS_DORMANT) = (2, 3, 6, 8, 15)
-
-# SMI-S ExposePaths device access enumerations
-(EXPOSE_PATHS_DA_READ_WRITE, EXPOSE_PATHS_DA_READ_ONLY) = (2, 3)
+EXPOSE_PATHS_DA_READ_WRITE = 2
--
1.7.1
Gris Ge
2014-10-11 08:56:29 UTC
Permalink
* Replace smis_constants.EXPOSE_PATHS_DA_READ_WRITE with
dmtf.CTRL_CONF_SRV_DA_RW

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 3 +++
plugin/smispy/smis.py | 4 +---
plugin/smispy/smis_constants.py | 2 --
3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 1819f45..cae0e32 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -234,3 +234,6 @@ ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC = Uint16(5)

# CIM_StorageSynchronized['SyncState']
ST_SYNC_STATE_SYNCHRONIZED = 6
+
+# CIM_ControllerConfigurationService.ExposePaths(DeviceAccesses)
+CTRL_CONF_SRV_DA_RW = Uint16(2)
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index d6f53da..712f196 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1416,11 +1416,9 @@ class Smis(IStorageAreaNetwork):
cim_vol = self._get_cim_instance_by_id(
'Volume', volume.id, ['Name'], raise_error=True)

- da = EXPOSE_PATHS_DA_READ_WRITE
-
in_params = {'LUNames': [cim_vol['Name']],
'ProtocolControllers': [cim_spc.path],
- 'DeviceAccesses': [pywbem.Uint16(da)]}
+ 'DeviceAccesses': [dmtf.CTRL_CONF_SRV_DA_RW]}

(rc, out) = self._c.InvokeMethod(
'ExposePaths',
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index a62ddd2..40ebc20 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -13,5 +13,3 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA
-
-EXPOSE_PATHS_DA_READ_WRITE = 2
--
1.7.1
Gris Ge
2014-10-11 08:56:30 UTC
Permalink
* Remove empty smis_constants.py file.
* Makefile and rpm SPEC file updated

Signed-off-by: Gris Ge <***@redhat.com>
---
packaging/libstoragemgmt.spec.in | 1 -
plugin/Makefile.am | 1 -
plugin/smispy/smis.py | 1 -
plugin/smispy/smis_cap.py | 1 -
plugin/smispy/smis_constants.py | 15 ---------------
5 files changed, 0 insertions(+), 19 deletions(-)
delete mode 100644 plugin/smispy/smis_constants.py

diff --git a/packaging/libstoragemgmt.spec.in b/packaging/libstoragemgmt.spec.in
index 69f9a3e..f84266c 100644
--- a/packaging/libstoragemgmt.spec.in
+++ b/packaging/libstoragemgmt.spec.in
@@ -322,7 +322,6 @@ fi
%{python_sitelib}/lsm/plugin/smispy/smis.*
%{python_sitelib}/lsm/plugin/smispy/dmtf.*
%{python_sitelib}/lsm/plugin/smispy/utils.*
-%{python_sitelib}/lsm/plugin/smispy/smis_constants.*
%{python_sitelib}/lsm/plugin/smispy/smis_common.*
%{python_sitelib}/lsm/plugin/smispy/smis_cap.*
%{python_sitelib}/lsm/plugin/smispy/smis_sys.*
diff --git a/plugin/Makefile.am b/plugin/Makefile.am
index df8907d..c3084c9 100644
--- a/plugin/Makefile.am
+++ b/plugin/Makefile.am
@@ -26,7 +26,6 @@ smispy_PYTHON = \
smispy/__init__.py \
smispy/smis.py \
smispy/utils.py \
- smispy/smis_constants.py \
smispy/smis_common.py \
smispy/dmtf.py \
smispy/smis_cap.py \
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 712f196..382f414 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -28,7 +28,6 @@ import re

import pywbem
from pywbem import CIMError
-from smis_constants import *
import smis_cap
import smis_sys
import smis_pool
diff --git a/plugin/smispy/smis_cap.py b/plugin/smispy/smis_cap.py
index 11efbc1..1309056 100644
--- a/plugin/smispy/smis_cap.py
+++ b/plugin/smispy/smis_cap.py
@@ -15,7 +15,6 @@
# USA

from lsm import Capabilities, LsmError, ErrorNumber
-from smis_constants import *
import dmtf
from smis_common import SmisCommon

diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
deleted file mode 100644
index 40ebc20..0000000
--- a/plugin/smispy/smis_constants.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (C) 2014 Red Hat, Inc.
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
-# USA
--
1.7.1
Gris Ge
2014-10-09 07:28:37 UTC
Permalink
* Move these constants into dmtf.
VOL_NAME_FORMAT_OTHER
VOL_NAME_FORMAT_NNA
VOL_NAME_FORMAT_EUI64
VOL_NAME_FORMAT_T10VID

VOL_NAME_SPACE_OTHER
VOL_NAME_SPACE_VPD83_TYPE3
VOL_NAME_SPACE_VPD83_TYPE2
VOL_NAME_SPACE_VPD83_TYPE1

* Removed these unused constants:
VOL_NAME_FORMAT_VPD83_NNA6
VOL_NAME_FORMAT_VPD83_NNA5
VOL_NAME_FORMAT_VPD83_TYPE2
VOL_NAME_FORMAT_VPD83_TYPE1
VOL_NAME_FORMAT_VPD83_TYPE0
VOL_NAME_FORMAT_SNVM
VOL_NAME_FORMAT_NODE_WWN

VOL_NAME_SPACE_OTHER
VOL_NAME_SPACE_VPD80
VOL_NAME_SPACE_NODE_WWN
VOL_NAME_SPACE_SNVM

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 12 ++++++++++++
plugin/smispy/smis.py | 20 ++++++++++----------
plugin/smispy/smis_constants.py | 26 --------------------------
3 files changed, 22 insertions(+), 36 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 39f4942..455492c 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -188,3 +188,15 @@ JOB_STATE_NEW = 2
JOB_STATE_STARTING = 3
JOB_STATE_RUNNING = 4
JOB_STATE_COMPLETED = 7
+
+# CIM_StorageVolume['NameFormat']
+VOL_NAME_FORMAT_OTHER = 1
+VOL_NAME_FORMAT_NNA = 9
+VOL_NAME_FORMAT_EUI64 = 10
+VOL_NAME_FORMAT_T10VID = 11
+
+# CIM_StorageVolume['NameNamespace']
+VOL_NAME_SPACE_OTHER = 1
+VOL_NAME_SPACE_VPD83_TYPE3 = 2
+VOL_NAME_SPACE_VPD83_TYPE2 = 3
+VOL_NAME_SPACE_VPD83_TYPE1 = 4
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index ca92608..06de9f6 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -587,17 +587,17 @@ class Smis(IStorageAreaNetwork):
if not (nf and nn and name):
return None
# SNIA might have miss documented VPD83Type3(1), it should be
- # VOL_NAME_FORMAT_OTHER(1) based on dmtf.
- # Will remove the Smis.VOL_NAME_FORMAT_OTHER condition if confirmed as
+ # dmtf.VOL_NAME_FORMAT_OTHER(1) based on dmtf.
+ # Will remove the Smis.dmtf.VOL_NAME_FORMAT_OTHER condition if confirmed as
# SNIA document fault.
- if (nf == VOL_NAME_FORMAT_NNA and
- nn == VOL_NAME_FORMAT_OTHER) or \
- (nf == VOL_NAME_FORMAT_NNA and
- nn == VOL_NAME_SPACE_VPD83_TYPE3) or \
- (nf == VOL_NAME_FORMAT_EUI64 and
- nn == VOL_NAME_SPACE_VPD83_TYPE2) or \
- (nf == VOL_NAME_FORMAT_T10VID and
- nn == VOL_NAME_SPACE_VPD83_TYPE1):
+ if (nf == dmtf.VOL_NAME_FORMAT_NNA and
+ nn == dmtf.VOL_NAME_FORMAT_OTHER) or \
+ (nf == dmtf.VOL_NAME_FORMAT_NNA and
+ nn == dmtf.VOL_NAME_SPACE_VPD83_TYPE3) or \
+ (nf == dmtf.VOL_NAME_FORMAT_EUI64 and
+ nn == dmtf.VOL_NAME_SPACE_VPD83_TYPE2) or \
+ (nf == dmtf.VOL_NAME_FORMAT_T10VID and
+ nn == dmtf.VOL_NAME_SPACE_VPD83_TYPE1):
return name

@staticmethod
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 6b5630f..6fd9556 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,32 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-# SMI-S replication enumerations
-(SYNC_TYPE_MIRROR, SYNC_TYPE_SNAPSHOT, SYNC_TYPE_CLONE) = (6, 7, 8)
-
-# DMTF 2.29.1 (which SNIA SMI-S 1.6 based on)
-# CIM_StorageVolume['NameFormat']
-VOL_NAME_FORMAT_OTHER = 1
-VOL_NAME_FORMAT_VPD83_NNA6 = 2
-VOL_NAME_FORMAT_VPD83_NNA5 = 3
-VOL_NAME_FORMAT_VPD83_TYPE2 = 4
-VOL_NAME_FORMAT_VPD83_TYPE1 = 5
-VOL_NAME_FORMAT_VPD83_TYPE0 = 6
-VOL_NAME_FORMAT_SNVM = 7
-VOL_NAME_FORMAT_NODE_WWN = 8
-VOL_NAME_FORMAT_NNA = 9
-VOL_NAME_FORMAT_EUI64 = 10
-VOL_NAME_FORMAT_T10VID = 11
-
-# CIM_StorageVolume['NameNamespace']
-VOL_NAME_SPACE_OTHER = 1
-VOL_NAME_SPACE_VPD83_TYPE3 = 2
-VOL_NAME_SPACE_VPD83_TYPE2 = 3
-VOL_NAME_SPACE_VPD83_TYPE1 = 4
-VOL_NAME_SPACE_VPD80 = 5
-VOL_NAME_SPACE_NODE_WWN = 6
-VOL_NAME_SPACE_SNVM = 7
-
JOB_RETRIEVE_NONE = 0
JOB_RETRIEVE_VOLUME = 1
--
1.7.1
Gris Ge
2014-10-09 07:28:38 UTC
Permalink
* Move these constants to SmisCommon:
smis_constants.JOB_RETRIEVE_NONE => SmisCommon.JOB_RETRIEVE_NONE
smis_constants.JOB_RETRIEVE_VOLUME => SmisCommon.JOB_RETRIEVE_VOLUME
# These two constants is just for plugin internal use, not a SNIA or DMTF
# constant.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis.py | 26 +++++++++++++++-----------
plugin/smispy/smis_common.py | 3 +++
plugin/smispy/smis_constants.py | 3 ---
3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 06de9f6..c132ba9 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -181,7 +181,7 @@ class Smis(IStorageAreaNetwork):
"""
# Check to see if operation is done
if rc == SmisCommon.SNIA_INVOKE_OK:
- if retrieve_data == JOB_RETRIEVE_VOLUME:
+ if retrieve_data == SmisCommon.JOB_RETRIEVE_VOLUME:
return None, self._new_vol_from_name(out)
else:
return None, None
@@ -343,7 +343,7 @@ class Smis(IStorageAreaNetwork):

if Smis._job_completed_ok(cim_job):
(ignore, retrieve_data) = self._parse_job_id(job_id)
- if retrieve_data == JOB_RETRIEVE_VOLUME:
+ if retrieve_data == SmisCommon.JOB_RETRIEVE_VOLUME:
completed_item = self._new_vol_from_job(cim_job)
else:
status = JobStatus.ERROR
@@ -431,7 +431,8 @@ class Smis(IStorageAreaNetwork):
"""
Return the MD5 has of CIM_ConcreteJob['InstanceID'] in conjunction
with '@%s' % retrieve_data
- retrieve_data should be JOB_RETRIEVE_NONE or JOB_RETRIEVE_VOLUME or etc
+ retrieve_data should be SmisCommon.JOB_RETRIEVE_NONE or
+ SmisCommon.JOB_RETRIEVE_VOLUME or etc
"""
return "%s@%d" % (self._id('Job', cim_job), int(retrieve_data))

@@ -482,7 +483,7 @@ class Smis(IStorageAreaNetwork):
"""
tmp_list = job_id.split('@', 2)
md5_str = tmp_list[0]
- retrieve_data = JOB_RETRIEVE_NONE
+ retrieve_data = SmisCommon.JOB_RETRIEVE_NONE
if len(tmp_list) == 2:
retrieve_data = int(tmp_list[1])
return (md5_str, retrieve_data)
@@ -872,7 +873,8 @@ class Smis(IStorageAreaNetwork):
'Size': pywbem.Uint64(size_bytes)}

try:
- return self._pi("volume_create", JOB_RETRIEVE_VOLUME,
+ return self._pi("volume_create",
+ SmisCommon.JOB_RETRIEVE_VOLUME,
*(self._c.InvokeMethod(
'CreateOrModifyElementFromStoragePool',
scs.path, **in_params)))
@@ -902,7 +904,8 @@ class Smis(IStorageAreaNetwork):
in_params = {'Operation': pywbem.Uint16(2),
'Synchronization': sync.path}

- job_id = self._pi("_detach", JOB_RETRIEVE_NONE,
+ job_id = self._pi("_detach",
+ SmisCommon.JOB_RETRIEVE_NONE,
*(self._c.InvokeMethod(
'ModifySynchronization', scs.path,
**in_params)))[0]
@@ -920,7 +923,7 @@ class Smis(IStorageAreaNetwork):
in_params = {'Operation': pywbem.Uint16(8),
'Synchronization': sync.path}

- job_id = self._pi("_detach", JOB_RETRIEVE_NONE,
+ job_id = self._pi("_detach", SmisCommon.JOB_RETRIEVE_NONE,
*(self._c.InvokeMethod(
'ModifyReplicaSynchronization', rs.path,
**in_params)))[0]
@@ -1028,7 +1031,7 @@ class Smis(IStorageAreaNetwork):
in_params = {'TheElement': lun.path}

#Delete returns None or Job number
- return self._pi("volume_delete", JOB_RETRIEVE_NONE,
+ return self._pi("volume_delete", SmisCommon.JOB_RETRIEVE_NONE,
*(self._c.InvokeMethod('ReturnToStoragePool',
scs.path, **in_params)))[0]

@@ -1055,7 +1058,7 @@ class Smis(IStorageAreaNetwork):
in_params = {'TheElement': lun.path}

# Delete returns None or Job number
- return self._pi("volume_delete", JOB_RETRIEVE_NONE,
+ return self._pi("volume_delete", SmisCommon.JOB_RETRIEVE_NONE,
*(self._c.InvokeMethod('ReturnToStoragePool',
scs.path,
**in_params)))[0]
@@ -1073,7 +1076,7 @@ class Smis(IStorageAreaNetwork):
'TheElement': lun.path,
'Size': pywbem.Uint64(new_size_bytes)}

- return self._pi("volume_resize", JOB_RETRIEVE_VOLUME,
+ return self._pi("volume_resize", SmisCommon.JOB_RETRIEVE_VOLUME,
*(self._c.InvokeMethod(
'CreateOrModifyElementFromStoragePool',
scs.path, **in_params)))
@@ -1135,7 +1138,8 @@ class Smis(IStorageAreaNetwork):

try:

- return self._pi("volume_replicate", JOB_RETRIEVE_VOLUME,
+ return self._pi("volume_replicate",
+ SmisCommon.JOB_RETRIEVE_VOLUME,
*(self._c.InvokeMethod(method,
rs.path, **in_params)))
except CIMError:
diff --git a/plugin/smispy/smis_common.py b/plugin/smispy/smis_common.py
index 059d838..bd80a9d 100644
--- a/plugin/smispy/smis_common.py
+++ b/plugin/smispy/smis_common.py
@@ -170,6 +170,9 @@ class SmisCommon(object):
_PRODUCT_MEGARAID = 'LSI MegaRAID'
_PRODUCT_NETAPP_E = 'NetApp-E'

+ JOB_RETRIEVE_NONE = 0
+ JOB_RETRIEVE_VOLUME = 1
+
def __init__(self, url, username, password,
namespace=dmtf.DEFAULT_NAMESPACE,
no_ssl_verify=False, debug=False, system_list=None):
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 6fd9556..d830b41 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,9 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-JOB_RETRIEVE_NONE = 0
-JOB_RETRIEVE_VOLUME = 1
-
IAAN_WBEM_HTTP_PORT = 5988
IAAN_WBEM_HTTPS_PORT = 5989
--
1.7.1
Gris Ge
2014-10-09 07:28:39 UTC
Permalink
* Move these constants into SmisCommon:
smis_constants.IAAN_WBEM_HTTP_PORT => SmisCommon.IAAN_WBEM_HTTP_PORT
smis_constants.IAAN_WBEM_HTTPS_PORT => SmisCommon.IAAN_WBEM_HTTPS_PORT
# These two constant is defined by IETF IAAN. Store in SmisCommon class
# which was supposed to hold non-dmtf constants.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis.py | 4 ++--
plugin/smispy/smis_common.py | 3 +++
plugin/smispy/smis_constants.py | 3 ---
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index c132ba9..22a5adf 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -233,12 +233,12 @@ class Smis(IStorageAreaNetwork):
Enumerate CIM_RegisteredProfile in userdefined namespace.
"""
protocol = 'http'
- port = IAAN_WBEM_HTTP_PORT
+ port = SmisCommon.IAAN_WBEM_HTTP_PORT
u = uri_parse(uri, ['scheme', 'netloc', 'host'], None)

if u['scheme'].lower() == 'smispy+ssl':
protocol = 'https'
- port = IAAN_WBEM_HTTPS_PORT
+ port = SmisCommon.IAAN_WBEM_HTTPS_PORT

if 'port' in u:
port = u['port']
diff --git a/plugin/smispy/smis_common.py b/plugin/smispy/smis_common.py
index bd80a9d..decbb51 100644
--- a/plugin/smispy/smis_common.py
+++ b/plugin/smispy/smis_common.py
@@ -173,6 +173,9 @@ class SmisCommon(object):
JOB_RETRIEVE_NONE = 0
JOB_RETRIEVE_VOLUME = 1

+ IAAN_WBEM_HTTP_PORT = 5988
+ IAAN_WBEM_HTTPS_PORT = 5989
+
def __init__(self, url, username, password,
namespace=dmtf.DEFAULT_NAMESPACE,
no_ssl_verify=False, debug=False, system_list=None):
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index d830b41..188580c 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -14,9 +14,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA

-IAAN_WBEM_HTTP_PORT = 5988
-IAAN_WBEM_HTTPS_PORT = 5989
-

class RepSvc(object):
--
1.7.1
Gris Ge
2014-10-09 07:28:40 UTC
Permalink
* Previously:
incorrect use
CIM_ReplicationServiceCapabilities['SupportedReplicationTypes'] --
2(Synchronous Mirror Local) for Capabilities.VOLUME_REPLICATE
capability.
Now:
Use CIM_ReplicationServiceCapabilities['SupportedSynchronousActions'] and
['SupportedAsynchronousActions'] -- 2(CreateElementReplica) for
Capabilities.VOLUME_REPLICATE capability.

* Remove smis_constants.RepSvc.Action class.
* Add dmtf.REPLICA_CAP_ACTION_CREATE_ELEMENT for 2(CreateElementReplica)
in CIM_ReplicationServiceCapabilities['SupportedSynchronousActions'] and
['SupportedAsynchronousActions'].

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 4 ++++
plugin/smispy/smis_cap.py | 8 ++++++--
plugin/smispy/smis_constants.py | 3 ---
3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 455492c..17ca8c0 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -200,3 +200,7 @@ VOL_NAME_SPACE_OTHER = 1
VOL_NAME_SPACE_VPD83_TYPE3 = 2
VOL_NAME_SPACE_VPD83_TYPE2 = 3
VOL_NAME_SPACE_VPD83_TYPE1 = 4
+
+# CIM_ReplicationServiceCapabilities['SupportedAsynchronousActions']
+# or CIM_ReplicationServiceCapabilities['SupportedSynchronousActions']
+REPLICA_CAP_ACTION_CREATE_ELEMENT = 2
diff --git a/plugin/smispy/smis_cap.py b/plugin/smispy/smis_cap.py
index 0c9751d..4e9b9f1 100644
--- a/plugin/smispy/smis_cap.py
+++ b/plugin/smispy/smis_cap.py
@@ -37,10 +37,14 @@ def _rs_supported_capabilities(smis_common, system, cap):
ResultClass='CIM_ReplicationServiceCapabilities')[0]

s_rt = rs_cap['SupportedReplicationTypes']
+ async_actions = rs_cap['SupportedAsynchronousActions']
+ sync_actions = rs_cap['SupportedSynchronousActions']

- if RepSvc.Action.CREATE_ELEMENT_REPLICA in s_rt or \
- RepSvc.Action.CREATE_ELEMENT_REPLICA in s_rt:
+ if dmtf.REPLICA_CAP_ACTION_CREATE_ELEMENT in async_actions or \
+ dmtf.REPLICA_CAP_ACTION_CREATE_ELEMENT in sync_actions :
cap.set(Capabilities.VOLUME_REPLICATE)
+ else:
+ return

# Mirror support is not working and is not supported at this time.
# if RepSvc.RepTypes.SYNC_MIRROR_LOCAL in s_rt:
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 188580c..dedb683 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -17,9 +17,6 @@

class RepSvc(object):

- class Action(object):
- CREATE_ELEMENT_REPLICA = 2
-
class RepTypes(object):
# SMI-S replication service capabilities
SYNC_MIRROR_LOCAL = 2
--
1.7.1
Gris Ge
2014-10-09 07:28:41 UTC
Permalink
* Replace smis_constants.RepSvc with these constants in dmtf.py:
RepSvc.RepTypes.SYNC_SNAPSHOT_LOCAL
-> dmtf.REPLICA_CAP_TYPE_SYNC_SNAPSHOT_LOCAL
RepSvc.RepTypes.ASYNC_SNAPSHOT_LOCAL
-> dmtf.REPLICA_CAP_TYPE_ASYNC_SNAPSHOT_LOCAL
RepSvc.RepTypes.SYNC_CLONE_LOCAL
-> dmtf.REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL
RepSvc.RepTypes.ASYNC_CLONE_LOCAL
-> dmtf.REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL

* Removed these unused constants:
RepSvc.RepTypes.SYNC_MIRROR_LOCAL
RepSvc.RepTypes.ASYNC_MIRROR_LOCAL
RepSvc.RepTypes.SYNC_MIRROR_REMOTE
RepSvc.RepTypes.ASYNC_MIRROR_REMOTE
RepSvc.RepTypes.SYNC_CLONE_REMOTE
RepSvc.RepTypes.ASYNC_CLONE_REMOTE

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 7 +++++++
plugin/smispy/smis_cap.py | 16 ++++------------
plugin/smispy/smis_constants.py | 18 ------------------
3 files changed, 11 insertions(+), 30 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 17ca8c0..93d77a7 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -204,3 +204,10 @@ VOL_NAME_SPACE_VPD83_TYPE1 = 4
# CIM_ReplicationServiceCapabilities['SupportedAsynchronousActions']
# or CIM_ReplicationServiceCapabilities['SupportedSynchronousActions']
REPLICA_CAP_ACTION_CREATE_ELEMENT = 2
+
+# CIM_ReplicationServiceCapabilities['SupportedReplicationTypes']
+REPLICA_CAP_TYPE_SYNC_SNAPSHOT_LOCAL = 6
+REPLICA_CAP_TYPE_ASYNC_SNAPSHOT_LOCAL = 7
+
+REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL = 10
+REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL = 11
diff --git a/plugin/smispy/smis_cap.py b/plugin/smispy/smis_cap.py
index 4e9b9f1..cff4745 100644
--- a/plugin/smispy/smis_cap.py
+++ b/plugin/smispy/smis_cap.py
@@ -46,20 +46,12 @@ def _rs_supported_capabilities(smis_common, system, cap):
else:
return

- # Mirror support is not working and is not supported at this time.
- # if RepSvc.RepTypes.SYNC_MIRROR_LOCAL in s_rt:
- # cap.set(Capabilities.DeviceID)
-
- # if RepSvc.RepTypes.ASYNC_MIRROR_LOCAL \
- # in s_rt:
- # cap.set(Capabilities.VOLUME_REPLICATE_MIRROR_ASYNC)
-
- if RepSvc.RepTypes.SYNC_SNAPSHOT_LOCAL in s_rt or \
- RepSvc.RepTypes.ASYNC_SNAPSHOT_LOCAL in s_rt:
+ if dmtf.REPLICA_CAP_TYPE_SYNC_SNAPSHOT_LOCAL in s_rt or \
+ dmtf.REPLICA_CAP_TYPE_ASYNC_SNAPSHOT_LOCAL in s_rt:
cap.set(Capabilities.VOLUME_REPLICATE_CLONE)

- if RepSvc.RepTypes.SYNC_CLONE_LOCAL in s_rt or \
- RepSvc.RepTypes.ASYNC_CLONE_LOCAL in s_rt:
+ if dmtf.REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL in s_rt or \
+ dmtf.REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL in s_rt:
cap.set(Capabilities.VOLUME_REPLICATE_COPY)
else:
# Try older storage configuration service
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index dedb683..6f0302f 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -15,24 +15,6 @@
# USA


-class RepSvc(object):
-
- class RepTypes(object):
- # SMI-S replication service capabilities
- SYNC_MIRROR_LOCAL = 2
- ASYNC_MIRROR_LOCAL = 3
- SYNC_MIRROR_REMOTE = 4
- ASYNC_MIRROR_REMOTE = 5
- SYNC_SNAPSHOT_LOCAL = 6
- ASYNC_SNAPSHOT_LOCAL = 7
- SYNC_SNAPSHOT_REMOTE = 8
- ASYNC_SNAPSHOT_REMOTE = 9
- SYNC_CLONE_LOCAL = 10
- ASYNC_CLONE_LOCAL = 11
- SYNC_CLONE_REMOTE = 12
- ASYNC_CLONE_REMOTE = 13
-
-
class CopyStates(object):
INITIALIZED = 2
UNSYNCHRONIZED = 3
--
1.7.1
Gris Ge
2014-10-09 07:28:42 UTC
Permalink
* Replace smis_constants.CopyStates with dmtf.py constants:
smis_constants.CopyStates.SYNCHRONIZED
-> dmtf.COPY_STATE_SYNC

* Removed smis_constants.CopyStates unused constants:
smis_constants.CopyStates.INITIALIZED
smis_constants.CopyStates.UNSYNCHRONIZED
smis_constants.CopyStates.INACTIVE

* Remove smis_constants.CopyStates class.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 3 +++
plugin/smispy/smis.py | 3 +--
plugin/smispy/smis_constants.py | 7 -------
3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 93d77a7..aa10a28 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -211,3 +211,6 @@ REPLICA_CAP_TYPE_ASYNC_SNAPSHOT_LOCAL = 7

REPLICA_CAP_TYPE_SYNC_CLONE_LOCAL = 10
REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL = 11
+
+# CIM_Synchronized['CopyState']
+COPY_STATE_SYNC = Uint16(4)
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 22a5adf..46ae6ec 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1105,8 +1105,7 @@ class Smis(IStorageAreaNetwork):
in_params = {'ElementName': name,
'SyncType': pywbem.Uint16(sync),
'SourceElement': lun.path,
- 'WaitForCopyState':
- pywbem.Uint16(CopyStates.SYNCHRONIZED)}
+ 'WaitForCopyState': dmtf.COPY_STATE_SYNC}

else:
# Check for older support via storage configuration service
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 6f0302f..579feef 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -15,13 +15,6 @@
# USA


-class CopyStates(object):
- INITIALIZED = 2
- UNSYNCHRONIZED = 3
- SYNCHRONIZED = 4
- INACTIVE = 8
-
-
class CopyTypes(object):
ASYNC = 2 # Async. mirror
SYNC = 3 # Sync. mirror
--
1.7.1
Gris Ge
2014-10-09 07:28:43 UTC
Permalink
* Replaced smis_constants.CopyTypes by dmtf constants:
smis_constants.CopyTypes.ASYNC
-> dmtf.ST_CONF_CAP_COPY_TYPE_ASYNC
smis_constants.CopyTypes.SYNC
-> dmtf.ST_CONF_CAP_COPY_TYPE_SYNC
smis_constants.CopyTypes.UNSYNCASSOC
-> dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC
smis_constants.CopyTypes.UNSYNCUNASSOC
-> dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC

* Removed smis_constants.CopyTypes as all its constants moved out.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 6 ++++++
plugin/smispy/smis.py | 17 +++++++++--------
plugin/smispy/smis_cap.py | 13 ++-----------
plugin/smispy/smis_constants.py | 7 -------
4 files changed, 17 insertions(+), 26 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index aa10a28..032887c 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -214,3 +214,9 @@ REPLICA_CAP_TYPE_ASYNC_CLONE_LOCAL = 11

# CIM_Synchronized['CopyState']
COPY_STATE_SYNC = Uint16(4)
+
+# CIM_StorageConfigurationCapabilities['SupportedCopyTypes']
+ST_CONF_CAP_COPY_TYPE_ASYNC = Uint16(2)
+ST_CONF_CAP_COPY_TYPE_SYNC = Uint16(3)
+ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC = Uint16(4)
+ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC = Uint16(5)
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 46ae6ec..6b0e462 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1005,9 +1005,10 @@ class Smis(IStorageAreaNetwork):
# range of array vendors.

if 'SyncState' in s and 'CopyType' in s:
- if s['SyncState'] == \
- Synchronized.SyncState.SYNCHRONIZED and \
- (s['CopyType'] != CopyTypes.UNSYNCASSOC):
+ if s['SyncState'] == Synchronized.SyncState.SYNCHRONIZED \
+ and \
+ s['CopyType'] != \
+ dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC:
if 'SyncedElement' in s:
item = s['SyncedElement']

@@ -1119,16 +1120,16 @@ class Smis(IStorageAreaNetwork):

ct = Volume.REPLICATE_CLONE
if rep_type == Volume.REPLICATE_CLONE:
- ct = CopyTypes.UNSYNCASSOC
+ ct = dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC
elif rep_type == Volume.REPLICATE_COPY:
- ct = CopyTypes.UNSYNCUNASSOC
+ ct = dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC
elif rep_type == Volume.REPLICATE_MIRROR_ASYNC:
- ct = CopyTypes.ASYNC
+ ct = dmtf.ST_CONF_CAP_COPY_TYPE_ASYNC
elif rep_type == Volume.REPLICATE_MIRROR_SYNC:
- ct = CopyTypes.SYNC
+ ct = dmtf.ST_CONF_CAP_COPY_TYPE_SYNC

in_params = {'ElementName': name,
- 'CopyType': pywbem.Uint16(ct),
+ 'CopyType': ct,
'SourceElement': lun.path}
if rs:

diff --git a/plugin/smispy/smis_cap.py b/plugin/smispy/smis_cap.py
index cff4745..11efbc1 100644
--- a/plugin/smispy/smis_cap.py
+++ b/plugin/smispy/smis_cap.py
@@ -72,19 +72,10 @@ def _rs_supported_capabilities(smis_common, system, cap):
if sct and len(sct):
cap.set(Capabilities.VOLUME_REPLICATE)

- # Mirror support is not working and is not supported at
- # this time.
-
- # if CopyTypes.ASYNC in sct:
- # cap.set(Capabilities.VOLUME_REPLICATE_MIRROR_ASYNC)
-
- # if CopyTypes.SYNC in sct:
- # cap.set(Capabilities.VOLUME_REPLICATE_MIRROR_SYNC)
-
- if CopyTypes.UNSYNCASSOC in sct:
+ if dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC in sct:
cap.set(Capabilities.VOLUME_REPLICATE_CLONE)

- if CopyTypes.UNSYNCUNASSOC in sct:
+ if dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC in sct:
cap.set(Capabilities.VOLUME_REPLICATE_COPY)


diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 579feef..051858e 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -15,13 +15,6 @@
# USA


-class CopyTypes(object):
- ASYNC = 2 # Async. mirror
- SYNC = 3 # Sync. mirror
- UNSYNCASSOC = 4 # lsm Clone
- UNSYNCUNASSOC = 5 # lsm Copy
-
-
class Synchronized(object):
class SyncState(object):
INITIALIZED = 2
--
1.7.1
Gris Ge
2014-10-09 07:28:44 UTC
Permalink
* Replaced this constants by dmtf one:
smis_constants.Synchronized.SyncState.SYNCHRONIZED
-> dmtf.ST_SYNC_STATE_SYNCHRONIZED

* Removed unused constants in smis_constants.py:
smis_constants.Synchronized.SyncState.INITIALIZED
smis_constants.Synchronized.SyncState.PREPAREINPROGRESS
smis_constants.Synchronized.SyncState.PREPARED
smis_constants.Synchronized.SyncState.RESYNCINPROGRESS
smis_constants.Synchronized.SyncState.FRACTURE_IN_PROGRESS
smis_constants.Synchronized.SyncState.QUIESCEINPROGRESS
smis_constants.Synchronized.SyncState.QUIESCED
smis_constants.Synchronized.SyncState.RESTORE_IN_PROGRESSS
smis_constants.Synchronized.SyncState.IDLE
smis_constants.Synchronized.SyncState.BROKEN
smis_constants.Synchronized.SyncState.FRACTURED
smis_constants.Synchronized.SyncState.FROZEN
smis_constants.Synchronized.SyncState.COPY_IN_PROGRESS

* Remove smis_constants.Synchronized class as all its constants moved out.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 3 +++
plugin/smispy/smis.py | 3 +--
plugin/smispy/smis_constants.py | 17 -----------------
3 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index 032887c..b7e33d2 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -220,3 +220,6 @@ ST_CONF_CAP_COPY_TYPE_ASYNC = Uint16(2)
ST_CONF_CAP_COPY_TYPE_SYNC = Uint16(3)
ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC = Uint16(4)
ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC = Uint16(5)
+
+# CIM_StorageSynchronized['SyncState']
+ST_SYNC_STATE_SYNCHRONIZED = 6
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 6b0e462..c3996e2 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1005,8 +1005,7 @@ class Smis(IStorageAreaNetwork):
# range of array vendors.

if 'SyncState' in s and 'CopyType' in s:
- if s['SyncState'] == Synchronized.SyncState.SYNCHRONIZED \
- and \
+ if s['SyncState'] == dmtf.ST_SYNC_STATE_SYNCHRONIZED and \
s['CopyType'] != \
dmtf.ST_CONF_CAP_COPY_TYPE_UNSYNC_ASSOC:
if 'SyncedElement' in s:
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index 051858e..ed05fc8 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -15,23 +15,6 @@
# USA


-class Synchronized(object):
- class SyncState(object):
- INITIALIZED = 2
- PREPAREINPROGRESS = 3
- PREPARED = 4
- RESYNCINPROGRESS = 5
- SYNCHRONIZED = 6
- FRACTURE_IN_PROGRESS = 7
- QUIESCEINPROGRESS = 8
- QUIESCED = 9
- RESTORE_IN_PROGRESSS = 10
- IDLE = 11
- BROKEN = 12
- FRACTURED = 13
- FROZEN = 14
- COPY_IN_PROGRESS = 15
-
# SMI-S mode for mirror updates
(CREATE_ELEMENT_REPLICA_MODE_SYNC,
CREATE_ELEMENT_REPLICA_MODE_ASYNC) = (2, 3)
--
1.7.1
Gris Ge
2014-10-09 07:28:45 UTC
Permalink
* Removed these unused constants of smis_constants.py:
CREATE_ELEMENT_REPLICA_MODE_SYNC
CREATE_ELEMENT_REPLICA_MODE_ASYNC
VOL_OP_STATUS_OK
VOL_OP_STATUS_DEGRADED
VOL_OP_STATUS_ERR
VOL_OP_STATUS_STARTING
VOL_OP_STATUS_DORMANT
EXPOSE_PATHS_DA_READ_ONLY

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/smis_constants.py | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index ed05fc8..f596e0f 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -15,14 +15,5 @@
# USA


-# SMI-S mode for mirror updates
-(CREATE_ELEMENT_REPLICA_MODE_SYNC,
- CREATE_ELEMENT_REPLICA_MODE_ASYNC) = (2, 3)
-
-# SMI-S volume 'OperationalStatus' enumerations
-(VOL_OP_STATUS_OK, VOL_OP_STATUS_DEGRADED, VOL_OP_STATUS_ERR,
- VOL_OP_STATUS_STARTING,
- VOL_OP_STATUS_DORMANT) = (2, 3, 6, 8, 15)
-
# SMI-S ExposePaths device access enumerations
-(EXPOSE_PATHS_DA_READ_WRITE, EXPOSE_PATHS_DA_READ_ONLY) = (2, 3)
+EXPOSE_PATHS_DA_READ_WRITE = 2
--
1.7.1
Gris Ge
2014-10-09 07:28:46 UTC
Permalink
* Replace smis_constants.EXPOSE_PATHS_DA_READ_WRITE with
dmtf.CTRL_CONF_SRV_DA_RW

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/smispy/dmtf.py | 3 +++
plugin/smispy/smis.py | 4 +---
plugin/smispy/smis_constants.py | 4 ----
3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/plugin/smispy/dmtf.py b/plugin/smispy/dmtf.py
index b7e33d2..3fc0836 100644
--- a/plugin/smispy/dmtf.py
+++ b/plugin/smispy/dmtf.py
@@ -223,3 +223,6 @@ ST_CONF_CAP_COPY_TYPE_UNSYNC_UNASSOC = Uint16(5)

# CIM_StorageSynchronized['SyncState']
ST_SYNC_STATE_SYNCHRONIZED = 6
+
+# CIM_ControllerConfigurationService.ExposePaths(DeviceAccesses)
+CTRL_CONF_SRV_DA_RW = Uint16(2)
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index c3996e2..b2e75bf 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1361,11 +1361,9 @@ class Smis(IStorageAreaNetwork):
cim_vol = self._get_cim_instance_by_id(
'Volume', volume.id, ['Name'], raise_error=True)

- da = EXPOSE_PATHS_DA_READ_WRITE
-
in_params = {'LUNames': [cim_vol['Name']],
'ProtocolControllers': [cim_spc.path],
- 'DeviceAccesses': [pywbem.Uint16(da)]}
+ 'DeviceAccesses': [dmtf.CTRL_CONF_SRV_DA_RW]}

(rc, out) = self._c.InvokeMethod(
'ExposePaths',
diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
index f596e0f..40ebc20 100644
--- a/plugin/smispy/smis_constants.py
+++ b/plugin/smispy/smis_constants.py
@@ -13,7 +13,3 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA
-
-
-# SMI-S ExposePaths device access enumerations
-EXPOSE_PATHS_DA_READ_WRITE = 2
--
1.7.1
Gris Ge
2014-10-09 07:28:47 UTC
Permalink
* Remove empty smis_constants.py file.
* Makefile and rpm SPEC file updated

Signed-off-by: Gris Ge <***@redhat.com>
---
packaging/libstoragemgmt.spec.in | 1 -
plugin/Makefile.am | 1 -
plugin/smispy/smis.py | 1 -
plugin/smispy/smis_cap.py | 1 -
plugin/smispy/smis_constants.py | 15 ---------------
5 files changed, 0 insertions(+), 19 deletions(-)
delete mode 100644 plugin/smispy/smis_constants.py

diff --git a/packaging/libstoragemgmt.spec.in b/packaging/libstoragemgmt.spec.in
index 69f9a3e..f84266c 100644
--- a/packaging/libstoragemgmt.spec.in
+++ b/packaging/libstoragemgmt.spec.in
@@ -322,7 +322,6 @@ fi
%{python_sitelib}/lsm/plugin/smispy/smis.*
%{python_sitelib}/lsm/plugin/smispy/dmtf.*
%{python_sitelib}/lsm/plugin/smispy/utils.*
-%{python_sitelib}/lsm/plugin/smispy/smis_constants.*
%{python_sitelib}/lsm/plugin/smispy/smis_common.*
%{python_sitelib}/lsm/plugin/smispy/smis_cap.*
%{python_sitelib}/lsm/plugin/smispy/smis_sys.*
diff --git a/plugin/Makefile.am b/plugin/Makefile.am
index df8907d..c3084c9 100644
--- a/plugin/Makefile.am
+++ b/plugin/Makefile.am
@@ -26,7 +26,6 @@ smispy_PYTHON = \
smispy/__init__.py \
smispy/smis.py \
smispy/utils.py \
- smispy/smis_constants.py \
smispy/smis_common.py \
smispy/dmtf.py \
smispy/smis_cap.py \
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index b2e75bf..76dc8cb 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -28,7 +28,6 @@ import re

import pywbem
from pywbem import CIMError
-from smis_constants import *
import smis_cap
import smis_sys
import smis_pool
diff --git a/plugin/smispy/smis_cap.py b/plugin/smispy/smis_cap.py
index 11efbc1..1309056 100644
--- a/plugin/smispy/smis_cap.py
+++ b/plugin/smispy/smis_cap.py
@@ -15,7 +15,6 @@
# USA

from lsm import Capabilities, LsmError, ErrorNumber
-from smis_constants import *
import dmtf
from smis_common import SmisCommon

diff --git a/plugin/smispy/smis_constants.py b/plugin/smispy/smis_constants.py
deleted file mode 100644
index 40ebc20..0000000
--- a/plugin/smispy/smis_constants.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (C) 2014 Red Hat, Inc.
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
-# USA
--
1.7.1
Loading...