Discussion:
[Libstoragemgmt-devel] [PATCH 1/4] Rename VOLUME_ONLINE to VOLUME_ENABLE and _OFFLINE to _DISABLE
Gris Ge
2014-09-02 11:08:26 UTC
Permalink
* Just align with method name volume_enable() and volume_disable().

Signed-off-by: Gris Ge <***@redhat.com>
---
.../include/libstoragemgmt/libstoragemgmt_capabilities.h | 4 ++--
plugin/nstor/nstor.py | 4 ++--
plugin/ontap/ontap.py | 4 ++--
plugin/simc/simc_lsmplugin.c | 4 ++--
plugin/targetd/targetd.py | 4 ++--
python_binding/lsm/_common.py | 1 +
python_binding/lsm/_data.py | 4 ++--
test/tester.c | 12 ++++++------
8 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h b/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
index 62c25ac..49757b8 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
@@ -55,8 +55,8 @@ typedef enum {

LSM_CAP_VOLUME_DELETE = 33, /**< Can delete a volume */

- LSM_CAP_VOLUME_ONLINE = 34, /**< Put volume online */
- LSM_CAP_VOLUME_OFFLINE = 35, /**< Take volume offline */
+ LSM_CAP_VOLUME_ENABLE = 34, /**< Enable volume*/
+ LSM_CAP_VOLUME_DISABLE = 35, /**< Disable volume*/

LSM_CAP_VOLUME_MASK = 36, /**< Grant an access group to a volume */
LSM_CAP_VOLUME_UNMASK = 37, /**< Revoke access for an access group */
diff --git a/plugin/nstor/nstor.py b/plugin/nstor/nstor.py
index fb81c9d..e53213d 100644
--- a/plugin/nstor/nstor.py
+++ b/plugin/nstor/nstor.py
@@ -273,8 +273,8 @@ class NexentaStor(INfs, IStorageAreaNetwork):
# c.set(Capabilities.VOLUME_COPY_RANGE_CLONE)
# c.set(Capabilities.VOLUME_COPY_RANGE_COPY)
c.set(Capabilities.VOLUME_DELETE)
- # c.set(Capabilities.VOLUME_ONLINE)
- # c.set(Capabilities.VOLUME_OFFLINE)
+ # c.set(Capabilities.VOLUME_ENABLE)
+ # c.set(Capabilities.VOLUME_DISABLE)
c.set(Capabilities.VOLUME_MASK)
c.set(Capabilities.VOLUME_UNMASK)
c.set(Capabilities.ACCESS_GROUPS)
diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py
index c9116c7..c5ab1d1 100644
--- a/plugin/ontap/ontap.py
+++ b/plugin/ontap/ontap.py
@@ -470,8 +470,8 @@ class Ontap(IStorageAreaNetwork, INfs):
cap.set(Capabilities.VOLUME_COPY_RANGE)
cap.set(Capabilities.VOLUME_COPY_RANGE_CLONE)
cap.set(Capabilities.VOLUME_DELETE)
- cap.set(Capabilities.VOLUME_ONLINE)
- cap.set(Capabilities.VOLUME_OFFLINE)
+ cap.set(Capabilities.VOLUME_ENABLE)
+ cap.set(Capabilities.VOLUME_DISABLE)
cap.set(Capabilities.VOLUME_ISCSI_CHAP_AUTHENTICATION)
cap.set(Capabilities.VOLUME_MASK)
cap.set(Capabilities.VOLUME_UNMASK)
diff --git a/plugin/simc/simc_lsmplugin.c b/plugin/simc/simc_lsmplugin.c
index d0d7170..5ef2afd 100644
--- a/plugin/simc/simc_lsmplugin.c
+++ b/plugin/simc/simc_lsmplugin.c
@@ -358,8 +358,8 @@ static int cap(lsm_plugin_ptr c, lsm_system *system,
LSM_CAP_VOLUME_COPY_RANGE_CLONE,
LSM_CAP_VOLUME_COPY_RANGE_COPY,
LSM_CAP_VOLUME_DELETE,
- LSM_CAP_VOLUME_ONLINE,
- LSM_CAP_VOLUME_OFFLINE,
+ LSM_CAP_VOLUME_ENABLE,
+ LSM_CAP_VOLUME_DISABLE,
LSM_CAP_VOLUME_MASK,
LSM_CAP_VOLUME_UNMASK,
LSM_CAP_ACCESS_GROUPS,
diff --git a/plugin/targetd/targetd.py b/plugin/targetd/targetd.py
index a39d7b9..9f20cab 100644
--- a/plugin/targetd/targetd.py
+++ b/plugin/targetd/targetd.py
@@ -117,8 +117,8 @@ class TargetdStorage(IStorageAreaNetwork, INfs):
cap.set(Capabilities.VOLUME_REPLICATE)
cap.set(Capabilities.VOLUME_REPLICATE_COPY)
cap.set(Capabilities.VOLUME_DELETE)
- cap.set(Capabilities.VOLUME_OFFLINE)
- cap.set(Capabilities.VOLUME_ONLINE)
+ cap.set(Capabilities.VOLUME_DISABLE)
+ cap.set(Capabilities.VOLUME_ENABLE)
cap.set(Capabilities.VOLUME_MASK)
cap.set(Capabilities.VOLUME_UNMASK)
cap.set(Capabilities.FS)
diff --git a/python_binding/lsm/_common.py b/python_binding/lsm/_common.py
index 913f380..68b78b9 100644
--- a/python_binding/lsm/_common.py
+++ b/python_binding/lsm/_common.py
@@ -478,6 +478,7 @@ class ErrorNumber(object):
ACCESS_GROUP_MASKED = 502 # refuse to remove the last initiator from
# access group which have volume masked or
# allow an access group to be deleted
+ LAST_INIT_IN_MASKED_AG = 502

UNSUPPORTED_SEARCH_KEY = 510

diff --git a/python_binding/lsm/_data.py b/python_binding/lsm/_data.py
index 0cc5a89..1dfb365 100644
--- a/python_binding/lsm/_data.py
+++ b/python_binding/lsm/_data.py
@@ -637,8 +637,8 @@ class Capabilities(IData):

VOLUME_DELETE = 33

- VOLUME_ONLINE = 34
- VOLUME_OFFLINE = 35
+ VOLUME_ENABLE = 34
+ VOLUME_DISABLE = 35

VOLUME_MASK = 36
VOLUME_UNMASK = 37
diff --git a/test/tester.c b/test/tester.c
index d5ce169..e2a2a66 100644
--- a/test/tester.c
+++ b/test/tester.c
@@ -1839,8 +1839,8 @@ START_TEST(test_capabilities)
cap_test(cap, LSM_CAP_VOLUME_COPY_RANGE_CLONE);
cap_test(cap, LSM_CAP_VOLUME_COPY_RANGE_COPY);
cap_test(cap, LSM_CAP_VOLUME_DELETE);
- cap_test(cap, LSM_CAP_VOLUME_ONLINE);
- cap_test(cap, LSM_CAP_VOLUME_OFFLINE);
+ cap_test(cap, LSM_CAP_VOLUME_ENABLE);
+ cap_test(cap, LSM_CAP_VOLUME_DISABLE);
cap_test(cap, LSM_CAP_VOLUME_MASK);
cap_test(cap, LSM_CAP_VOLUME_UNMASK);
cap_test(cap, LSM_CAP_ACCESS_GROUPS);
@@ -2011,8 +2011,8 @@ START_TEST(test_capability)
LSM_CAP_VOLUME_COPY_RANGE_CLONE,
LSM_CAP_VOLUME_COPY_RANGE_COPY,
LSM_CAP_VOLUME_DELETE,
- LSM_CAP_VOLUME_ONLINE,
- LSM_CAP_VOLUME_OFFLINE,
+ LSM_CAP_VOLUME_ENABLE,
+ LSM_CAP_VOLUME_DISABLE,
LSM_CAP_VOLUME_MASK,
LSM_CAP_VOLUME_UNMASK,
LSM_CAP_ACCESS_GROUPS,
@@ -2065,8 +2065,8 @@ START_TEST(test_capability)
LSM_CAP_VOLUME_COPY_RANGE_CLONE,
LSM_CAP_VOLUME_COPY_RANGE_COPY,
LSM_CAP_VOLUME_DELETE,
- LSM_CAP_VOLUME_ONLINE,
- LSM_CAP_VOLUME_OFFLINE,
+ LSM_CAP_VOLUME_ENABLE,
+ LSM_CAP_VOLUME_DISABLE,
LSM_CAP_VOLUME_MASK,
LSM_CAP_VOLUME_UNMASK,
LSM_CAP_ACCESS_GROUPS,
--
1.9.3
Gris Ge
2014-09-02 11:08:27 UTC
Permalink
* Less confusion name for ACCESS_GROUP_MASKED:
LAST_INIT_IN_MASKED_AG

Signed-off-by: Gris Ge <***@redhat.com>
---
c_binding/include/libstoragemgmt/libstoragemgmt_error.h | 2 +-
plugin/smispy/smis.py | 4 ++--
python_binding/lsm/_common.py | 8 +++++---
3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_error.h b/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
index c72c433..abc78c6 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
@@ -90,7 +90,7 @@ typedef enum {
LSM_ERR_TRANSPORT_INVALID_ARG = 402, /**< Parameter transported over IPC is invalid */

LSM_ERR_VOLUME_BUSY = 501, /* Volume already in use */
- LSM_ERR_ACCESS_GROUP_MASKED = 502,
+ LSM_ERR_LAST_INIT_IN_MASKED_AG = 502,


LSM_ERR_UNSUPPORTED_SEARCH_KEY = 510, /**< Unsupport search key */
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 081d62f..7778ece 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -2914,7 +2914,7 @@ class Smis(IStorageAreaNetwork):
cim_spc_path,
AssocClass='CIM_ProtocolControllerForUnit',
ResultClass='CIM_StorageVolume')) >= 1:
- raise LsmError(ErrorNumber.ACCESS_GROUP_MASKED,
+ raise LsmError(ErrorNumber.LAST_INIT_IN_MASKED_AG,
"Refuse to remove last initiator member "
"from access group which have volume "
"masked to")
@@ -4091,7 +4091,7 @@ class Smis(IStorageAreaNetwork):
cim_spc_path,
AssocClass='CIM_ProtocolControllerForUnit',
ResultClass='CIM_StorageVolume')) >= 1:
- raise LsmError(ErrorNumber.ACCESS_GROUP_MASKED,
+ raise LsmError(ErrorNumber.IS_MASKED,
"Access Group %s has volume masked" %
access_group.id)

diff --git a/python_binding/lsm/_common.py b/python_binding/lsm/_common.py
index 68b78b9..e7f1015 100644
--- a/python_binding/lsm/_common.py
+++ b/python_binding/lsm/_common.py
@@ -475,10 +475,12 @@ class ErrorNumber(object):
TRANSPORT_INVALID_ARG = 402

VOLUME_BUSY = 501
- ACCESS_GROUP_MASKED = 502 # refuse to remove the last initiator from
- # access group which have volume masked or
- # allow an access group to be deleted
+
LAST_INIT_IN_MASKED_AG = 502
+ # refuse to remove the last initiator from
+ # access group which have volume masked or
+ # allow an access group to be deleted
+

UNSUPPORTED_SEARCH_KEY = 510
--
1.9.3
Gris Ge
2014-09-02 11:08:28 UTC
Permalink
* No plugin is using LSM_ERR_VOLUME_BUSY/lsm.ErrorNumber.VOLUME_BUSY.
Hence remove.

Signed-off-by: Gris Ge <***@redhat.com>
---
c_binding/include/libstoragemgmt/libstoragemgmt_error.h | 1 -
python_binding/lsm/_common.py | 2 --
2 files changed, 3 deletions(-)

diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_error.h b/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
index abc78c6..ed2ad5f 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
@@ -89,7 +89,6 @@ typedef enum {
LSM_ERR_TRANSPORT_SERIALIZATION = 401, /**< Transport serialization error */
LSM_ERR_TRANSPORT_INVALID_ARG = 402, /**< Parameter transported over IPC is invalid */

- LSM_ERR_VOLUME_BUSY = 501, /* Volume already in use */
LSM_ERR_LAST_INIT_IN_MASKED_AG = 502,


diff --git a/python_binding/lsm/_common.py b/python_binding/lsm/_common.py
index e7f1015..2b53b75 100644
--- a/python_binding/lsm/_common.py
+++ b/python_binding/lsm/_common.py
@@ -474,8 +474,6 @@ class ErrorNumber(object):
TRANSPORT_SERIALIZATION = 401
TRANSPORT_INVALID_ARG = 402

- VOLUME_BUSY = 501
-
LAST_INIT_IN_MASKED_AG = 502
# refuse to remove the last initiator from
# access group which have volume masked or
--
1.9.3
Gris Ge
2014-09-02 11:08:29 UTC
Permalink
* SIZE_TOO_SMALL is blur in definition. In stead of letting user to guess
the minimum size, plugin should resize volume to the minimum size.
The 'volume_size()' method will return a volume holding __larger__ or
equal size as requested.

* Improve ONTAP plugin for volume_resize:
1. Handling too small error just like volume_create() did.
2. Handling NO_STATE_CHANGE change error.


Signed-off-by: Gris Ge <***@redhat.com>
---
.../include/libstoragemgmt/libstoragemgmt_error.h | 1 -
plugin/ontap/na.py | 3 ++-
plugin/ontap/ontap.py | 23 ++++++++++++++++++++--
python_binding/lsm/_common.py | 1 -
4 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_error.h b/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
index ed2ad5f..8afd2bc 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
@@ -80,7 +80,6 @@ typedef enum {

LSM_ERR_NOT_ENOUGH_SPACE = 350, /**< Insufficient space */

- LSM_ERR_SIZE_TOO_SMALL = 353, /**< Size specified is too small */
LSM_ERR_SYS_LIMIT_MAX_SIZE_EXCEEDED = 354, /**< System limit max size has been reached */
LSM_ERR_SYS_LIMIT_MAX_COUNT_EXCEEDED = 355, /**< System limit max count has been reached */
LSM_ERR_POOL_NOT_READY = 356, /**< Pool is not read for action requsted*/
diff --git a/plugin/ontap/na.py b/plugin/ontap/na.py
index 19cdba1..3c1cf5f 100644
--- a/plugin/ontap/na.py
+++ b/plugin/ontap/na.py
@@ -147,7 +147,8 @@ class FilerError(Exception):
# group exist
EVDISK_ERROR_SIZE_TOO_LARGE = 9034 # LUN size too large.
EVDISK_ERROR_NO_SUCH_VOLUME = 9036 # NetApp Volume not exists.
- EVDISK_ERROR_SIZE_TOO_SMALL = 9041 # Specified too small a size
+ EVDISK_ERROR_SIZE_TOO_SMALL = 9041 # Specified too small a size
+ EVDISK_ERROR_SIZE_UNCHANGED = 9042 # requested size is the same.

def __init__(self, errno, reason, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py
index c5ab1d1..65ea9a1 100644
--- a/plugin/ontap/ontap.py
+++ b/plugin/ontap/ontap.py
@@ -35,7 +35,6 @@ e_map = {
na.Filer.ESIZE_TOO_LARGE: ErrorNumber.NOT_ENOUGH_SPACE,
na.Filer.ENOSPACE: ErrorNumber.NOT_ENOUGH_SPACE,
na.Filer.ENO_SUCH_FS: ErrorNumber.NOT_FOUND_FS,
- na.Filer.EVOLUME_TOO_SMALL: ErrorNumber.SIZE_TOO_SMALL,
na.Filer.EAPILICENSE: ErrorNumber.NOT_LICENSED,
na.Filer.EFSDOESNOTEXIST: ErrorNumber.NOT_FOUND_FS,
na.Filer.EFSOFFLINE: ErrorNumber.NO_SUPPORT_ONLINE_CHANGE,
@@ -621,7 +620,27 @@ class Ontap(IStorageAreaNetwork, INfs):

@handle_ontap_errors
def volume_resize(self, volume, new_size_bytes, flags=0):
- self.f.lun_resize(_lsm_vol_to_na_vol_path(volume), new_size_bytes)
+ try:
+ self.f.lun_resize(_lsm_vol_to_na_vol_path(volume), new_size_bytes)
+ except na.FilerError as fe:
+ if fe.errno == na.FilerError.EVDISK_ERROR_SIZE_TOO_SMALL:
+ min_size = self.f.lun_min_size()
+ try:
+ self.f.lun_resize(_lsm_vol_to_na_vol_path(volume),
+ min_size)
+ except na.FilerError as fe:
+ if fe.errno == na.FilerError.EVDISK_ERROR_SIZE_UNCHANGED:
+ # As requested size is not the one we are send to
+ # self.f.lun_resize(), we should silently pass.
+ pass
+ else:
+ raise
+ elif fe.errno == na.FilerError.EVDISK_ERROR_SIZE_UNCHANGED:
+ raise LsmError(ErrorNumber.NO_STATE_CHANGE,
+ "Requested size is the same as current "
+ "volume size")
+ else:
+ raise
return None, self._get_volume(_lsm_vol_to_na_vol_path(volume),
volume.pool_id)

diff --git a/python_binding/lsm/_common.py b/python_binding/lsm/_common.py
index 2b53b75..7b1f786 100644
--- a/python_binding/lsm/_common.py
+++ b/python_binding/lsm/_common.py
@@ -464,7 +464,6 @@ class ErrorNumber(object):
PLUGIN_NOT_EXIST = 311

NOT_ENOUGH_SPACE = 350
- SIZE_TOO_SMALL = 353

SYS_LIMIT_MAX_SIZE_EXCEEDED = 354
SYS_LIMIT_MAX_COUNT_EXCEEDED = 355
--
1.9.3
Tony Asleson
2014-09-02 20:21:44 UTC
Permalink
Post by Gris Ge
LAST_INIT_IN_MASKED_AG
Could we use the more generic code IS_MASKED?
Post by Gris Ge
---
c_binding/include/libstoragemgmt/libstoragemgmt_error.h | 2 +-
plugin/smispy/smis.py | 4 ++--
python_binding/lsm/_common.py | 8 +++++---
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_error.h b/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
index c72c433..abc78c6 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
@@ -90,7 +90,7 @@ typedef enum {
LSM_ERR_TRANSPORT_INVALID_ARG = 402, /**< Parameter transported over IPC is invalid */
LSM_ERR_VOLUME_BUSY = 501, /* Volume already in use */
- LSM_ERR_ACCESS_GROUP_MASKED = 502,
+ LSM_ERR_LAST_INIT_IN_MASKED_AG = 502,
LSM_ERR_UNSUPPORTED_SEARCH_KEY = 510, /**< Unsupport search key */
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 081d62f..7778ece 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
cim_spc_path,
AssocClass='CIM_ProtocolControllerForUnit',
- raise LsmError(ErrorNumber.ACCESS_GROUP_MASKED,
+ raise LsmError(ErrorNumber.LAST_INIT_IN_MASKED_AG,
"Refuse to remove last initiator member "
"from access group which have volume "
"masked to")
Refresh my memory... this is because some arrays will delete the access
group if all initiators are removed from it?


Thanks!

Regards,
Tony
Gris Ge
2014-09-03 04:42:55 UTC
Permalink
Post by Tony Asleson
Post by Gris Ge
LAST_INIT_IN_MASKED_AG
Could we use the more generic code IS_MASKED?
It might confuse plugin developer or user. They might think masked
access group cannot delete its initiator member.
But actually, we just prevent empty access group with volume masked.
Post by Tony Asleson
Post by Gris Ge
+ raise LsmError(ErrorNumber.LAST_INIT_IN_MASKED_AG,
"Refuse to remove last initiator member "
"from access group which have volume "
"masked to")
Refresh my memory... this is because some arrays will delete the access
group if all initiators are removed from it?
Actually, the only array support CIM_InitiatorMaskingGroup -- EMC VMAX
support empty access group with masked volume(I forgot I tested it or
not, but their return of CIM_GroupMaskingMappingCapabilities says so)

In CIM_GroupMaskingMappingCapabilities['SupportedInitiatorGroupFeatures']:
5: Group associated with view can be empty

This indicates the possibility of no support.

Base on two reasons we should refuse a error for deletion against last
initiator on masked access group:
1. We already refused to do volume masking against empty access
group in volume_mask() for ErrorNumber.EMPTY_ACCESS_GROUP.
Allowing remove last initiator in masked access group break that
commitment.
2. DMTF indicate some array might not support empty access group
with view. (Some array might not even support empty access group
at all)

Any better idea?

Thank you.
Best regards.
Post by Tony Asleson
Thanks!
Regards,
Tony
--
Gris Ge
Tony Asleson
2014-09-02 20:18:29 UTC
Permalink
Post by Gris Ge
* Just align with method name volume_enable() and volume_disable().
---
diff --git a/plugin/targetd/targetd.py b/plugin/targetd/targetd.py
index a39d7b9..9f20cab 100644
--- a/plugin/targetd/targetd.py
+++ b/plugin/targetd/targetd.py
cap.set(Capabilities.VOLUME_REPLICATE)
cap.set(Capabilities.VOLUME_REPLICATE_COPY)
cap.set(Capabilities.VOLUME_DELETE)
- cap.set(Capabilities.VOLUME_OFFLINE)
- cap.set(Capabilities.VOLUME_ONLINE)
+ cap.set(Capabilities.VOLUME_DISABLE)
+ cap.set(Capabilities.VOLUME_ENABLE)
These should just be removed for targetd as they are unsupported.

Thanks!

Regards,
Tony
Loading...