mirror of
https://github.com/OpenNebula/one.git
synced 2025-04-02 10:50:07 +03:00
feature #201: Better error log for cluster allocate.
This commit is contained in:
parent
b6178c1cce
commit
db4f66742d
@ -15,6 +15,7 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
#include "ClusterPool.h"
|
||||
#include "NebulaLog.h"
|
||||
|
||||
const char * ClusterPool::table = "cluster_pool";
|
||||
|
||||
@ -31,10 +32,11 @@ const string ClusterPool::DEFAULT_CLUSTER_NAME = "default";
|
||||
|
||||
int ClusterPool::allocate(int * clid, string name, SqlDB *db)
|
||||
{
|
||||
int rc;
|
||||
|
||||
int rc;
|
||||
map<int, string>::iterator it;
|
||||
|
||||
ostringstream oss;
|
||||
|
||||
// Return error if name already exists
|
||||
for(it=cluster_names.begin();it!=cluster_names.end();it++)
|
||||
{
|
||||
@ -56,10 +58,20 @@ int ClusterPool::allocate(int * clid, string name, SqlDB *db)
|
||||
|
||||
return *clid;
|
||||
|
||||
// TODO: LOG ERRORS
|
||||
|
||||
error_existing_name:
|
||||
oss << "Could not allocate new cluster: Name \""
|
||||
<< name << "\" already exists.";
|
||||
|
||||
goto error_common;
|
||||
error_db:
|
||||
oss << "Could not allocate new cluster \"" << name
|
||||
<< "\": Database returned error code " << rc << ".";
|
||||
goto error_common;
|
||||
|
||||
error_common:
|
||||
NebulaLog::log("CLUSTER", Log::ERROR, oss);
|
||||
|
||||
*clid = -1;
|
||||
return *clid;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user