mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
+ Improve formating of driver initialization log messages
This commit is contained in:
parent
878e969eba
commit
0221dc187a
@ -49,7 +49,6 @@ public:
|
||||
: cmd(c)
|
||||
, arg(a)
|
||||
, concurrency(ct)
|
||||
, pid(-1)
|
||||
{}
|
||||
|
||||
~Driver()
|
||||
@ -143,12 +142,12 @@ private:
|
||||
|
||||
std::string arg;
|
||||
|
||||
int concurrency;
|
||||
int concurrency = 0;
|
||||
|
||||
/**
|
||||
* Process ID of the driver
|
||||
*/
|
||||
pid_t pid;
|
||||
pid_t pid = -1;
|
||||
|
||||
/**
|
||||
* Class to read lines from the stream
|
||||
@ -223,7 +222,9 @@ void Driver<MSG>
|
||||
if (!success)
|
||||
{
|
||||
kill(pid, SIGKILL);
|
||||
};
|
||||
}
|
||||
|
||||
pid = -1;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -32,7 +32,10 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~DriverManager() = default;
|
||||
virtual ~DriverManager()
|
||||
{
|
||||
stop(1);
|
||||
}
|
||||
|
||||
int load_driver(const VectorAttribute* mad_config);
|
||||
|
||||
@ -117,11 +120,11 @@ int DriverManager<D>::load_driver(const VectorAttribute* mad_config)
|
||||
|
||||
mad_config->vector_value("THREADS", threads, 0);
|
||||
|
||||
NebulaLog::info("DrM", "Loading driver: " + name);
|
||||
NebulaLog::info("DrM", " Loading driver: " + name);
|
||||
|
||||
if (exec.empty())
|
||||
{
|
||||
NebulaLog::error("DrM", "\tEmpty executable for driver: " + name);
|
||||
NebulaLog::error("DrM", " Empty executable for driver: " + name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -132,7 +135,7 @@ int DriverManager<D>::load_driver(const VectorAttribute* mad_config)
|
||||
|
||||
if (access(exec.c_str(), F_OK) != 0)
|
||||
{
|
||||
NebulaLog::error("DrM", "File not exists: " + exec);
|
||||
NebulaLog::error("DrM", " File not exists: " + exec);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -141,11 +144,11 @@ int DriverManager<D>::load_driver(const VectorAttribute* mad_config)
|
||||
|
||||
if (rc.second)
|
||||
{
|
||||
NebulaLog::info("DrM", "\tDriver loaded: " + name);
|
||||
NebulaLog::info("DrM", " Driver loaded: " + name);
|
||||
}
|
||||
else
|
||||
{
|
||||
NebulaLog::error("DrM", "\tDriver already exists: " + name);
|
||||
NebulaLog::error("DrM", " Driver already exists: " + name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -250,6 +253,8 @@ int DriverManager<D>::add(const std::string& name, std::unique_ptr<D> driver)
|
||||
if (!rc.second)
|
||||
{
|
||||
// Driver already exists
|
||||
NebulaLog::error("DrM", " Driver already exists: " + name);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -134,6 +134,13 @@ public:
|
||||
|
||||
virtual ~Listener()
|
||||
{
|
||||
if (!end)
|
||||
{
|
||||
end = true;
|
||||
|
||||
cond.notify_one();
|
||||
}
|
||||
|
||||
join_thread();
|
||||
}
|
||||
|
||||
|
@ -1237,7 +1237,7 @@ void Nebula::start(bool bootstrap_only)
|
||||
return;
|
||||
|
||||
error_mad:
|
||||
NebulaLog::log("ONE", Log::ERROR, "Could not load driver");
|
||||
NebulaLog::log("ONE", Log::ERROR, "Could not load driver, exiting...");
|
||||
throw runtime_error("Could not load an OpenNebula driver");
|
||||
}
|
||||
|
||||
|
@ -2593,7 +2593,7 @@ int VirtualMachineManager::load_drivers(const vector<const VectorAttribute*>& _m
|
||||
|
||||
one_util::toupper(type);
|
||||
|
||||
oss << "\tLoading driver: " << name << " (" << type << ")";
|
||||
oss << " Loading driver: " << name << " (" << type << ")";
|
||||
|
||||
NebulaLog::log("VMM", Log::INFO, oss);
|
||||
|
||||
@ -2616,7 +2616,7 @@ int VirtualMachineManager::load_drivers(const vector<const VectorAttribute*>& _m
|
||||
else
|
||||
{
|
||||
oss.str("");
|
||||
oss << "\tUnknown driver type: " << type;
|
||||
oss << " Unknown driver type: " << type;
|
||||
|
||||
NebulaLog::log("VMM",Log::ERROR,oss);
|
||||
|
||||
@ -2631,7 +2631,7 @@ int VirtualMachineManager::load_drivers(const vector<const VectorAttribute*>& _m
|
||||
}
|
||||
|
||||
oss.str("");
|
||||
oss << "\tDriver " << name << " loaded.";
|
||||
oss << " Driver " << name << " loaded.";
|
||||
|
||||
NebulaLog::log("VMM",Log::INFO,oss);
|
||||
}
|
||||
|
@ -76,14 +76,14 @@ VirtualMachineManagerDriver::VirtualMachineManagerDriver(
|
||||
|
||||
if ( error_msg != nullptr )
|
||||
{
|
||||
oss << "Error loading driver configuration file " << cfile <<
|
||||
oss << " Error loading driver configuration file " << cfile <<
|
||||
" : " << error_msg;
|
||||
|
||||
free(error_msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
oss << "Error loading driver configuration file " << cfile;
|
||||
oss << " Error loading driver configuration file " << cfile;
|
||||
}
|
||||
|
||||
NebulaLog::log("VMM", Log::ERROR, oss);
|
||||
@ -128,7 +128,7 @@ VirtualMachineManagerDriver::VirtualMachineManagerDriver(
|
||||
}
|
||||
else
|
||||
{
|
||||
NebulaLog::log("VMM", Log::INFO, "Using default imported VMs actions");
|
||||
NebulaLog::log("VMM", Log::INFO, " Using default imported VMs actions");
|
||||
|
||||
it = attrs.find("NAME");
|
||||
|
||||
@ -158,7 +158,7 @@ VirtualMachineManagerDriver::VirtualMachineManagerDriver(
|
||||
|
||||
if ( VMActions::action_from_str(action, id) != 0 )
|
||||
{
|
||||
NebulaLog::log("VMM", Log::ERROR, "Wrong action: " + action);
|
||||
NebulaLog::log("VMM", Log::ERROR, " Wrong action: " + action);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ VirtualMachineManagerDriver::VirtualMachineManagerDriver(
|
||||
|
||||
if (exec.empty())
|
||||
{
|
||||
NebulaLog::error("VMM", "\tEmpty executable for driver: " + name);
|
||||
NebulaLog::error("VMM", " Empty executable for driver: " + name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ VirtualMachineManagerDriver::VirtualMachineManagerDriver(
|
||||
|
||||
if (access(exec.c_str(), F_OK) != 0)
|
||||
{
|
||||
NebulaLog::error("VMM", "File not exists: " + exec);
|
||||
NebulaLog::error("VMM", " File not exists: " + exec);
|
||||
}
|
||||
|
||||
cmd_(exec);
|
||||
|
Loading…
Reference in New Issue
Block a user