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 ¶meters,
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