1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-22 17:57:46 +03:00

feature #192: Decouple Logger from Nebula class

This commit is contained in:
Ruben S. Montero 2010-04-21 00:40:16 +02:00
parent 84709c2cde
commit 21b729dbdd
50 changed files with 433 additions and 396 deletions

View File

@ -22,6 +22,10 @@
using namespace std;
/**
* The Logger class is an interface used by OpenNebula components to log
* messages
*/
class Log
{
public:
@ -29,39 +33,108 @@ public:
ERROR = 0,
WARNING = 1,
INFO = 2,
DEBUG = 3
DEBUG = 3,
DDEBUG = 4,
DDDEBUG = 5
};
typedef void (*LogFunction)(
const char *,
const MessageType,
const ostringstream&,
const char *,
const MessageType);
Log(const string& file_name,
const MessageType level = WARNING,
ios_base::openmode mode = ios_base::app);
static const char error_names[];
Log(const MessageType _level = WARNING):log_level(_level){};
virtual ~Log(){};
// -------------------------------------------------------------------------
// Logger interface
// -------------------------------------------------------------------------
virtual void log(
const char * module,
const MessageType type,
const char * message) = 0;
protected:
/**
* Minimum log level for the messages
*/
MessageType log_level;
};
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/**
* Log messages to a log file
*/
class FileLog : public Log
{
public:
FileLog(const string& file_name,
const MessageType level = WARNING,
ios_base::openmode mode = ios_base::app);
virtual ~FileLog();
virtual void log(
const char * module,
const MessageType type,
const char * message);
private:
char * log_file;
};
/**
* Log messages to a log file
*/
class FileLogTS : public FileLog
{
public:
FileLogTS(const string& file_name,
const MessageType level = WARNING,
ios_base::openmode mode = ios_base::app)
:FileLog(file_name,level,mode)
{
pthread_mutex_init(&log_mutex,0);
}
~FileLogTS()
{
pthread_mutex_destroy(&log_mutex);
}
~Log();
void log(
const char * module,
const MessageType type,
const ostringstream& message);
const char * message)
{
pthread_mutex_lock(&log_mutex);
FileLog::log(module,type,message);
pthread_mutex_unlock(&log_mutex);
}
private:
pthread_mutex_t log_mutex;
};
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/**
*
*/
class CerrLog : public Log
{
public:
CerrLog(const MessageType level = WARNING):Log(level){};
~CerrLog(){};
void log(
const char * module,
const MessageType type,
const char * message);
private:
static const char error_names[];
MessageType log_level;
char * log_file;
};
#endif /* _LOG_H_ */

View File

@ -26,7 +26,7 @@
#include <sys/types.h>
#include <unistd.h>
#include "Log.h"
#include "NebulaLog.h"
#include "SqlDB.h"
#include "ObjectSQL.h"
@ -47,8 +47,7 @@ public:
string server,
string user,
string password,
char * database,
Log::LogFunction _log = 0):log(_log)
char * database)
{
// Initialize the MySQL library
@ -111,7 +110,7 @@ public:
oss << "SQL command was: " << c_str;
oss << ", error " << err_num << " : " << err_msg;
log("ONE",Log::ERROR,oss,0,Log::ERROR);
NebulaLog::log("ONE",Log::ERROR,oss);
}
return -1;
@ -140,7 +139,7 @@ public:
oss << "SQL command was: " << c_str;
oss << ", error " << err_num << " : " << err_msg;
log("ONE",Log::ERROR,oss,0,Log::ERROR);
NebulaLog::log("ONE",Log::ERROR,oss);
}
return -1;
@ -204,11 +203,6 @@ private:
* The MySql connection handler
*/
MYSQL * db;
/**
* Log facility
*/
Log::LogFunction log;
};
#endif /*MYSQL_DB_H_*/

View File

@ -19,7 +19,6 @@
#include "SqlDB.h"
#include "Log.h"
#include "NebulaTemplate.h"
#include "VirtualMachinePool.h"
@ -46,36 +45,6 @@ public:
return nebulad;
};
// ---------------------------------------------------------------
// Logging
// ---------------------------------------------------------------
static void log(
const char * module,
const Log::MessageType type,
const ostringstream& message,
const char * filename = 0,
Log::MessageType clevel = Log::ERROR)
{
static Log nebula_log(filename,clevel,ios_base::trunc);
static pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_lock(&log_mutex);
nebula_log.log(module,type,message);
pthread_mutex_unlock(&log_mutex);
};
static void log(
const char * module,
const Log::MessageType type,
const char * message,
const char * filename = 0)
{
ostringstream os(message);
Nebula::log(module,type,os,filename);
};
// --------------------------------------------------------------
// Pool Accessors
// --------------------------------------------------------------

View File

@ -26,7 +26,8 @@
#include <sys/types.h>
#include <unistd.h>
#include "Log.h"
#include "NebulaLog.h"
#include "SqlDB.h"
#include "ObjectSQL.h"
@ -59,7 +60,7 @@ class SqliteDB : public SqlDB
{
public:
SqliteDB(string& db_name, Log::LogFunction _log = 0):log(_log)
SqliteDB(string& db_name)
{
int rc;
@ -96,10 +97,8 @@ public:
string str;
int counter = 0;
char * err_msg = 0;
char ** ptr = (log==0) ? 0 : &err_msg;
int (*callback)(void*,int,char**,char**);
void * arg;
@ -121,7 +120,7 @@ public:
{
counter++;
rc = sqlite3_exec(db, c_str, callback, arg, ptr);
rc = sqlite3_exec(db, c_str, callback, arg, &err_msg);
if (rc == SQLITE_BUSY || rc == SQLITE_IOERR_BLOCKED)
{
@ -141,16 +140,13 @@ public:
if (rc != SQLITE_OK)
{
if ((log != 0) && (err_msg != 0))
if (err_msg != 0)
{
ostringstream oss;
oss << "SQL command was: " << c_str << ", error: " << err_msg;
log("ONE",Log::ERROR,oss,0,Log::ERROR);
}
NebulaLog::log("ONE",Log::ERROR,oss);
if ( err_msg != 0)
{
sqlite3_free(err_msg);
}
@ -191,11 +187,6 @@ private:
*/
sqlite3 * db;
/**
* Log facility
*/
Log::LogFunction log;
/**
* Function to lock the DB
*/

View File

@ -94,7 +94,7 @@ public:
{
if (_log != 0)
{
_log->log(module,type,message);
_log->log(module,type,message.str().c_str());
}
};
@ -118,21 +118,21 @@ public:
*/
friend ostream& operator<<(ostream& os, const VirtualMachine& vm);
/**
* Function to print the VirtualMachine object into a string in
* plain text
* @param str the resulting string
* @return a reference to the generated string
*/
string& to_str(string& str) const;
/**
* Function to print the VirtualMachine object into a string in
* plain text
* @param str the resulting string
* @return a reference to the generated string
*/
string& to_str(string& str) const;
/**
* Function to print the VirtualMachine object into a string in
* XML format
* @param xml the resulting XML string
* @return a reference to the generated string
*/
string& to_xml(string& xml) const;
/**
* Function to print the VirtualMachine object into a string in
* XML format
* @param xml the resulting XML string
* @return a reference to the generated string
*/
string& to_xml(string& xml) const;
// ------------------------------------------------------------------------
// Dynamic Info
@ -846,7 +846,7 @@ private:
* or, in case that OpenNebula is installed in root
* /var/log/one/$VM_ID.log
*/
Log * _log;
FileLog * _log;
// *************************************************************************
// DataBase implementation (Private)

View File

@ -1,7 +1,8 @@
#!/usr/bin/env ruby
# -------------------------------------------------------------------------- #
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
# Copyright 2002-2009, Distributed Systems Architecture Group, Universidad #
# Complutense de Madrid (dsa-research.org) #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
@ -18,8 +19,7 @@
require 'pp'
require 'digest/md5'
require 'ftools'
require 'fileutils'
###########################################
# Code to test compilation/linkning flags #
@ -207,7 +207,7 @@ def gen_test_file(kind)
#fname="xmlrpc_test.cc"
full_path=dir+"/"+fname
File.makedirs(dir)
FileUtils::mkdir_p(dir)
f=open(full_path, "w")
f.write(TestCode[kind])
f.close

View File

@ -15,7 +15,8 @@
/* -------------------------------------------------------------------------- */
#include "DispatchManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -27,15 +28,15 @@ extern "C" void * dm_action_loop(void *arg)
{
return 0;
}
dm = static_cast<DispatchManager *>(arg);
Nebula::log("DiM",Log::INFO,"Dispatch Manager started.");
NebulaLog::log("DiM",Log::INFO,"Dispatch Manager started.");
dm->am.loop(0,0);
Nebula::log("DiM",Log::INFO,"Dispatch Manager stopped.");
NebulaLog::log("DiM",Log::INFO,"Dispatch Manager stopped.");
return 0;
}
@ -49,7 +50,7 @@ int DispatchManager::start()
pthread_attr_init (&pattr);
pthread_attr_setdetachstate (&pattr, PTHREAD_CREATE_JOINABLE);
Nebula::log("DiM",Log::INFO,"Starting Dispatch Manager...");
NebulaLog::log("DiM",Log::INFO,"Starting Dispatch Manager...");
rc = pthread_create(&dm_thread,&pattr,dm_action_loop,(void *) this);
@ -83,14 +84,14 @@ void DispatchManager::trigger(Actions action, int _vid)
case FAILED:
aname = "FAILED";
break;
case FINALIZE:
aname = ACTION_FINALIZE;
break;
default:
delete vid;
return;
return;
}
am.trigger(aname,vid);
@ -103,7 +104,7 @@ void DispatchManager::do_action(const string &action, void * arg)
{
int vid;
ostringstream oss;
if (arg == 0)
{
return;
@ -112,7 +113,7 @@ void DispatchManager::do_action(const string &action, void * arg)
vid = *(static_cast<int *>(arg));
delete static_cast<int *>(arg);
if (action == "SUSPEND_SUCCESS")
{
suspend_success_action(vid);
@ -128,16 +129,16 @@ void DispatchManager::do_action(const string &action, void * arg)
else if (action == "FAILED")
{
failed_action(vid);
}
}
else if (action == ACTION_FINALIZE)
{
Nebula::log("DiM",Log::INFO,"Stopping Dispatch Manager...");
NebulaLog::log("DiM",Log::INFO,"Stopping Dispatch Manager...");
}
else
{
ostringstream oss;
oss << "Unknown action name: " << action;
Nebula::log("DiM", Log::ERROR, oss);
NebulaLog::log("DiM", Log::ERROR, oss);
}
}

View File

@ -15,8 +15,9 @@
/* -------------------------------------------------------------------------- */
#include "DispatchManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
#include "Nebula.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -25,7 +26,7 @@ int DispatchManager::allocate (
const string& stemplate,
int * oid)
{
Nebula::log("DiM",Log::DEBUG,"Allocating a new VM");
NebulaLog::log("DiM",Log::DEBUG,"Allocating a new VM");
return vmpool->allocate(uid,stemplate,oid);
};
@ -47,7 +48,7 @@ int DispatchManager::deploy (
vid = vm->get_oid();
oss << "Deploying VM " << vid;
Nebula::log("DiM",Log::DEBUG,oss);
NebulaLog::log("DiM",Log::DEBUG,oss);
if ( vm->get_state() == VirtualMachine::PENDING )
{
@ -75,7 +76,7 @@ error:
oss.str("");
oss << "Could not deploy VM " << vid << ", wrong state.";
Nebula::log("DiM",Log::ERROR,oss);
NebulaLog::log("DiM",Log::ERROR,oss);
vm->unlock();
return -1;
@ -98,7 +99,7 @@ int DispatchManager::migrate(
vid = vm->get_oid();
oss << "Migrating VM " << vid;
Nebula::log("DiM",Log::DEBUG,oss);
NebulaLog::log("DiM",Log::DEBUG,oss);
if (vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() == VirtualMachine::RUNNING )
@ -120,7 +121,7 @@ int DispatchManager::migrate(
error:
oss.str("");
oss << "Could not migrate VM " << vid << ", wrong state.";
Nebula::log("DiM",Log::ERROR,oss);
NebulaLog::log("DiM",Log::ERROR,oss);
vm->unlock();
return -1;
@ -143,7 +144,7 @@ int DispatchManager::live_migrate(
vid = vm->get_oid();
oss << "Live-migrating VM " << vid;
Nebula::log("DiM",Log::DEBUG,oss);
NebulaLog::log("DiM",Log::DEBUG,oss);
if (vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() == VirtualMachine::RUNNING )
@ -165,7 +166,7 @@ int DispatchManager::live_migrate(
error:
oss.str("");
oss << "Could not live-migrate VM " << vid << ", wrong state.";
Nebula::log("DiM",Log::ERROR,oss);
NebulaLog::log("DiM",Log::ERROR,oss);
vm->unlock();
return -1;
@ -188,7 +189,7 @@ int DispatchManager::shutdown (
}
oss << "Shutting down VM " << vid;
Nebula::log("DiM",Log::DEBUG,oss);
NebulaLog::log("DiM",Log::DEBUG,oss);
if (vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() == VirtualMachine::RUNNING )
@ -211,7 +212,7 @@ error:
oss.str("");
oss << "Could not shutdown VM " << vid << ", wrong state.";
Nebula::log("DiM",Log::ERROR,oss);
NebulaLog::log("DiM",Log::ERROR,oss);
vm->unlock();
return -2;
@ -234,7 +235,7 @@ int DispatchManager::hold(
}
oss << "Holding VM " << vid;
Nebula::log("DiM",Log::DEBUG,oss);
NebulaLog::log("DiM",Log::DEBUG,oss);
if (vm->get_state() == VirtualMachine::PENDING)
{
@ -257,7 +258,7 @@ error:
oss.str("");
oss << "Could not hold VM " << vid << ", wrong state.";
Nebula::log("DiM",Log::ERROR,oss);
NebulaLog::log("DiM",Log::ERROR,oss);
vm->unlock();
return -2;
@ -280,7 +281,7 @@ int DispatchManager::release(
}
oss << "Releasing VM " << vid;
Nebula::log("DiM",Log::DEBUG,oss);
NebulaLog::log("DiM",Log::DEBUG,oss);
if (vm->get_state() == VirtualMachine::HOLD)
{
@ -302,7 +303,7 @@ int DispatchManager::release(
error:
oss.str("");
oss << "Could not release VM " << vid << ", wrong state.";
Nebula::log("DiM",Log::ERROR,oss);
NebulaLog::log("DiM",Log::ERROR,oss);
vm->unlock();
return -2;
@ -325,7 +326,7 @@ int DispatchManager::stop(
}
oss << "Stopping VM " << vid;
Nebula::log("DiM",Log::DEBUG,oss);
NebulaLog::log("DiM",Log::DEBUG,oss);
if (vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() == VirtualMachine::RUNNING )
@ -347,7 +348,7 @@ int DispatchManager::stop(
error:
oss.str("");
oss << "Could not stop VM " << vid << ", wrong state.";
Nebula::log("DiM",Log::ERROR,oss);
NebulaLog::log("DiM",Log::ERROR,oss);
vm->unlock();
return -2;
@ -370,7 +371,7 @@ int DispatchManager::cancel(
}
oss << "Cancelling VM " << vid;
Nebula::log("DiM",Log::DEBUG,oss);
NebulaLog::log("DiM",Log::DEBUG,oss);
if (vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() == VirtualMachine::RUNNING )
@ -392,7 +393,7 @@ int DispatchManager::cancel(
error:
oss.str("");
oss << "Could not cancel VM " << vid << ", wrong state.";
Nebula::log("DiM",Log::ERROR,oss);
NebulaLog::log("DiM",Log::ERROR,oss);
vm->unlock();
return -2;
@ -415,7 +416,7 @@ int DispatchManager::suspend(
}
oss << "Suspending VM " << vid;
Nebula::log("DiM",Log::DEBUG,oss);
NebulaLog::log("DiM",Log::DEBUG,oss);
if (vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() == VirtualMachine::RUNNING )
@ -437,7 +438,7 @@ int DispatchManager::suspend(
error:
oss.str("");
oss << "Could not suspend VM " << vid << ", wrong state.";
Nebula::log("DiM",Log::ERROR,oss);
NebulaLog::log("DiM",Log::ERROR,oss);
vm->unlock();
return -2;
@ -460,7 +461,7 @@ int DispatchManager::resume(
}
oss << "Resuming VM " << vid;
Nebula::log("DiM",Log::DEBUG,oss);
NebulaLog::log("DiM",Log::DEBUG,oss);
if (vm->get_state() == VirtualMachine::STOPPED )
{
@ -495,7 +496,7 @@ int DispatchManager::resume(
error:
oss.str("");
oss << "Could not resume VM " << vid << ", wrong state.";
Nebula::log("DiM",Log::ERROR,oss);
NebulaLog::log("DiM",Log::ERROR,oss);
vm->unlock();
return -2;
@ -517,9 +518,9 @@ int DispatchManager::restart(int vid)
}
oss << "Restarting VM " << vid;
Nebula::log("DiM",Log::DEBUG,oss);
NebulaLog::log("DiM",Log::DEBUG,oss);
if (vm->get_state() == VirtualMachine::ACTIVE &&
if (vm->get_state() == VirtualMachine::ACTIVE &&
(vm->get_lcm_state() == VirtualMachine::UNKNOWN ||
vm->get_lcm_state() == VirtualMachine::BOOT))
{
@ -540,7 +541,7 @@ int DispatchManager::restart(int vid)
error:
oss.str("");
oss << "Could not restart VM " << vid << ", wrong state.";
Nebula::log("DiM",Log::ERROR,oss);
NebulaLog::log("DiM",Log::ERROR,oss);
vm->unlock();
@ -567,7 +568,7 @@ int DispatchManager::finalize(
state = vm->get_state();
oss << "Finalizing VM " << vid;
Nebula::log("DiM",Log::DEBUG,oss);
NebulaLog::log("DiM",Log::DEBUG,oss);
Nebula& nd = Nebula::instance();
TransferManager * tm = nd.get_tm();

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "DispatchManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
void DispatchManager::suspend_success_action(int vid)
{
@ -44,7 +44,7 @@ void DispatchManager::suspend_success_action(int vid)
oss << "suspend_success action received but VM " << vid
<< " not in ACTIVE state";
Nebula::log("DiM",Log::ERROR,oss);
NebulaLog::log("DiM",Log::ERROR,oss);
}
vm->unlock();
@ -82,7 +82,7 @@ void DispatchManager::stop_success_action(int vid)
oss << "stop_success action received but VM " << vid
<< " not in ACTIVE state";
Nebula::log("DiM",Log::ERROR,oss);
NebulaLog::log("DiM",Log::ERROR,oss);
}
vm->unlock();
@ -123,7 +123,7 @@ void DispatchManager::done_action(int vid)
ostringstream oss;
oss << "done action received but VM " << vid << " not in ACTIVE state";
Nebula::log("DiM",Log::ERROR,oss);
NebulaLog::log("DiM",Log::ERROR,oss);
}
vm->unlock();

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "HookManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
const char * HookManager::hook_driver_name = "hook_exe";
@ -31,13 +31,13 @@ extern "C" void * hm_action_loop(void *arg)
return 0;
}
Nebula::log("HKM",Log::INFO,"Hook Manager started.");
NebulaLog::log("HKM",Log::INFO,"Hook Manager started.");
hm = static_cast<HookManager *>(arg);
hm->am.loop(0,0);
Nebula::log("HKM",Log::INFO,"Hook Manager stopped.");
NebulaLog::log("HKM",Log::INFO,"Hook Manager stopped.");
return 0;
}
@ -52,13 +52,13 @@ void HookManager::load_mads(int uid)
const VectorAttribute * vattr;
int rc;
Nebula::log("HKM",Log::INFO,"Loading Hook Manager driver.");
NebulaLog::log("HKM",Log::INFO,"Loading Hook Manager driver.");
vattr = static_cast<const VectorAttribute *>(mad_conf[0]);
if ( vattr == 0 )
{
Nebula::log("HKM",Log::INFO,"Failed to load Hook Manager driver.");
NebulaLog::log("HKM",Log::INFO,"Failed to load Hook Manager driver.");
return;
}
@ -75,7 +75,7 @@ void HookManager::load_mads(int uid)
oss.str("");
oss << "\tHook Manager loaded";
Nebula::log("HKM",Log::INFO,oss);
NebulaLog::log("HKM",Log::INFO,oss);
}
}
@ -94,7 +94,7 @@ int HookManager::start()
return -1;
}
Nebula::log("HKM",Log::INFO,"Starting Hook Manager...");
NebulaLog::log("HKM",Log::INFO,"Starting Hook Manager...");
pthread_attr_init (&pattr);
pthread_attr_setdetachstate (&pattr, PTHREAD_CREATE_JOINABLE);
@ -111,7 +111,7 @@ void HookManager::do_action(const string &action, void * arg)
{
if (action == ACTION_FINALIZE)
{
Nebula::log("HKM",Log::INFO,"Stopping Hook Manager...");
NebulaLog::log("HKM",Log::INFO,"Stopping Hook Manager...");
MadManager::stop();
}
@ -120,7 +120,7 @@ void HookManager::do_action(const string &action, void * arg)
ostringstream oss;
oss << "Unknown action name: " << action;
Nebula::log("HKM", Log::ERROR, oss);
NebulaLog::log("HKM", Log::ERROR, oss);
}
}

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "HookManagerDriver.h"
#include "Nebula.h"
#include "NebulaLog.h"
#include <sstream>
/* ************************************************************************** */
@ -92,7 +92,7 @@ void HookManagerDriver::protocol(
// Parse the driver message
os << "Message received: " << message;
Nebula::log("HKM", Log::DEBUG, os);
NebulaLog::log("HKM", Log::DEBUG, os);
// Parse the driver message
if ( is.good() )
@ -125,7 +125,7 @@ void HookManagerDriver::protocol(
is.clear();
getline(is,info);
Nebula::log("HKM",Log::INFO, info.c_str());
NebulaLog::log("HKM",Log::INFO, info.c_str());
}
return;
@ -190,6 +190,6 @@ void HookManagerDriver::protocol(
void HookManagerDriver::recover()
{
Nebula::log("HKM", Log::ERROR, "Hook driver crashed, recovering...");
NebulaLog::log("HKM", Log::ERROR, "Hook driver crashed, recovering...");
}

View File

@ -21,7 +21,7 @@
#include <sstream>
#include "Host.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* ************************************************************************** */
/* Host :: Constructor/Destructor */
@ -330,7 +330,7 @@ int Host::update_info(string &parse_str)
if ( rc != 0 )
{
Nebula::log("ONE", Log::ERROR, error_msg);
NebulaLog::log("ONE", Log::ERROR, error_msg);
free(error_msg);
return -1;

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "InformationManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -29,13 +29,13 @@ extern "C" void * im_action_loop(void *arg)
return 0;
}
Nebula::log("InM",Log::INFO,"Information Manager started.");
NebulaLog::log("InM",Log::INFO,"Information Manager started.");
im = static_cast<InformationManager *>(arg);
im->am.loop(im->timer_period,0);
Nebula::log("InM",Log::INFO,"Information Manager stopped.");
NebulaLog::log("InM",Log::INFO,"Information Manager stopped.");
return 0;
}
@ -51,7 +51,7 @@ void InformationManager::load_mads(int uid)
const VectorAttribute * vattr;
int rc;
Nebula::log("InM",Log::INFO,"Loading Information Manager drivers.");
NebulaLog::log("InM",Log::INFO,"Loading Information Manager drivers.");
for(i=0;i<mad_conf.size();i++)
{
@ -60,7 +60,7 @@ void InformationManager::load_mads(int uid)
oss.str("");
oss << "\tLoading driver: " << vattr->vector_value("NAME");
Nebula::log("InM",Log::INFO,oss);
NebulaLog::log("InM",Log::INFO,oss);
im_mad = new InformationManagerDriver(0,vattr->value(),false,hpool);
@ -71,7 +71,7 @@ void InformationManager::load_mads(int uid)
oss.str("");
oss << "\tDriver " << vattr->vector_value("NAME") << " loaded";
Nebula::log("InM",Log::INFO,oss);
NebulaLog::log("InM",Log::INFO,oss);
}
}
}
@ -91,7 +91,7 @@ int InformationManager::start()
return -1;
}
Nebula::log("InM",Log::INFO,"Starting Information Manager...");
NebulaLog::log("InM",Log::INFO,"Starting Information Manager...");
pthread_attr_init (&pattr);
pthread_attr_setdetachstate (&pattr, PTHREAD_CREATE_JOINABLE);
@ -112,7 +112,7 @@ void InformationManager::do_action(const string &action, void * arg)
}
else if (action == ACTION_FINALIZE)
{
Nebula::log("InM",Log::INFO,"Stopping Information Manager...");
NebulaLog::log("InM",Log::INFO,"Stopping Information Manager...");
MadManager::stop();
}
@ -121,7 +121,7 @@ void InformationManager::do_action(const string &action, void * arg)
ostringstream oss;
oss << "Unknown action name: " << action;
Nebula::log("InM", Log::ERROR, oss);
NebulaLog::log("InM", Log::ERROR, oss);
}
}
@ -148,7 +148,7 @@ void InformationManager::timer_action()
if ( mark >= 600 )
{
Nebula::log("InM",Log::INFO,"--Mark--");
NebulaLog::log("InM",Log::INFO,"--Mark--");
mark = 0;
}
@ -187,7 +187,7 @@ void InformationManager::timer_action()
oss.str("");
oss << "Monitoring host " << host->get_hostname()
<< " (" << it->first << ")";
Nebula::log("InM",Log::INFO,oss);
NebulaLog::log("InM",Log::INFO,oss);
imd = get(it->second);
@ -195,7 +195,7 @@ void InformationManager::timer_action()
{
oss.str("");
oss << "Could not find information driver " << it->second;
Nebula::log("InM",Log::ERROR,oss);
NebulaLog::log("InM",Log::ERROR,oss);
host->set_state(Host::ERROR);
}

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "InformationManagerDriver.h"
#include "Nebula.h"
#include "NebulaLog.h"
#include <sstream>
@ -111,7 +111,7 @@ void InformationManagerDriver::protocol(
hinfo += "\n";
oss << "Host " << id << " successfully monitored."; //, info: "<< hinfo;
Nebula::log("InM",Log::DEBUG,oss);
NebulaLog::log("InM",Log::DEBUG,oss);
rc = host->update_info(hinfo);
@ -136,20 +136,20 @@ void InformationManagerDriver::protocol(
string info;
getline(is,info);
Nebula::log("InM",Log::INFO,info.c_str());
NebulaLog::log("InM",Log::INFO,info.c_str());
}
return;
error_driver_info:
ess << "Error monitoring host " << id << " : " << is.str();
Nebula::log("InM", Log::ERROR, ess);
NebulaLog::log("InM", Log::ERROR, ess);
goto error_common_info;
error_parse_info:
ess << "Error parsing host information: " << hinfo;
Nebula::log("InM",Log::ERROR,ess);
NebulaLog::log("InM",Log::ERROR,ess);
error_common_info:
@ -163,14 +163,14 @@ error_common_info:
error_host:
ess << "Could not get host " << id;
Nebula::log("InM",Log::ERROR,ess);
NebulaLog::log("InM",Log::ERROR,ess);
return;
error_parse:
ess << "Error while parsing driver message: " << message;
Nebula::log("InM",Log::ERROR,ess);
NebulaLog::log("InM",Log::ERROR,ess);
return;
}
@ -180,6 +180,6 @@ error_parse:
void InformationManagerDriver::recover()
{
Nebula::log("InM", Log::ERROR, "Information driver crashed, recovering...");
NebulaLog::log("InM", Log::ERROR,
"Information driver crashed, recovering...");
}

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "LifeCycleManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -31,11 +31,11 @@ extern "C" void * lcm_action_loop(void *arg)
lcm = static_cast<LifeCycleManager *>(arg);
Nebula::log("LCM",Log::INFO,"Life-cycle Manager started.");
NebulaLog::log("LCM",Log::INFO,"Life-cycle Manager started.");
lcm->am.loop(0,0);
Nebula::log("LCM",Log::INFO,"Life-cycle Manager stopped.");
NebulaLog::log("LCM",Log::INFO,"Life-cycle Manager stopped.");
return 0;
}
@ -50,7 +50,7 @@ int LifeCycleManager::start()
pthread_attr_init (&pattr);
pthread_attr_setdetachstate (&pattr, PTHREAD_CREATE_JOINABLE);
Nebula::log("LCM",Log::INFO,"Starting Life-cycle Manager...");
NebulaLog::log("LCM",Log::INFO,"Starting Life-cycle Manager...");
rc = pthread_create(&lcm_thread,&pattr,lcm_action_loop,(void *) this);
@ -300,14 +300,14 @@ void LifeCycleManager::do_action(const string &action, void * arg)
}
else if (action == ACTION_FINALIZE)
{
Nebula::log("LCM",Log::INFO,"Stopping Life-cycle Manager...");
NebulaLog::log("LCM",Log::INFO,"Stopping Life-cycle Manager...");
}
else
{
ostringstream oss;
oss << "Unknown action name: " << action;
Nebula::log("LCM", Log::ERROR, oss);
NebulaLog::log("LCM", Log::ERROR, oss);
}
}

View File

@ -24,6 +24,8 @@
#include <string.h>
#include "Mad.h"
#include "NebulaLog.h"
#include "Nebula.h"
#include <cerrno>
@ -237,43 +239,43 @@ int Mad::start()
error_exec:
oss.str("");
oss << "Can not load driver " << executable << ", " << strerror(errno);
Nebula::log("MAD", Log::ERROR, oss);
NebulaLog::log("MAD", Log::ERROR, oss);
exit(-1);
error_dup2:
oss.str("");
oss << "Can not duplicate descriptors, " << strerror(errno);
Nebula::log("MAD", Log::ERROR, oss);
NebulaLog::log("MAD", Log::ERROR, oss);
exit(-1);
error_mad_result:
oss.str("");
oss << "MAD initialization failed, " << info;
Nebula::log("MAD", Log::ERROR, oss);
NebulaLog::log("MAD", Log::ERROR, oss);
return -1;
error_mad_action:
Nebula::log("MAD", Log::ERROR,"Wrong action in MAD response");
NebulaLog::log("MAD", Log::ERROR,"Wrong action in MAD response");
return -1;
error_mad_init:
Nebula::log("MAD", Log::ERROR, "MAD did not answer INIT command");
NebulaLog::log("MAD", Log::ERROR, "MAD did not answer INIT command");
return -1;
error_fork:
oss.str("");
oss << "Error forking to start MAD, " << strerror(errno);
Nebula::log("MAD", Log::ERROR, oss);
NebulaLog::log("MAD", Log::ERROR, oss);
return -1;
error_attributes:
Nebula::log("MAD", Log::ERROR, "Wrong attributes for the driver");
NebulaLog::log("MAD", Log::ERROR, "Wrong attributes for the driver");
return -1;
error_pipes:
oss.str("");
oss << "Can not create driver pipes, " << strerror(errno);
Nebula::log("MAD", Log::ERROR, oss);
NebulaLog::log("MAD", Log::ERROR, oss);
return -1;
}

View File

@ -15,10 +15,12 @@
/* -------------------------------------------------------------------------- */
#include "Log.h"
#include <string.h>
#include <stdlib.h>
#include <stdlib.h>
#include <stdexcept>
#include <sstream>
#include <iostream>
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -28,14 +30,13 @@ const char Log::error_names[] ={ 'E', 'W', 'I', 'D' };
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
Log::Log(const string& file_name,
const MessageType level,
ios_base::openmode mode):
log_level(level),
log_file(0)
FileLog::FileLog(const string& file_name,
const MessageType level,
ios_base::openmode mode)
:Log(level), log_file(0)
{
ofstream file;
log_file = strdup(file_name.c_str());
file.open(log_file, mode);
@ -44,7 +45,7 @@ Log::Log(const string& file_name,
{
throw runtime_error("Could not open log file");
}
if ( file.is_open() == true )
{
file.close();
@ -54,62 +55,18 @@ Log::Log(const string& file_name,
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
Log::~Log()
FileLog::~FileLog()
{
if ( log_file != 0 )
{
free(log_file);
}
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void Log::log(
const char * module,
const MessageType type,
const ostringstream& message)
{
char str[26];
time_t the_time;
ofstream file;
if( type <= log_level)
if ( log_file != 0 )
{
file.open(log_file, ios_base::app);
if (file.fail() == true)
{
return;
}
the_time = time(NULL);
#ifdef SOLARIS
ctime_r(&(the_time),str,sizeof(char)*26);
#else
ctime_r(&(the_time),str);
#endif
// Get rid of final enter character
str[24] = '\0';
file << str << " ";
file << "[" << module << "]";
file << "[" << error_names[type] << "]: ";
file << message.str();
file << endl;
file.flush();
file.close();
free(log_file);
}
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void Log::log(
void FileLog::log(
const char * module,
const MessageType type,
const char * message)
@ -126,9 +83,9 @@ void Log::log(
{
return;
}
the_time = time(NULL);
#ifdef SOLARIS
ctime_r(&(the_time),str,sizeof(char)*26);
#else
@ -142,9 +99,9 @@ void Log::log(
file << "[" << error_names[type] << "]: ";
file << message;
file << endl;
file.flush();
file.close();
}
}
@ -152,3 +109,33 @@ void Log::log(
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void CerrLog::log(
const char * module,
const MessageType type,
const char * message)
{
char str[26];
time_t the_time;
ofstream file;
if( type <= log_level)
{
the_time = time(NULL);
#ifdef SOLARIS
ctime_r(&(the_time),str,sizeof(char)*26);
#else
ctime_r(&(the_time),str);
#endif
// Get rid of final enter character
str[24] = '\0';
cerr << str << " ";
cerr << "[" << module << "]";
cerr << "[" << error_names[type] << "]: ";
cerr << message;
cerr << endl;
cerr.flush();
}
}

View File

@ -15,6 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "Nebula.h"
#include "NebulaLog.h"
#include "VirtualMachine.h"
#include "SqliteDB.h"
@ -82,35 +83,28 @@ void Nebula::start()
clevel = static_cast<Log::MessageType>(log_level_int);
}
os << "Init OpenNebula Log system";
// Initializing ONE Daemon log system
Nebula::log("ONE",
Log::INFO,
os,
log_fname.c_str(),
clevel);
NebulaLog::init_log_system(NebulaLog::FILE_TS,
clevel,
log_fname.c_str(),
ios_base::trunc);
NebulaLog::log("ONE",Log::INFO,"Init OpenNebula Log system");
os.str("");
os << "Log Level: " << clevel << " [0=ERROR,1=WARNING,2=INFO,3=DEBUG]";
// Initializing ONE Daemon log system
Nebula::log("ONE",
Log::INFO,
os,
log_fname.c_str(),
clevel);
NebulaLog::log("ONE",Log::INFO,os);
}
catch(runtime_error&)
{
throw;
}
Nebula::log("ONE",Log::INFO,"----------------------------------------------");
Nebula::log("ONE",Log::INFO," OpenNebula Configuration File ");
Nebula::log("ONE",Log::INFO,"----------------------------------------------");
NebulaLog::log("ONE",Log::INFO,"----------------------------------------");
NebulaLog::log("ONE",Log::INFO," OpenNebula Configuration File ");
NebulaLog::log("ONE",Log::INFO,"----------------------------------------");
os.str("");
@ -118,7 +112,7 @@ void Nebula::start()
os << *nebula_configuration;
os << "\n--------------------------------------------";
Nebula::log("ONE",Log::INFO,os);
NebulaLog::log("ONE",Log::INFO,os);
// -----------------------------------------------------------
// Pools
@ -130,11 +124,11 @@ void Nebula::start()
struct stat db_stat;
bool db_bootstrap = stat(db_name.c_str(), &db_stat) != 0;
db = new SqliteDB(db_name,Nebula::log);
db = new SqliteDB(db_name);
if (db_bootstrap)
{
Nebula::log("ONE",Log::INFO,"Bootstraping OpenNebula database.");
NebulaLog::log("ONE",Log::INFO,"Bootstraping OpenNebula database.");
VirtualMachinePool::bootstrap(db);
HostPool::bootstrap(db);
@ -330,7 +324,7 @@ void Nebula::start()
}
catch (bad_alloc&)
{
Nebula::log("ONE", Log::ERROR, "Error starting RM");
NebulaLog::log("ONE", Log::ERROR, "Error starting RM");
throw;
}
@ -410,6 +404,6 @@ void Nebula::start()
pthread_join(rm->get_thread_id(),0);
pthread_join(hm->get_thread_id(),0);
Nebula::log("ONE", Log::INFO, "All modules finalized, exiting.\n");
NebulaLog::log("ONE", Log::INFO, "All modules finalized, exiting.\n");
}

View File

@ -24,6 +24,7 @@ lib_name='nebula_core'
source_files=[
'Nebula.cc',
'NebulaTemplate.cc',
'NebulaLog.cc',
'Log.cc'
]

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
#include <cerrno>
#include <sys/signal.h>
@ -39,13 +39,13 @@ extern "C" void * rm_action_loop(void *arg)
return 0;
}
Nebula::log("ReM",Log::INFO,"Request Manager started.");
NebulaLog::log("ReM",Log::INFO,"Request Manager started.");
rm = static_cast<RequestManager *>(arg);
rm->am.loop(0,0);
Nebula::log("ReM",Log::INFO,"Request Manager stopped.");
NebulaLog::log("ReM",Log::INFO,"Request Manager stopped.");
return 0;
}
@ -98,7 +98,7 @@ int RequestManager::setup_socket()
ostringstream oss;
oss << "Can not open server socket: " << strerror(errno);
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
return -1;
}
@ -110,7 +110,7 @@ int RequestManager::setup_socket()
ostringstream oss;
oss << "Can not set socket options: " << strerror(errno);
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
close(socket_fd);
@ -130,7 +130,7 @@ int RequestManager::setup_socket()
ostringstream oss;
oss << "Can not bind to port " << port << " : " << strerror(errno);
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
close(socket_fd);
@ -148,7 +148,7 @@ int RequestManager::start()
pthread_attr_t pattr;
ostringstream oss;
Nebula::log("ReM",Log::INFO,"Starting Request Manager...");
NebulaLog::log("ReM",Log::INFO,"Starting Request Manager...");
int rc = setup_socket();
@ -168,7 +168,7 @@ int RequestManager::start()
pthread_attr_setdetachstate (&pattr, PTHREAD_CREATE_JOINABLE);
oss << "Starting XML-RPC server, port " << port << " ...";
Nebula::log("ReM",Log::INFO,oss);
NebulaLog::log("ReM",Log::INFO,oss);
pthread_create(&rm_xml_server_thread,&pattr,rm_xml_server_loop,(void *)this);
@ -184,13 +184,13 @@ void RequestManager::do_action(
{
if (action == ACTION_FINALIZE)
{
Nebula::log("ReM",Log::INFO,"Stopping Request Manager...");
NebulaLog::log("ReM",Log::INFO,"Stopping Request Manager...");
pthread_cancel(rm_xml_server_thread);
pthread_join(rm_xml_server_thread,0);
Nebula::log("ReM",Log::INFO,"XML-RPC server stopped.");
NebulaLog::log("ReM",Log::INFO,"XML-RPC server stopped.");
delete AbyssServer;
@ -204,7 +204,7 @@ void RequestManager::do_action(
ostringstream oss;
oss << "Unknown action name: " << action;
Nebula::log("ReM", Log::ERROR, oss);
NebulaLog::log("ReM", Log::ERROR, oss);
}
};

View File

@ -15,6 +15,8 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "NebulaLog.h"
#include "Nebula.h"
/* -------------------------------------------------------------------------- */
@ -41,7 +43,7 @@ void RequestManager::VirtualMachineAction::execute(
ostringstream oss;
Nebula::log("ReM",Log::DEBUG,"VirtualMachineAction invoked");
NebulaLog::log("ReM",Log::DEBUG,"VirtualMachineAction invoked");
session = xmlrpc_c::value_string(paramList.getString(0));
action = xmlrpc_c::value_string(paramList.getString(1));

View File

@ -15,6 +15,8 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "NebulaLog.h"
#include "Nebula.h"
/* -------------------------------------------------------------------------- */
@ -44,7 +46,7 @@ void RequestManager::VirtualMachineAllocate::execute(
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"VirtualMachineAllocate invoked");
NebulaLog::log("ReM",Log::DEBUG,"VirtualMachineAllocate invoked");
session = xmlrpc_c::value_string(paramList.getString(0));
vm_template = xmlrpc_c::value_string(paramList.getString(1));
@ -116,7 +118,7 @@ error_common:
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
arrayData.push_back(xmlrpc_c::value_string(oss.str()));
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
xmlrpc_c::value_array arrayresult_error(arrayData);

View File

@ -15,6 +15,8 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "NebulaLog.h"
#include "Nebula.h"
/* -------------------------------------------------------------------------- */
@ -46,7 +48,7 @@ void RequestManager::VirtualMachineDeploy::execute(
ostringstream oss;
Nebula::log("ReM",Log::DEBUG,"VirtualMachineDeploy invoked");
NebulaLog::log("ReM",Log::DEBUG,"VirtualMachineDeploy invoked");
//Parse Arguments

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -40,7 +40,7 @@ void RequestManager::HostAllocate::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"HostAllocate method invoked");
NebulaLog::log("ReM",Log::DEBUG,"HostAllocate method invoked");
// Get the parameters
session = xmlrpc_c::value_string(paramList.getString(0));
@ -92,7 +92,7 @@ error_common:
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
arrayData.push_back(xmlrpc_c::value_string(oss.str()));
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
xmlrpc_c::value_array arrayresult_error(arrayData);

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -36,7 +36,7 @@ void RequestManager::HostDelete::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"HostDelete method invoked");
NebulaLog::log("ReM",Log::DEBUG,"HostDelete method invoked");
// Get the parameters
session = xmlrpc_c::value_string(paramList.getString(0));
@ -82,7 +82,7 @@ error_host_get:
goto error_common;
error_common:
Nebula::log ("Rem",Log::ERROR,oss);
NebulaLog::log ("Rem",Log::ERROR,oss);
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
arrayData.push_back(xmlrpc_c::value_string(oss.str()));

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -36,7 +36,7 @@ void RequestManager::HostEnable::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"HostEnable method invoked");
NebulaLog::log("ReM",Log::DEBUG,"HostEnable method invoked");
// Get the parameters & host
session = xmlrpc_c::value_string(paramList.getString(0));
@ -91,7 +91,7 @@ error_host_get:
goto error_common;
error_common:
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
arrayData.push_back(xmlrpc_c::value_boolean(false));
arrayData.push_back(xmlrpc_c::value_string(oss.str()));

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -36,7 +36,7 @@ void RequestManager::HostInfo::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"HostInfo method invoked");
NebulaLog::log("ReM",Log::DEBUG,"HostInfo method invoked");
// Get the parameters
session = xmlrpc_c::value_string(paramList.getString(0));
@ -87,7 +87,7 @@ error_common:
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
arrayData.push_back(xmlrpc_c::value_string(oss.str()));
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
xmlrpc_c::value_array arrayresult_error(arrayData);

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -32,7 +32,7 @@ void RequestManager::HostPoolInfo::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"HostPoolInfo method invoked");
NebulaLog::log("ReM",Log::DEBUG,"HostPoolInfo method invoked");
// Get the parameters
session = xmlrpc_c::value_string(paramList.getString(0));
@ -81,7 +81,7 @@ error_common:
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
arrayData.push_back(xmlrpc_c::value_string(oss.str()));
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
xmlrpc_c::value_array arrayresult_error(arrayData);

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -35,7 +35,7 @@ void RequestManager::VirtualMachineInfo::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"VirtualMachineInfo method invoked");
NebulaLog::log("ReM",Log::DEBUG,"VirtualMachineInfo method invoked");
// Get the parameters
session = xmlrpc_c::value_string(paramList.getString(0));
@ -74,7 +74,7 @@ error_common:
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
arrayData.push_back(xmlrpc_c::value_string(oss.str()));
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
xmlrpc_c::value_array arrayresult_error(arrayData);

View File

@ -15,6 +15,8 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "NebulaLog.h"
#include "Nebula.h"
/* -------------------------------------------------------------------------- */
@ -48,7 +50,7 @@ void RequestManager::VirtualMachineMigrate::execute(
ostringstream oss;
time_t thetime;
Nebula::log("ReM",Log::DEBUG,"VirtualMachineMigrate invoked");
NebulaLog::log("ReM",Log::DEBUG,"VirtualMachineMigrate invoked");
//Parse Arguments

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -40,7 +40,7 @@ void RequestManager::VirtualMachinePoolInfo::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"VirtualMachinePoolInfo method invoked");
NebulaLog::log("ReM",Log::DEBUG,"VirtualMachinePoolInfo method invoked");
// Get the parameters
session = xmlrpc_c::value_string(paramList.getString(0));
@ -119,7 +119,7 @@ error_common:
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
arrayData.push_back(xmlrpc_c::value_string(oss.str()));
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
xmlrpc_c::value_array arrayresult_error(arrayData);

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -40,7 +40,7 @@ void RequestManager::UserAllocate::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"UserAllocate method invoked");
NebulaLog::log("ReM",Log::DEBUG,"UserAllocate method invoked");
// Get the parameters
session = xmlrpc_c::value_string(paramList.getString(0));
@ -102,7 +102,7 @@ error_common:
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
arrayData.push_back(xmlrpc_c::value_string(oss.str()));
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
xmlrpc_c::value_array arrayresult_error(arrayData);

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -36,7 +36,7 @@ void RequestManager::UserDelete::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"UserDelete method invoked");
NebulaLog::log("ReM",Log::DEBUG,"UserDelete method invoked");
// Get the parameters
session = xmlrpc_c::value_string(paramList.getString(0));
@ -104,7 +104,7 @@ error_common:
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
arrayData.push_back(xmlrpc_c::value_string(oss.str()));
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
xmlrpc_c::value_array arrayresult_error(arrayData);

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -36,7 +36,7 @@ void RequestManager::UserInfo::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"UserInfo method invoked");
NebulaLog::log("ReM",Log::DEBUG,"UserInfo method invoked");
// Get the parameters
session = xmlrpc_c::value_string(paramList.getString(0));
@ -87,7 +87,7 @@ error_common:
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
arrayData.push_back(xmlrpc_c::value_string(oss.str()));
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
xmlrpc_c::value_array arrayresult_error(arrayData);

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -33,7 +33,7 @@ void RequestManager::UserPoolInfo::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"UserPoolInfo method invoked");
NebulaLog::log("ReM",Log::DEBUG,"UserPoolInfo method invoked");
// Get the parameters
session = xmlrpc_c::value_string(paramList.getString(0));
@ -79,7 +79,7 @@ error_common:
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
arrayData.push_back(xmlrpc_c::value_string(oss.str()));
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
xmlrpc_c::value_array arrayresult_error(arrayData);

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -42,7 +42,7 @@ void RequestManager::VirtualNetworkAllocate::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"VirtualNetworkAllocate method invoked");
NebulaLog::log("ReM",Log::DEBUG,"VirtualNetworkAllocate method invoked");
// Get the parameters & host
session = xmlrpc_c::value_string(paramList.getString(0));
@ -97,7 +97,7 @@ error_vn_allocate:
goto error_common;
error_common:
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
arrayData.push_back(xmlrpc_c::value_boolean(false));
arrayData.push_back(xmlrpc_c::value_string(oss.str()));

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -39,7 +39,7 @@ void RequestManager::VirtualNetworkDelete::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"VirtualNetworkDelete method invoked");
NebulaLog::log("ReM",Log::DEBUG,"VirtualNetworkDelete method invoked");
// Get the parameters & host
session = xmlrpc_c::value_string(paramList.getString(0));
@ -88,7 +88,7 @@ error_vn_get:
goto error_common;
error_common:
Nebula::log ("Rem",Log::ERROR,oss);
NebulaLog::log ("Rem",Log::ERROR,oss);
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
arrayData.push_back(xmlrpc_c::value_string(oss.str()));

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -38,7 +38,7 @@ void RequestManager::VirtualNetworkInfo::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"VirtualNetworkInfo method invoked");
NebulaLog::log("ReM",Log::DEBUG,"VirtualNetworkInfo method invoked");
// Get the parameters & host
session = xmlrpc_c::value_string(paramList.getString(0));
@ -88,7 +88,7 @@ error_common:
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
arrayData.push_back(xmlrpc_c::value_string(oss.str()));
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
xmlrpc_c::value_array arrayresult_error(arrayData);

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -40,7 +40,7 @@ void RequestManager::VirtualNetworkPoolInfo::execute(
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
Nebula::log("ReM",Log::DEBUG,"VirtualNetworkPoolInfo method invoked");
NebulaLog::log("ReM",Log::DEBUG,"VirtualNetworkPoolInfo method invoked");
// Get the parameters
session = xmlrpc_c::value_string(paramList.getString(0));
@ -121,7 +121,7 @@ error_common:
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
arrayData.push_back(xmlrpc_c::value_string(oss.str()));
Nebula::log("ReM",Log::ERROR,oss);
NebulaLog::log("ReM",Log::ERROR,oss);
xmlrpc_c::value_array arrayresult_error(arrayData);

View File

@ -15,6 +15,8 @@
/* -------------------------------------------------------------------------- */
#include "TransferManager.h"
#include "NebulaLog.h"
#include "Nebula.h"
/* -------------------------------------------------------------------------- */
@ -31,11 +33,11 @@ extern "C" void * tm_action_loop(void *arg)
tm = static_cast<TransferManager *>(arg);
Nebula::log("TrM",Log::INFO,"Transfer Manager started.");
NebulaLog::log("TrM",Log::INFO,"Transfer Manager started.");
tm->am.loop(0,0);
Nebula::log("TrM",Log::INFO,"Transfer Manager stopped.");
NebulaLog::log("TrM",Log::INFO,"Transfer Manager stopped.");
return 0;
}
@ -54,7 +56,7 @@ int TransferManager::start()
return -1;
}
Nebula::log("TrM",Log::INFO,"Starting Transfer Manager...");
NebulaLog::log("TrM",Log::INFO,"Starting Transfer Manager...");
pthread_attr_init (&pattr);
pthread_attr_setdetachstate (&pattr, PTHREAD_CREATE_JOINABLE);
@ -178,7 +180,7 @@ void TransferManager::do_action(const string &action, void * arg)
}
else if (action == ACTION_FINALIZE)
{
Nebula::log("TrM",Log::INFO,"Stopping Transfer Manager...");
NebulaLog::log("TrM",Log::INFO,"Stopping Transfer Manager...");
MadManager::stop();
}
@ -187,7 +189,7 @@ void TransferManager::do_action(const string &action, void * arg)
ostringstream oss;
oss << "Unknown action name: " << action;
Nebula::log("TrM", Log::ERROR, oss);
NebulaLog::log("TrM", Log::ERROR, oss);
}
}
@ -1052,7 +1054,7 @@ void TransferManager::load_mads(int uid)
oss << "Loading Transfer Manager drivers.";
Nebula::log("TM",Log::INFO,oss);
NebulaLog::log("TM",Log::INFO,oss);
for(i=0,oss.str("");i<mad_conf.size();i++,oss.str(""),tm_driver=0)
{
@ -1061,7 +1063,7 @@ void TransferManager::load_mads(int uid)
name = vattr->vector_value("NAME");
oss << "\tLoading driver: " << name;
Nebula::log("VMM", Log::INFO, oss);
NebulaLog::log("VMM", Log::INFO, oss);
tm_driver = new TransferManagerDriver(
uid,
@ -1079,7 +1081,7 @@ void TransferManager::load_mads(int uid)
oss.str("");
oss << "\tDriver " << name << " loaded.";
Nebula::log("TM",Log::INFO,oss);
NebulaLog::log("TM",Log::INFO,oss);
}
}
}

View File

@ -15,8 +15,10 @@
/* -------------------------------------------------------------------------- */
#include "TransferManagerDriver.h"
#include "Nebula.h"
#include "NebulaLog.h"
#include "LifeCycleManager.h"
#include "Nebula.h"
#include <sstream>
/* ************************************************************************** */
@ -52,7 +54,7 @@ void TransferManagerDriver::protocol(
VirtualMachine * vm;
os << "Message received: " << message;
Nebula::log("TM", Log::DEBUG, os);
NebulaLog::log("TM", Log::DEBUG, os);
// Parse the driver message
if ( is.good() )
@ -77,7 +79,7 @@ void TransferManagerDriver::protocol(
is.clear();
getline(is,info);
Nebula::log("TM",Log::INFO, info.c_str());
NebulaLog::log("TM",Log::INFO, info.c_str());
}
return;
@ -192,5 +194,5 @@ error_state:
void TransferManagerDriver::recover()
{
Nebula::log("TM",Log::INFO,"Recovering TM drivers");
NebulaLog::log("TM",Log::INFO,"Recovering TM drivers");
}

View File

@ -19,11 +19,12 @@
/* ************************************************************************** */
#include "UserPool.h"
#include "Nebula.h"
#include "NebulaLog.h"
#include <fstream>
#include <sys/types.h>
#include <pwd.h>
#include <stdlib.h>
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -117,7 +118,7 @@ UserPool::UserPool(SqlDB * db):PoolSQL(db,User::table)
if (one_uid != 0)
{
Nebula::log("ONE",Log::ERROR,oss);
NebulaLog::log("ONE",Log::ERROR,oss);
throw;
}
}

View File

@ -25,6 +25,8 @@
#include "VirtualMachine.h"
#include "VirtualNetworkPool.h"
#include "NebulaLog.h"
#include "Nebula.h"
@ -211,12 +213,12 @@ int VirtualMachine::select(SqlDB * db)
try
{
_log = new Log(nd.get_vm_log_filename(oid),Log::DEBUG);
_log = new FileLog(nd.get_vm_log_filename(oid),Log::DEBUG);
}
catch(exception &e)
{
ose << "Error creating log: " << e.what();
Nebula::log("ONE",Log::ERROR, ose);
NebulaLog::log("ONE",Log::ERROR, ose);
_log = 0;
}
@ -314,17 +316,17 @@ int VirtualMachine::insert(SqlDB * db)
return 0;
error_update:
Nebula::log("ONE",Log::ERROR, "Can not update VM in the database");
NebulaLog::log("ONE",Log::ERROR, "Can not update VM in the database");
vm_template.drop(db);
return -1;
error_template:
Nebula::log("ONE",Log::ERROR, "Can not insert template in the database");
NebulaLog::log("ONE",Log::ERROR, "Can not insert template in the database");
release_network_leases();
return -1;
error_leases:
Nebula::log("ONE",Log::ERROR, "Could not get network lease for VM");
NebulaLog::log("ONE",Log::ERROR, "Could not get network lease for VM");
release_network_leases();
return -1;
}
@ -601,7 +603,7 @@ int VirtualMachine::get_network_leases()
ostringstream ose;
ose << "Owner " << uid << " of the VM doesn't have ownership of Virtual Network "
<< vn->get_uid();
Nebula::log("VMM", Log::ERROR, ose);
NebulaLog::log("VMM", Log::ERROR, ose);
return -1;
}

View File

@ -14,9 +14,11 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
#include "Nebula.h"
#include "VirtualMachinePool.h"
#include "VirtualMachineHook.h"
#include "NebulaLog.h"
#include <sstream>
/* -------------------------------------------------------------------------- */
@ -55,7 +57,7 @@ VirtualMachinePool::VirtualMachinePool(SqlDB * db,
oss << "Empty ON or COMMAND attribute in VM_HOOK. Hook "
<< "not registered!";
Nebula::log("VM",Log::WARNING,oss);
NebulaLog::log("VM",Log::WARNING,oss);
continue;
}
@ -130,7 +132,7 @@ VirtualMachinePool::VirtualMachinePool(SqlDB * db,
ostringstream oss;
oss << "Unkown VM_HOOK " << on << ". Hook not registered!";
Nebula::log("VM",Log::WARNING,oss);
NebulaLog::log("VM",Log::WARNING,oss);
}
}
@ -187,7 +189,7 @@ int VirtualMachinePool::allocate (
ostringstream oss;
oss << error_msg;
Nebula::log("ONE", Log::ERROR, oss);
NebulaLog::log("ONE", Log::ERROR, oss);
free(error_msg);
return -2;
@ -302,7 +304,7 @@ void VirtualMachinePool::generate_context(int vm_id, Attribute * attr)
oss << error_msg << ": " << *str;
free(error_msg);
Nebula::log("ONE", Log::ERROR, oss);
NebulaLog::log("ONE", Log::ERROR, oss);
}
delete str;

View File

@ -15,10 +15,13 @@
/* -------------------------------------------------------------------------- */
#include "VirtualMachineManager.h"
#include "Nebula.h"
#include "NebulaLog.h"
#include "XenDriver.h"
#include "XMLDriver.h"
#include "LibVirtDriver.h"
#include "Nebula.h"
#include <time.h>
/* ************************************************************************** */
@ -55,11 +58,11 @@ extern "C" void * vmm_action_loop(void *arg)
vmm = static_cast<VirtualMachineManager *>(arg);
Nebula::log("VMM",Log::INFO,"Virtual Machine Manager started.");
NebulaLog::log("VMM",Log::INFO,"Virtual Machine Manager started.");
vmm->am.loop(vmm->timer_period,0);
Nebula::log("VMM",Log::INFO,"Virtual Machine Manager stopped.");
NebulaLog::log("VMM",Log::INFO,"Virtual Machine Manager stopped.");
return 0;
}
@ -78,7 +81,7 @@ int VirtualMachineManager::start()
return -1;
}
Nebula::log("VMM",Log::INFO,"Starting Virtual Machine Manager...");
NebulaLog::log("VMM",Log::INFO,"Starting Virtual Machine Manager...");
pthread_attr_init (&pattr);
pthread_attr_setdetachstate (&pattr, PTHREAD_CREATE_JOINABLE);
@ -211,7 +214,7 @@ void VirtualMachineManager::do_action(const string &action, void * arg)
}
else if (action == ACTION_FINALIZE)
{
Nebula::log("VMM",Log::INFO,"Stopping Virtual Machine Manager...");
NebulaLog::log("VMM",Log::INFO,"Stopping Virtual Machine Manager...");
MadManager::stop();
}
@ -220,7 +223,7 @@ void VirtualMachineManager::do_action(const string &action, void * arg)
ostringstream oss;
oss << "Unknown action name: " << action;
Nebula::log("VMM", Log::ERROR, oss);
NebulaLog::log("VMM", Log::ERROR, oss);
}
}
@ -810,7 +813,7 @@ void VirtualMachineManager::timer_action()
if ( mark >= 600 )
{
Nebula::log("VMM",Log::INFO,"--Mark--");
NebulaLog::log("VMM",Log::INFO,"--Mark--");
mark = 0;
}
@ -831,7 +834,7 @@ void VirtualMachineManager::timer_action()
{
os.str("");
os << "Monitoring VM " << *it << " but it has no history.";
Nebula::log("VMM", Log::ERROR, os);
NebulaLog::log("VMM", Log::ERROR, os);
continue;
}
@ -841,7 +844,7 @@ void VirtualMachineManager::timer_action()
os.str("");
os << "Monitoring VM " << *it << ".";
Nebula::log("VMM", Log::INFO, os);
NebulaLog::log("VMM", Log::INFO, os);
vm->set_last_poll(thetime);
@ -878,7 +881,7 @@ void VirtualMachineManager::load_mads(int uid)
oss << "Loading Virtual Machine Manager drivers.";
Nebula::log("VMM",Log::INFO,oss);
NebulaLog::log("VMM",Log::INFO,oss);
for(i=0,oss.str("");i<mad_conf.size();i++,oss.str(""),vmm_driver=0)
{
@ -891,7 +894,7 @@ void VirtualMachineManager::load_mads(int uid)
oss << "\tLoading driver: " << name << " (" << type << ")";
Nebula::log("VMM", Log::INFO, oss);
NebulaLog::log("VMM", Log::INFO, oss);
if ( type == "XEN" )
{
@ -911,7 +914,7 @@ void VirtualMachineManager::load_mads(int uid)
oss.str("");
oss << "\tUnknown driver type: " << type;
Nebula::log("VMM",Log::ERROR,oss);
NebulaLog::log("VMM",Log::ERROR,oss);
continue;
}
@ -923,7 +926,7 @@ void VirtualMachineManager::load_mads(int uid)
oss.str("");
oss << "\tDriver " << name << " loaded.";
Nebula::log("VMM",Log::INFO,oss);
NebulaLog::log("VMM",Log::INFO,oss);
}
}
}

View File

@ -15,8 +15,10 @@
/* -------------------------------------------------------------------------- */
#include "VirtualMachineManagerDriver.h"
#include "Nebula.h"
#include "NebulaLog.h"
#include "LifeCycleManager.h"
#include "Nebula.h"
#include <sstream>
VirtualMachineManagerDriver::VirtualMachineManagerDriver(
@ -66,7 +68,7 @@ VirtualMachineManagerDriver::VirtualMachineManagerDriver(
oss << "Error loading driver configuration file " << cfile;
}
Nebula::log("VMM", Log::ERROR, oss);
NebulaLog::log("VMM", Log::ERROR, oss);
}
}
}
@ -238,7 +240,7 @@ void VirtualMachineManagerDriver::protocol(
VirtualMachine * vm;
os << "Message received: " << message;
Nebula::log("VMM", Log::DEBUG, os);
NebulaLog::log("VMM", Log::DEBUG, os);
// Parse the driver message
if ( is.good() )
@ -263,7 +265,7 @@ void VirtualMachineManagerDriver::protocol(
is.clear();
getline(is,info);
Nebula::log("VMM",Log::INFO, info.c_str());
NebulaLog::log("VMM",Log::INFO, info.c_str());
}
return;
@ -361,7 +363,7 @@ void VirtualMachineManagerDriver::protocol(
}
else
{
string info;
string info;
getline(is,info);
@ -602,6 +604,6 @@ void VirtualMachineManagerDriver::protocol(
void VirtualMachineManagerDriver::recover()
{
Nebula::log("VMM",Log::INFO,"Recovering VMM drivers");
NebulaLog::log("VMM",Log::INFO,"Recovering VMM drivers");
}

View File

@ -16,7 +16,7 @@
#include "FixedLeases.h"
#include "Nebula.h"
#include "NebulaLog.h"
FixedLeases::FixedLeases(
SqlDB * db,
@ -99,7 +99,7 @@ error_ip:
oss << "Error inserting lease, IP = " << ip;
error_common:
Nebula::log("VNM", Log::ERROR, oss);
NebulaLog::log("VNM", Log::ERROR, oss);
return -1;
}

View File

@ -16,7 +16,7 @@
#include "Leases.h"
#include "Nebula.h"
#include "NebulaLog.h"
/* ************************************************************************** */
/* ************************************************************************** */
@ -325,7 +325,7 @@ error_id:
oss.str("");
oss << "Error getting leases for network nid: " << oid;
Nebula::log("VNM", Log::ERROR, oss);
NebulaLog::log("VNM", Log::ERROR, oss);
return -1;
}
@ -347,7 +347,7 @@ int Leases::drop(SqlDB * db)
int Leases::insert(SqlDB * db)
{
Nebula::log("VNM", Log::ERROR, "Should not access to Leases.insert()");
NebulaLog::log("VNM", Log::ERROR, "Should not access to Leases.insert()");
return -1;
}
@ -356,7 +356,7 @@ int Leases::insert(SqlDB * db)
int Leases::update(SqlDB * db)
{
Nebula::log("VNM", Log::ERROR, "Should not access to Leases.update()");
NebulaLog::log("VNM", Log::ERROR, "Should not access to Leases.update()");
return -1;
}

View File

@ -16,7 +16,7 @@
#include "VirtualNetwork.h"
#include "Nebula.h"
#include "NebulaLog.h"
#include "RangedLeases.h"
#include "FixedLeases.h"
@ -201,7 +201,7 @@ error_addr:
ose << "Network address is not defined nid: " << oid;
error_common:
Nebula::log("VNM", Log::ERROR, ose);
NebulaLog::log("VNM", Log::ERROR, ose);
return -1;
}
@ -357,7 +357,7 @@ error_leases:
vn_drop(db);
error_common:
Nebula::log("VNM", Log::ERROR, ose);
NebulaLog::log("VNM", Log::ERROR, ose);
return -1;
}

View File

@ -14,8 +14,9 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
#include "Nebula.h"
#include "VirtualNetworkPool.h"
#include "NebulaLog.h"
#include <sstream>
VirtualNetworkPool::VirtualNetworkPool(SqlDB * db,
@ -40,7 +41,8 @@ VirtualNetworkPool::VirtualNetworkPool(SqlDB * db,
if (count != 1)
{
Nebula::log("VNM",Log::ERROR,"Wrong MAC prefix format, using default");
NebulaLog::log("VNM",Log::ERROR,
"Wrong MAC prefix format, using default");
mac_prefix = 1; //"00:01"
return;
@ -81,7 +83,7 @@ int VirtualNetworkPool::allocate (
if ( rc != 0 )
{
oss << error_msg;
Nebula::log("VNM", Log::ERROR, oss);
NebulaLog::log("VNM", Log::ERROR, oss);
free(error_msg);
return -1;