Discussion:
[Libstoragemgmt-devel] [PATCH 1/4] Python library: Better error numbers to indicate bugs
Gris Ge
2014-07-23 13:06:54 UTC
Permalink
Renamed:
INTERNAL_ERROR -> LSM_LIB_BUG
LSM_BUG -> LSM_PLUGIN_BUG

Added:
LSM_STORAGE_SDK_BUG = 3

Description:
* LSM_LIB_BUG
# Indicate bugs in libstoragemgmt library codes.
# For example: _client.py, _common.py and etc
* LSM_PLUGIN_BUG
# Indicate a bug in plugin codes.
* LSM_STORAGE_SDK_BUG
# Indicate a storage SDK bug.
# For example: storage SDK is misbehaving against their documents.
# Known storage SDK bug, need a storage SDK upgrade.


Signed-off-by: Gris Ge <***@redhat.com>
---
python_binding/lsm/_common.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/python_binding/lsm/_common.py b/python_binding/lsm/_common.py
index 3f4d5e9..1f52542 100644
--- a/python_binding/lsm/_common.py
+++ b/python_binding/lsm/_common.py
@@ -422,8 +422,9 @@ class ErrorLevel(object):
#using them.
class ErrorNumber(object):
OK = 0
- INTERNAL_ERROR = 1
- LSM_BUG = 2
+ LSM_LIB_BUG = 1
+ LSM_PLUGIN_BUG = 2
+ LSM_STORAGE_SDK_BUG = 3
JOB_STARTED = 7
INDEX_BOUNDS = 10
TIMEOUT = 11
--
1.8.3.1
Gris Ge
2014-07-23 13:06:55 UTC
Permalink
Renamed:
LSM_ERR_INTERNAL_ERROR -> LSM_ERR_LIB_BUG

Added:
LSM_ERR_PLUGIN_BUG = 2
LSM_ERR_STORAGE_SDK_BUG = 3

Description:
* LSM_ERR_LIB_BUG
# Indicate bugs in libstoragemgmt library codes.
# For example: _client.py, _common.py and etc
* LSM_ERR_PLUGIN_BUG
# Indicate a bug in plugin codes.
* LSM_ERR_STORAGE_SDK_BUG
# Indicate a storage SDK bug.
# For example: storage SDK is misbehaving against their documents.
# Known storage SDK bug, need a storage SDK upgrade.

Signed-off-by: Gris Ge <***@redhat.com>
---
.../include/libstoragemgmt/libstoragemgmt_error.h | 4 +-
c_binding/lsm_convert.cpp | 4 +-
c_binding/lsm_datatypes.cpp | 4 +-
c_binding/lsm_mgmt.cpp | 60 +++++++++++-----------
c_binding/lsm_plugin_ipc.cpp | 4 +-
5 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_error.h b/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
index eab9d2c..d03c29a 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
@@ -44,7 +44,9 @@ typedef enum {
/**< \enum lsm_error_number Possible enumerated return codes from library */
typedef enum {
LSM_ERR_OK = 0, /**< OK */
- LSM_ERR_INTERNAL_ERROR = 1, /**< Internal error */
+ LSM_ERR_LIB_BUG = 1, /**< Library BUG */
+ LSM_ERR_PLUGIN_BUG = 2, /**< Plugin BUG */
+ LSM_ERR_STORAGE_SDK_BUG = 3, /**< Storage SDK BUG */
LSM_ERR_JOB_STARTED = 7, /**< Operation has started */
LSM_ERR_INDEX_BOUNDS = 10, /**< Out of bounds on string index */
LSM_ERR_TIMEOUT = 11, /**< Plug-in is un-responsive */
diff --git a/c_binding/lsm_convert.cpp b/c_binding/lsm_convert.cpp
index c1e5364..554d2da 100644
--- a/c_binding/lsm_convert.cpp
+++ b/c_binding/lsm_convert.cpp
@@ -105,7 +105,7 @@ int value_array_to_volumes(Value &volume_values, lsm_volume **volumes[],
*count = 0;
}

- rc = LSM_ERR_INTERNAL_ERROR;
+ rc = LSM_ERR_LIB_BUG;
}
return rc;
}
@@ -171,7 +171,7 @@ int value_array_to_disks(Value &disk_values, lsm_disk **disks[], uint32_t *count
}
}
} catch( const ValueException &ve ) {
- rc = LSM_ERR_INTERNAL_ERROR;
+ rc = LSM_ERR_LIB_BUG;
if( *disks && *count ) {
lsm_disk_record_array_free(*disks, *count);
*disks = NULL;
diff --git a/c_binding/lsm_datatypes.cpp b/c_binding/lsm_datatypes.cpp
index 2ab6d18..4e8795a 100644
--- a/c_binding/lsm_datatypes.cpp
+++ b/c_binding/lsm_datatypes.cpp
@@ -272,11 +272,11 @@ static int connection_establish( lsm_connect *c, const char * password,
le.what(), NULL, NULL, 0 );
rc = LSM_ERR_TRANSPORT_COMMUNICATION;
} catch (...) {
- *e = lsm_error_create(LSM_ERR_INTERNAL_ERROR,
+ *e = lsm_error_create(LSM_ERR_LIB_BUG,
LSM_ERR_DOMAIN_FRAME_WORK,
LSM_ERR_LEVEL_ERROR, "Undefined exception",
NULL, NULL, NULL, 0 );
- rc = LSM_ERR_INTERNAL_ERROR;
+ rc = LSM_ERR_LIB_BUG;
}
return rc;
}
diff --git a/c_binding/lsm_mgmt.cpp b/c_binding/lsm_mgmt.cpp
index 86f9789..722d126 100644
--- a/c_binding/lsm_mgmt.cpp
+++ b/c_binding/lsm_mgmt.cpp
@@ -176,7 +176,7 @@ static int rpc(lsm_connect *c, const char *method, const Value &parameters,
return logException(c, LSM_ERR_TRANSPORT_COMMUNICATION, "Plug-in died",
"Check syslog");
} catch (...) {
- return logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected exception",
+ return logException(c, LSM_ERR_LIB_BUG, "Unexpected exception",
"Unknown exception");
}
return LSM_ERR_OK;
@@ -200,7 +200,7 @@ static int jobCheck( lsm_connect *c, int rc, Value &response, char **job )
}
}
} catch (const ValueException &ve) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Wrong type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Wrong type",
ve.what());
}
return rc;
@@ -214,7 +214,7 @@ static int getAccessGroups( lsm_connect *c, int rc, Value &response,
*groups = value_to_access_group_list(response, count);
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -297,7 +297,7 @@ int lsm_plugin_info_get(lsm_connect *c, char **desc,
*desc = NULL;
free(*version);
*version = NULL;
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}

@@ -387,12 +387,12 @@ int lsm_available_plugins_list(const char *sep,

if( -1 == closedir(dirp)) {
//log the error
- rc = LSM_ERR_INTERNAL_ERROR;
+ rc = LSM_ERR_LIB_BUG;
}

} else { /* If dirp == NULL */
//Log the error
- rc = LSM_ERR_INTERNAL_ERROR;
+ rc = LSM_ERR_LIB_BUG;
}

if (LSM_ERR_OK == rc) {
@@ -444,7 +444,7 @@ int lsm_connect_timeout_get(lsm_connect *c, uint32_t *timeout, lsm_flag flags)
}
}
catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -478,7 +478,7 @@ static int jobStatus( lsm_connect *c, const char *job,
returned_value = j[2];
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -524,7 +524,7 @@ int lsm_job_status_pool_get(lsm_connect *c,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -555,7 +555,7 @@ int lsm_job_status_volume_get( lsm_connect *c, const char *job,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -584,7 +584,7 @@ int lsm_job_status_fs_get(lsm_connect *c, const char *job,
}
}
} catch( const ValueException &ve) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -613,7 +613,7 @@ int lsm_job_status_ss_get(lsm_connect *c, const char *job,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -672,7 +672,7 @@ int lsm_capabilities(lsm_connect *c, lsm_system *system,
*cap = value_to_capabilities(response);
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}

@@ -717,7 +717,7 @@ int lsm_pool_list(lsm_connect *c, char *search_key, char *search_value,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
if( *poolArray && *count ) {
lsm_pool_record_array_free(*poolArray, *count);
@@ -770,7 +770,7 @@ int lsm_target_port_list(lsm_connect *c, const char *search_key,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
if( *target_ports && *count ) {
lsm_target_port_record_array_free(*target_ports, *count);
@@ -788,7 +788,7 @@ static int get_volume_array(lsm_connect *c, int rc, Value &response,
rc = value_array_to_volumes(response, volumes, count);

if( LSM_ERR_OK != rc ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", NULL);
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type", NULL);
}
}
return rc;
@@ -828,7 +828,7 @@ static int get_disk_array(lsm_connect *c, int rc, Value &response,
rc = value_array_to_disks(response, disks, count);

if( LSM_ERR_OK != rc ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", NULL);
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type", NULL);
}
}

@@ -887,7 +887,7 @@ static void* parse_job_response(lsm_connect *c, Value response, int &rc,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
free(*job);
*job = NULL;
@@ -1123,7 +1123,7 @@ int lsm_pool_delete(lsm_connect *c, lsm_pool *pool, char **job, lsm_flag flags)
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -1265,7 +1265,7 @@ int lsm_volume_replicate_range_block_size(lsm_connect *c, lsm_system *system,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -1341,7 +1341,7 @@ int lsm_volume_delete(lsm_connect *c, lsm_volume *volume, char **job,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -1664,7 +1664,7 @@ int lsm_volumes_accessible_by_access_group(lsm_connect *c,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
if( *volumes && *count ) {
lsm_volume_record_array_free(*volumes, *count);
@@ -1733,11 +1733,11 @@ int lsm_volume_child_dependency(lsm_connect *c, lsm_volume *volume,
*yes = 1;
}
} else {
- rc = LSM_ERR_INTERNAL_ERROR;
+ rc = LSM_ERR_LIB_BUG;
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -1807,7 +1807,7 @@ int lsm_system_list(lsm_connect *c, lsm_system **systems[],
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
if( *systems ) {
lsm_system_record_array_free( *systems, *systemCount);
@@ -1861,7 +1861,7 @@ int lsm_fs_list(lsm_connect *c, const char *search_key,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
if( *fs && *fsCount) {
lsm_fs_record_array_free(*fs, *fsCount);
@@ -2059,11 +2059,11 @@ int lsm_fs_child_dependency( lsm_connect *c, lsm_fs *fs, lsm_string_list *files,
*yes = 1;
}
} else {
- rc = LSM_ERR_INTERNAL_ERROR;
+ rc = LSM_ERR_LIB_BUG;
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -2141,7 +2141,7 @@ int lsm_fs_ss_list(lsm_connect *c, lsm_fs *fs, lsm_fs_ss **ss[],
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
if( *ss && *ssCount ) {
lsm_fs_ss_record_array_free(*ss, *ssCount);
@@ -2302,7 +2302,7 @@ int lsm_nfs_list( lsm_connect *c, const char *search_key,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
if( *exports && *count ) {
lsm_nfs_export_record_array_free( *exports, *count );
diff --git a/c_binding/lsm_plugin_ipc.cpp b/c_binding/lsm_plugin_ipc.cpp
index 983648e..11e0f05 100644
--- a/c_binding/lsm_plugin_ipc.cpp
+++ b/c_binding/lsm_plugin_ipc.cpp
@@ -2307,7 +2307,7 @@ static std::map<std::string,handler> dispatch = static_map<std::string,handler>
static int process_request(lsm_plugin_ptr p, const std::string &method, Value &request,
Value &response)
{
- int rc = LSM_ERR_INTERNAL_ERROR;
+ int rc = LSM_ERR_LIB_BUG;

response = Value(); //Default response will be null

@@ -2718,4 +2718,4 @@ void lsm_plug_target_port_search_filter(const char *search_key,
tp_free);
}
}
-}
\ No newline at end of file
+}
--
1.8.3.1
Tony Asleson
2014-07-24 21:05:02 UTC
Permalink
Patch committed.

Thanks,
Tony
Post by Gris Ge
LSM_ERR_INTERNAL_ERROR -> LSM_ERR_LIB_BUG
LSM_ERR_PLUGIN_BUG = 2
LSM_ERR_STORAGE_SDK_BUG = 3
* LSM_ERR_LIB_BUG
# Indicate bugs in libstoragemgmt library codes.
# For example: _client.py, _common.py and etc
* LSM_ERR_PLUGIN_BUG
# Indicate a bug in plugin codes.
* LSM_ERR_STORAGE_SDK_BUG
# Indicate a storage SDK bug.
# For example: storage SDK is misbehaving against their documents.
# Known storage SDK bug, need a storage SDK upgrade.
---
.../include/libstoragemgmt/libstoragemgmt_error.h | 4 +-
c_binding/lsm_convert.cpp | 4 +-
c_binding/lsm_datatypes.cpp | 4 +-
c_binding/lsm_mgmt.cpp | 60 +++++++++++-----------
c_binding/lsm_plugin_ipc.cpp | 4 +-
5 files changed, 39 insertions(+), 37 deletions(-)
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_error.h b/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
index eab9d2c..d03c29a 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
@@ -44,7 +44,9 @@ typedef enum {
/**< \enum lsm_error_number Possible enumerated return codes from library */
typedef enum {
LSM_ERR_OK = 0, /**< OK */
- LSM_ERR_INTERNAL_ERROR = 1, /**< Internal error */
+ LSM_ERR_LIB_BUG = 1, /**< Library BUG */
+ LSM_ERR_PLUGIN_BUG = 2, /**< Plugin BUG */
+ LSM_ERR_STORAGE_SDK_BUG = 3, /**< Storage SDK BUG */
LSM_ERR_JOB_STARTED = 7, /**< Operation has started */
LSM_ERR_INDEX_BOUNDS = 10, /**< Out of bounds on string index */
LSM_ERR_TIMEOUT = 11, /**< Plug-in is un-responsive */
diff --git a/c_binding/lsm_convert.cpp b/c_binding/lsm_convert.cpp
index c1e5364..554d2da 100644
--- a/c_binding/lsm_convert.cpp
+++ b/c_binding/lsm_convert.cpp
@@ -105,7 +105,7 @@ int value_array_to_volumes(Value &volume_values, lsm_volume **volumes[],
*count = 0;
}
- rc = LSM_ERR_INTERNAL_ERROR;
+ rc = LSM_ERR_LIB_BUG;
}
return rc;
}
@@ -171,7 +171,7 @@ int value_array_to_disks(Value &disk_values, lsm_disk **disks[], uint32_t *count
}
}
} catch( const ValueException &ve ) {
- rc = LSM_ERR_INTERNAL_ERROR;
+ rc = LSM_ERR_LIB_BUG;
if( *disks && *count ) {
lsm_disk_record_array_free(*disks, *count);
*disks = NULL;
diff --git a/c_binding/lsm_datatypes.cpp b/c_binding/lsm_datatypes.cpp
index 2ab6d18..4e8795a 100644
--- a/c_binding/lsm_datatypes.cpp
+++ b/c_binding/lsm_datatypes.cpp
@@ -272,11 +272,11 @@ static int connection_establish( lsm_connect *c, const char * password,
le.what(), NULL, NULL, 0 );
rc = LSM_ERR_TRANSPORT_COMMUNICATION;
} catch (...) {
- *e = lsm_error_create(LSM_ERR_INTERNAL_ERROR,
+ *e = lsm_error_create(LSM_ERR_LIB_BUG,
LSM_ERR_DOMAIN_FRAME_WORK,
LSM_ERR_LEVEL_ERROR, "Undefined exception",
NULL, NULL, NULL, 0 );
- rc = LSM_ERR_INTERNAL_ERROR;
+ rc = LSM_ERR_LIB_BUG;
}
return rc;
}
diff --git a/c_binding/lsm_mgmt.cpp b/c_binding/lsm_mgmt.cpp
index 86f9789..722d126 100644
--- a/c_binding/lsm_mgmt.cpp
+++ b/c_binding/lsm_mgmt.cpp
@@ -176,7 +176,7 @@ static int rpc(lsm_connect *c, const char *method, const Value &parameters,
return logException(c, LSM_ERR_TRANSPORT_COMMUNICATION, "Plug-in died",
"Check syslog");
} catch (...) {
- return logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected exception",
+ return logException(c, LSM_ERR_LIB_BUG, "Unexpected exception",
"Unknown exception");
}
return LSM_ERR_OK;
@@ -200,7 +200,7 @@ static int jobCheck( lsm_connect *c, int rc, Value &response, char **job )
}
}
} catch (const ValueException &ve) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Wrong type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Wrong type",
ve.what());
}
return rc;
@@ -214,7 +214,7 @@ static int getAccessGroups( lsm_connect *c, int rc, Value &response,
*groups = value_to_access_group_list(response, count);
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -297,7 +297,7 @@ int lsm_plugin_info_get(lsm_connect *c, char **desc,
*desc = NULL;
free(*version);
*version = NULL;
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
@@ -387,12 +387,12 @@ int lsm_available_plugins_list(const char *sep,
if( -1 == closedir(dirp)) {
//log the error
- rc = LSM_ERR_INTERNAL_ERROR;
+ rc = LSM_ERR_LIB_BUG;
}
} else { /* If dirp == NULL */
//Log the error
- rc = LSM_ERR_INTERNAL_ERROR;
+ rc = LSM_ERR_LIB_BUG;
}
if (LSM_ERR_OK == rc) {
@@ -444,7 +444,7 @@ int lsm_connect_timeout_get(lsm_connect *c, uint32_t *timeout, lsm_flag flags)
}
}
catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -478,7 +478,7 @@ static int jobStatus( lsm_connect *c, const char *job,
returned_value = j[2];
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -524,7 +524,7 @@ int lsm_job_status_pool_get(lsm_connect *c,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -555,7 +555,7 @@ int lsm_job_status_volume_get( lsm_connect *c, const char *job,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -584,7 +584,7 @@ int lsm_job_status_fs_get(lsm_connect *c, const char *job,
}
}
} catch( const ValueException &ve) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -613,7 +613,7 @@ int lsm_job_status_ss_get(lsm_connect *c, const char *job,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -672,7 +672,7 @@ int lsm_capabilities(lsm_connect *c, lsm_system *system,
*cap = value_to_capabilities(response);
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
@@ -717,7 +717,7 @@ int lsm_pool_list(lsm_connect *c, char *search_key, char *search_value,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
if( *poolArray && *count ) {
lsm_pool_record_array_free(*poolArray, *count);
@@ -770,7 +770,7 @@ int lsm_target_port_list(lsm_connect *c, const char *search_key,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
if( *target_ports && *count ) {
lsm_target_port_record_array_free(*target_ports, *count);
@@ -788,7 +788,7 @@ static int get_volume_array(lsm_connect *c, int rc, Value &response,
rc = value_array_to_volumes(response, volumes, count);
if( LSM_ERR_OK != rc ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", NULL);
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type", NULL);
}
}
return rc;
@@ -828,7 +828,7 @@ static int get_disk_array(lsm_connect *c, int rc, Value &response,
rc = value_array_to_disks(response, disks, count);
if( LSM_ERR_OK != rc ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", NULL);
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type", NULL);
}
}
@@ -887,7 +887,7 @@ static void* parse_job_response(lsm_connect *c, Value response, int &rc,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
free(*job);
*job = NULL;
@@ -1123,7 +1123,7 @@ int lsm_pool_delete(lsm_connect *c, lsm_pool *pool, char **job, lsm_flag flags)
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -1265,7 +1265,7 @@ int lsm_volume_replicate_range_block_size(lsm_connect *c, lsm_system *system,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -1341,7 +1341,7 @@ int lsm_volume_delete(lsm_connect *c, lsm_volume *volume, char **job,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -1664,7 +1664,7 @@ int lsm_volumes_accessible_by_access_group(lsm_connect *c,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
if( *volumes && *count ) {
lsm_volume_record_array_free(*volumes, *count);
@@ -1733,11 +1733,11 @@ int lsm_volume_child_dependency(lsm_connect *c, lsm_volume *volume,
*yes = 1;
}
} else {
- rc = LSM_ERR_INTERNAL_ERROR;
+ rc = LSM_ERR_LIB_BUG;
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -1807,7 +1807,7 @@ int lsm_system_list(lsm_connect *c, lsm_system **systems[],
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
if( *systems ) {
lsm_system_record_array_free( *systems, *systemCount);
@@ -1861,7 +1861,7 @@ int lsm_fs_list(lsm_connect *c, const char *search_key,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
if( *fs && *fsCount) {
lsm_fs_record_array_free(*fs, *fsCount);
@@ -2059,11 +2059,11 @@ int lsm_fs_child_dependency( lsm_connect *c, lsm_fs *fs, lsm_string_list *files,
*yes = 1;
}
} else {
- rc = LSM_ERR_INTERNAL_ERROR;
+ rc = LSM_ERR_LIB_BUG;
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
}
return rc;
@@ -2141,7 +2141,7 @@ int lsm_fs_ss_list(lsm_connect *c, lsm_fs *fs, lsm_fs_ss **ss[],
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
if( *ss && *ssCount ) {
lsm_fs_ss_record_array_free(*ss, *ssCount);
@@ -2302,7 +2302,7 @@ int lsm_nfs_list( lsm_connect *c, const char *search_key,
}
}
} catch( const ValueException &ve ) {
- rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ rc = logException(c, LSM_ERR_LIB_BUG, "Unexpected type",
ve.what());
if( *exports && *count ) {
lsm_nfs_export_record_array_free( *exports, *count );
diff --git a/c_binding/lsm_plugin_ipc.cpp b/c_binding/lsm_plugin_ipc.cpp
index 983648e..11e0f05 100644
--- a/c_binding/lsm_plugin_ipc.cpp
+++ b/c_binding/lsm_plugin_ipc.cpp
@@ -2307,7 +2307,7 @@ static std::map<std::string,handler> dispatch = static_map<std::string,handler>
static int process_request(lsm_plugin_ptr p, const std::string &method, Value &request,
Value &response)
{
- int rc = LSM_ERR_INTERNAL_ERROR;
+ int rc = LSM_ERR_LIB_BUG;
response = Value(); //Default response will be null
@@ -2718,4 +2718,4 @@ void lsm_plug_target_port_search_filter(const char *search_key,
tp_free);
}
}
-}
\ No newline at end of file
+}
Gris Ge
2014-07-23 13:06:56 UTC
Permalink
Update plugins to use LSM_PLUGIN_BUG instead of INTERNAL_ERROR or LSM_BUG.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/ontap/ontap.py | 9 +++++----
plugin/sim/simarray.py | 4 ++--
plugin/smispy/smis.py | 34 +++++++++++++++++-----------------
plugin/targetd/targetd.py | 2 +-
4 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py
index 8696647..bf5159c 100644
--- a/plugin/ontap/ontap.py
+++ b/plugin/ontap/ontap.py
@@ -729,8 +729,9 @@ class Ontap(IStorageAreaNetwork, INfs):
if g.name == name:
return g

- raise LsmError(ErrorNumber.INTERNAL_ERROR,
- "Unable to find group just created!")
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
+ "access_group_create(): Unable to find access group "
+ "%s just created!" % g.name)

@handle_ontap_errors
def access_group_delete(self, access_group, flags=0):
@@ -752,7 +753,7 @@ class Ontap(IStorageAreaNetwork, INfs):
raise
na_ags = self.f.igroups(access_group.name)
if len(na_ags) != 1:
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"access_group_initiator_add(): Got unexpected"
"(not 1) count of na_ag: %s" % na_ags)

@@ -774,7 +775,7 @@ class Ontap(IStorageAreaNetwork, INfs):
raise
na_ags = self.f.igroups(access_group.name)
if len(na_ags) != 1:
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"access_group_initiator_add(): Got unexpected"
"(not 1) count of na_ag: %s" % na_ags)

diff --git a/plugin/sim/simarray.py b/plugin/sim/simarray.py
index ad6f9fe..5d9cb6d 100644
--- a/plugin/sim/simarray.py
+++ b/plugin/sim/simarray.py
@@ -761,7 +761,7 @@ class SimData(object):
member_sizes.extend([pool_each_size])

else:
- raise LsmError(ErrorNumber.INTERNAL_ERROR,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Got unsupported member_type in _size_of_raid()" +
": %d" % member_type)
all_size = 0
@@ -807,7 +807,7 @@ class SimData(object):
print "%s" % size_bytes_2_size_human(all_size)
print "%s" % size_bytes_2_size_human(member_size)
return int(all_size / 2 - member_size * 2)
- raise LsmError(ErrorNumber.INTERNAL_ERROR,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"_size_of_raid() got invalid raid type: " +
"%s(%d)" % (Pool.raid_type_to_str(raid_type),
raid_type))
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index e1302df..e77e21e 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -77,7 +77,7 @@ def handle_cim_errors(method):
if 'Errno 113' in desc:
raise LsmError(ErrorNumber.NETWORK_HOSTDOWN,
'Host is down')
- raise LsmError(ErrorNumber.LSM_BUG, desc)
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG, desc)
except pywbem.cim_http.AuthError as ae:
raise LsmError(ErrorNumber.PLUGIN_AUTH_FAILED, "Unauthorized user")
except pywbem.cim_http.Error as te:
@@ -553,7 +553,7 @@ class Smis(IStorageAreaNetwork):
return cim_xxx

if raise_error:
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Unable to find class instance %s " % class_name +
"with property %s " % prop_name +
"with value %s" % prop_value)
@@ -1004,7 +1004,7 @@ class Smis(IStorageAreaNetwork):
return 'CIM_SCSIProtocolController'
if class_type == 'Initiator':
return 'CIM_StorageHardwareID'
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Smis._cim_class_name_of() got unknown " +
"class_type %s" % class_type)

@@ -1024,7 +1024,7 @@ class Smis(IStorageAreaNetwork):
return ErrorNumber.NOT_FOUND_ACCESS_GROUP
if class_type == 'Initiator':
return ErrorNumber.INVALID_ARGUMENT
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Smis._cim_class_name_of() got unknown " +
"class_type %s" % class_type)

@@ -1051,7 +1051,7 @@ class Smis(IStorageAreaNetwork):
elif class_type == 'Initiator':
rc = ['StorageID']
else:
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Smis._cim_class_name_of() got unknown " +
"class_type %s" % class_type)

@@ -1377,7 +1377,7 @@ class Smis(IStorageAreaNetwork):
PropertyList=pool_pros, LocalOnly=False)
return self._new_pool(cim_new_pool)
else:
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Got not new Pool from out of InvokeMethod" +
"when CreateOrModifyElementFromStoragePool")

@@ -1564,7 +1564,7 @@ class Smis(IStorageAreaNetwork):
if pool:
rc.extend([pool])
else:
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Failed to retrieve pool information " +
"from CIM_StoragePool: %s" % cim_pool.path)
return search_property(rc, search_key, search_value)
@@ -2049,7 +2049,7 @@ class Smis(IStorageAreaNetwork):
raise LsmError(ErrorNumber.NO_SUPPORT,
'AccessGroup is not supported by this array')
else:
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Got %d instance of " % len(cim_ccss_path) +
"ControllerConfigurationService from %s" %
cim_sys.path + " in _cim_ags_of()")
@@ -2189,7 +2189,7 @@ class Smis(IStorageAreaNetwork):
"CIM_StorageHardwareIDManagementService to create"
"new initiator")
if len(cim_hw_srvs) != 1:
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"_initiator_create(): Got more than one "
"CIM_StorageHardwareIDManagementService")

@@ -2202,8 +2202,8 @@ class Smis(IStorageAreaNetwork):
return

# Ideally, we should handle CIM Error here in stead of raise
- # LSM_BUG error. Let's wait user report on bug.
- raise LsmError(ErrorNumber.LSM_BUG,
+ # LSM_PLUGIN_BUG error. Let's wait user report on bug.
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
'Error on _initiator_create(): rc: "%s", out: "%s"'
% (str(rc), out))

@@ -2448,7 +2448,7 @@ class Smis(IStorageAreaNetwork):
cim_pri_ext # The CIM_Instance of Primordial CIM_StorageExtent
Exceptions:
LsmError
- ErrorNumber.LSM_BUG # Failed to find out pri cim_ext
+ ErrorNumber.LSM_PLUGIN_BUG # Failed to find out pri cim_ext
"""
if property_list is None:
property_list = ['Primordial']
@@ -2466,7 +2466,7 @@ class Smis(IStorageAreaNetwork):
# each CIM_DiskDrive
return cim_exts[0]
else:
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Failed to find out Primordial " +
"CIM_StorageExtent for CIM_DiskDrive %s " %
cim_disk_path)
@@ -2684,7 +2684,7 @@ class Smis(IStorageAreaNetwork):
elif len(cim_disks) == 2:
return None
else:
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Found two or more CIM_DiskDrive associated to " +
"requested CIM_StorageExtent %s" %
cim_pri_ext_path)
@@ -3457,12 +3457,12 @@ class Smis(IStorageAreaNetwork):
cim_iscsi_nodes.extend([cim_spc])

if len(cim_iscsi_nodes) == 0:
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"_iscsi_node_of(): No iSCSI node "
"CIM_SCSIProtocolController associated to %s"
% cim_iscsi_pg_path)
if len(cim_iscsi_nodes) > 1:
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"_iscsi_node_of(): Got two or more iSCSI node "
"CIM_SCSIProtocolController associated to %s: %s"
% (cim_iscsi_pg_path, cim_iscsi_nodes))
@@ -3502,7 +3502,7 @@ class Smis(IStorageAreaNetwork):
AssocClass='CIM_BindsTo',
PropertyList=['PortNumber'])
if len(cim_tcps) == 0:
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"_cim_iscsi_pg_to_lsm(): "
"No CIM_TCPProtocolEndpoint associated to %s"
% cim_iscsi_pg.path)
diff --git a/plugin/targetd/targetd.py b/plugin/targetd/targetd.py
index fc19f3c..6ecc0dc 100644
--- a/plugin/targetd/targetd.py
+++ b/plugin/targetd/targetd.py
@@ -626,5 +626,5 @@ class TargetdStorage(IStorageAreaNetwork, INfs):
if status:
if status[0]:
raise LsmError(
- ErrorNumber.INTERNAL_ERROR,
+ ErrorNumber.LSM_PLUGIN_BUG,
"%d has error %d" % (async_code, status[0]))
--
1.8.3.1
Tony Asleson
2014-07-24 21:05:07 UTC
Permalink
Patch committed.

Thanks,
Tony
Post by Gris Ge
Update plugins to use LSM_PLUGIN_BUG instead of INTERNAL_ERROR or LSM_BUG.
---
plugin/ontap/ontap.py | 9 +++++----
plugin/sim/simarray.py | 4 ++--
plugin/smispy/smis.py | 34 +++++++++++++++++-----------------
plugin/targetd/targetd.py | 2 +-
4 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py
index 8696647..bf5159c 100644
--- a/plugin/ontap/ontap.py
+++ b/plugin/ontap/ontap.py
return g
- raise LsmError(ErrorNumber.INTERNAL_ERROR,
- "Unable to find group just created!")
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
+ "access_group_create(): Unable to find access group "
+ "%s just created!" % g.name)
@handle_ontap_errors
raise
na_ags = self.f.igroups(access_group.name)
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"access_group_initiator_add(): Got unexpected"
"(not 1) count of na_ag: %s" % na_ags)
raise
na_ags = self.f.igroups(access_group.name)
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"access_group_initiator_add(): Got unexpected"
"(not 1) count of na_ag: %s" % na_ags)
diff --git a/plugin/sim/simarray.py b/plugin/sim/simarray.py
index ad6f9fe..5d9cb6d 100644
--- a/plugin/sim/simarray.py
+++ b/plugin/sim/simarray.py
member_sizes.extend([pool_each_size])
- raise LsmError(ErrorNumber.INTERNAL_ERROR,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Got unsupported member_type in _size_of_raid()" +
": %d" % member_type)
all_size = 0
print "%s" % size_bytes_2_size_human(all_size)
print "%s" % size_bytes_2_size_human(member_size)
return int(all_size / 2 - member_size * 2)
- raise LsmError(ErrorNumber.INTERNAL_ERROR,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"_size_of_raid() got invalid raid type: " +
"%s(%d)" % (Pool.raid_type_to_str(raid_type),
raid_type))
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index e1302df..e77e21e 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
raise LsmError(ErrorNumber.NETWORK_HOSTDOWN,
'Host is down')
- raise LsmError(ErrorNumber.LSM_BUG, desc)
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG, desc)
raise LsmError(ErrorNumber.PLUGIN_AUTH_FAILED, "Unauthorized user")
return cim_xxx
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Unable to find class instance %s " % class_name +
"with property %s " % prop_name +
"with value %s" % prop_value)
return 'CIM_SCSIProtocolController'
return 'CIM_StorageHardwareID'
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Smis._cim_class_name_of() got unknown " +
"class_type %s" % class_type)
return ErrorNumber.NOT_FOUND_ACCESS_GROUP
return ErrorNumber.INVALID_ARGUMENT
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Smis._cim_class_name_of() got unknown " +
"class_type %s" % class_type)
rc = ['StorageID']
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Smis._cim_class_name_of() got unknown " +
"class_type %s" % class_type)
PropertyList=pool_pros, LocalOnly=False)
return self._new_pool(cim_new_pool)
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Got not new Pool from out of InvokeMethod" +
"when CreateOrModifyElementFromStoragePool")
rc.extend([pool])
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Failed to retrieve pool information " +
"from CIM_StoragePool: %s" % cim_pool.path)
return search_property(rc, search_key, search_value)
raise LsmError(ErrorNumber.NO_SUPPORT,
'AccessGroup is not supported by this array')
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Got %d instance of " % len(cim_ccss_path) +
"ControllerConfigurationService from %s" %
cim_sys.path + " in _cim_ags_of()")
"CIM_StorageHardwareIDManagementService to create"
"new initiator")
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"_initiator_create(): Got more than one "
"CIM_StorageHardwareIDManagementService")
return
# Ideally, we should handle CIM Error here in stead of raise
- # LSM_BUG error. Let's wait user report on bug.
- raise LsmError(ErrorNumber.LSM_BUG,
+ # LSM_PLUGIN_BUG error. Let's wait user report on bug.
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
'Error on _initiator_create(): rc: "%s", out: "%s"'
% (str(rc), out))
cim_pri_ext # The CIM_Instance of Primordial CIM_StorageExtent
LsmError
- ErrorNumber.LSM_BUG # Failed to find out pri cim_ext
+ ErrorNumber.LSM_PLUGIN_BUG # Failed to find out pri cim_ext
"""
property_list = ['Primordial']
# each CIM_DiskDrive
return cim_exts[0]
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Failed to find out Primordial " +
"CIM_StorageExtent for CIM_DiskDrive %s " %
cim_disk_path)
return None
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"Found two or more CIM_DiskDrive associated to " +
"requested CIM_StorageExtent %s" %
cim_pri_ext_path)
cim_iscsi_nodes.extend([cim_spc])
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"_iscsi_node_of(): No iSCSI node "
"CIM_SCSIProtocolController associated to %s"
% cim_iscsi_pg_path)
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"_iscsi_node_of(): Got two or more iSCSI node "
"CIM_SCSIProtocolController associated to %s: %s"
% (cim_iscsi_pg_path, cim_iscsi_nodes))
AssocClass='CIM_BindsTo',
PropertyList=['PortNumber'])
- raise LsmError(ErrorNumber.LSM_BUG,
+ raise LsmError(ErrorNumber.LSM_PLUGIN_BUG,
"_cim_iscsi_pg_to_lsm(): "
"No CIM_TCPProtocolEndpoint associated to %s"
% cim_iscsi_pg.path)
diff --git a/plugin/targetd/targetd.py b/plugin/targetd/targetd.py
index fc19f3c..6ecc0dc 100644
--- a/plugin/targetd/targetd.py
+++ b/plugin/targetd/targetd.py
raise LsmError(
- ErrorNumber.INTERNAL_ERROR,
+ ErrorNumber.LSM_PLUGIN_BUG,
"%d has error %d" % (async_code, status[0]))
Gris Ge
2014-07-23 13:06:57 UTC
Permalink
LSM_ERR_INTERNAL_ERROR has been renamed to LSM_ERR_LIB_BUG in C library.
Hence we update the test.

Signed-off-by: Gris Ge <***@redhat.com>
---
test/tester.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/tester.c b/test/tester.c
index 59a2829..96119d6 100644
--- a/test/tester.c
+++ b/test/tester.c
@@ -2012,7 +2012,7 @@ START_TEST(test_error_reporting)
void *debug_data = NULL;
uint32_t debug_size = 0;

- lsm_error_ptr e = lsm_error_create( LSM_ERR_INTERNAL_ERROR,
+ lsm_error_ptr e = lsm_error_create( LSM_ERR_LIB_BUG,
LSM_ERR_DOMAIN_PLUG_IN,
LSM_ERR_LEVEL_ERROR, msg,
exception, debug_msg,
@@ -2021,7 +2021,7 @@ START_TEST(test_error_reporting)
fail_unless(e != NULL);

if( e ) {
- fail_unless(LSM_ERR_INTERNAL_ERROR == lsm_error_number_get(e));
+ fail_unless(LSM_ERR_LIB_BUG == lsm_error_number_get(e));
fail_unless(LSM_ERR_DOMAIN_PLUG_IN == lsm_error_domain_get(e));
fail_unless(LSM_ERR_LEVEL_ERROR == lsm_error_level_get(e));
fail_unless(strcmp(msg, lsm_error_message_get(e)) == 0);
--
1.8.3.1
Tony Asleson
2014-07-24 21:05:11 UTC
Permalink
Patch committed.

Thanks,
Tony
Post by Gris Ge
LSM_ERR_INTERNAL_ERROR has been renamed to LSM_ERR_LIB_BUG in C library.
Hence we update the test.
---
test/tester.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/tester.c b/test/tester.c
index 59a2829..96119d6 100644
--- a/test/tester.c
+++ b/test/tester.c
@@ -2012,7 +2012,7 @@ START_TEST(test_error_reporting)
void *debug_data = NULL;
uint32_t debug_size = 0;
- lsm_error_ptr e = lsm_error_create( LSM_ERR_INTERNAL_ERROR,
+ lsm_error_ptr e = lsm_error_create( LSM_ERR_LIB_BUG,
LSM_ERR_DOMAIN_PLUG_IN,
LSM_ERR_LEVEL_ERROR, msg,
exception, debug_msg,
@@ -2021,7 +2021,7 @@ START_TEST(test_error_reporting)
fail_unless(e != NULL);
if( e ) {
- fail_unless(LSM_ERR_INTERNAL_ERROR == lsm_error_number_get(e));
+ fail_unless(LSM_ERR_LIB_BUG == lsm_error_number_get(e));
fail_unless(LSM_ERR_DOMAIN_PLUG_IN == lsm_error_domain_get(e));
fail_unless(LSM_ERR_LEVEL_ERROR == lsm_error_level_get(e));
fail_unless(strcmp(msg, lsm_error_message_get(e)) == 0);
Tony Asleson
2014-07-24 21:04:58 UTC
Permalink
Patch committed.

Thanks,
Tony
Post by Gris Ge
INTERNAL_ERROR -> LSM_LIB_BUG
LSM_BUG -> LSM_PLUGIN_BUG
LSM_STORAGE_SDK_BUG = 3
* LSM_LIB_BUG
# Indicate bugs in libstoragemgmt library codes.
# For example: _client.py, _common.py and etc
* LSM_PLUGIN_BUG
# Indicate a bug in plugin codes.
* LSM_STORAGE_SDK_BUG
# Indicate a storage SDK bug.
# For example: storage SDK is misbehaving against their documents.
# Known storage SDK bug, need a storage SDK upgrade.
---
python_binding/lsm/_common.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/python_binding/lsm/_common.py b/python_binding/lsm/_common.py
index 3f4d5e9..1f52542 100644
--- a/python_binding/lsm/_common.py
+++ b/python_binding/lsm/_common.py
#using them.
OK = 0
- INTERNAL_ERROR = 1
- LSM_BUG = 2
+ LSM_LIB_BUG = 1
+ LSM_PLUGIN_BUG = 2
+ LSM_STORAGE_SDK_BUG = 3
JOB_STARTED = 7
INDEX_BOUNDS = 10
TIMEOUT = 11
Loading...