mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-25 02:50:08 +03:00
feature #1678: Exit oned if a driver cannot be loaded
This commit is contained in:
parent
8a58141fb1
commit
f98a2daee9
@ -80,7 +80,7 @@ public:
|
||||
* identity will be used. Otherwise the Mad will be loaded through the
|
||||
* sudo application.
|
||||
*/
|
||||
void load_mads(int uid);
|
||||
int load_mads(int uid);
|
||||
|
||||
/**
|
||||
* Gets the thread identification.
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void load_mads(int uid=0);
|
||||
int load_mads(int uid=0);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
* identity will be used. Otherwise the Mad will be loaded through the
|
||||
* sudo application.
|
||||
*/
|
||||
void load_mads(int uid=0);
|
||||
int load_mads(int uid=0);
|
||||
|
||||
/**
|
||||
* Gets the thread identification.
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void load_mads(int uid=0);
|
||||
int load_mads(int uid=0);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -48,14 +48,14 @@ public:
|
||||
* crashes
|
||||
*/
|
||||
static void mad_manager_system_init();
|
||||
|
||||
|
||||
/**
|
||||
* Loads Virtual Machine Manager Mads defined in configuration file
|
||||
* @param uid of the user executing the driver. When uid is 0 the nebula
|
||||
* @param uid of the user executing the driver. When uid is 0 the nebula
|
||||
* identity will be used. Otherwise the Mad will be loaded through the
|
||||
* sudo application.
|
||||
* sudo application.
|
||||
*/
|
||||
virtual void load_mads(int uid) = 0;
|
||||
virtual int load_mads(int uid) = 0;
|
||||
|
||||
/**
|
||||
* Notify the result of an auth request
|
||||
@ -69,23 +69,23 @@ protected:
|
||||
virtual ~MadManager();
|
||||
|
||||
/**
|
||||
* Vector containing Mad configuration for this Manager, as described in
|
||||
* Vector containing Mad configuration for this Manager, as described in
|
||||
* the nebula location
|
||||
*/
|
||||
vector<const Attribute *> mad_conf;
|
||||
|
||||
|
||||
/**
|
||||
* This function initialize the communication pipes to register new MADs
|
||||
* in the manager, and starts a listener to wait for driver messages.
|
||||
*/
|
||||
virtual int start();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This function closes the communication pipes, stops the listener thread,
|
||||
* This function closes the communication pipes, stops the listener thread,
|
||||
* and finalize the associated drivers.
|
||||
*/
|
||||
virtual void stop();
|
||||
virtual void stop();
|
||||
|
||||
/**
|
||||
* Get a mad
|
||||
@ -102,8 +102,8 @@ protected:
|
||||
int add(Mad *mad);
|
||||
|
||||
/**
|
||||
* This function can be periodically executed to check time_outs on
|
||||
* request. It will fail requests with an expired timeout and will notify
|
||||
* This function can be periodically executed to check time_outs on
|
||||
* request. It will fail requests with an expired timeout and will notify
|
||||
* the clients.
|
||||
*/
|
||||
void check_time_outs_action();
|
||||
@ -138,7 +138,7 @@ private:
|
||||
{
|
||||
pthread_mutex_unlock(&mutex);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function to execute the listener method within a new pthread (requires
|
||||
* C linkage)
|
||||
@ -156,15 +156,15 @@ private:
|
||||
pthread_t listener_thread;
|
||||
|
||||
/**
|
||||
* Communication pipe (read end) to link the Manager and the listener
|
||||
* Communication pipe (read end) to link the Manager and the listener
|
||||
* thread
|
||||
*/
|
||||
int pipe_r;
|
||||
|
||||
|
||||
/**
|
||||
* Communication pipe (write end) to link the Manager and the listener
|
||||
* Communication pipe (write end) to link the Manager and the listener
|
||||
* thread
|
||||
*/
|
||||
*/
|
||||
int pipe_w;
|
||||
|
||||
/**
|
||||
@ -172,12 +172,12 @@ private:
|
||||
* Mads responses)
|
||||
*/
|
||||
vector<int> fds;
|
||||
|
||||
|
||||
/**
|
||||
* The sets of Mads managed by the MadManager
|
||||
*/
|
||||
vector<Mad *> mads;
|
||||
|
||||
|
||||
/**
|
||||
* Read buffer for the listener. This variable is in the class so it
|
||||
* can be free upon listener thread cancellation.
|
||||
@ -188,7 +188,7 @@ private:
|
||||
* List of pending requests
|
||||
*/
|
||||
map<int, SyncRequest *> sync_requests;
|
||||
|
||||
|
||||
/**
|
||||
* Listener thread implementation.
|
||||
*/
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
* identity will be used. Otherwise the Mad will be loaded through the
|
||||
* sudo application.
|
||||
*/
|
||||
void load_mads(int uid);
|
||||
int load_mads(int uid);
|
||||
|
||||
/**
|
||||
* Gets the thread identification.
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
* identity will be used. Otherwise the Mad will be loaded through the
|
||||
* sudo application.
|
||||
*/
|
||||
void load_mads(int uid);
|
||||
int load_mads(int uid);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@ -44,7 +44,7 @@ KILL_9_SECONDS=5
|
||||
BACKUP="true"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Function that checks for running daemons
|
||||
# Function that checks for running daemons
|
||||
#------------------------------------------------------------------------------
|
||||
setup()
|
||||
{
|
||||
@ -146,7 +146,7 @@ start()
|
||||
start_sched
|
||||
|
||||
# Wait for the daemons to warm up
|
||||
sleep 2
|
||||
sleep 3
|
||||
|
||||
STARTED="true"
|
||||
|
||||
|
@ -314,7 +314,7 @@ error:
|
||||
/* MAD Loading */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void AuthManager::load_mads(int uid)
|
||||
int AuthManager::load_mads(int uid)
|
||||
{
|
||||
ostringstream oss;
|
||||
const VectorAttribute * vattr = 0;
|
||||
@ -334,7 +334,7 @@ void AuthManager::load_mads(int uid)
|
||||
if ( vattr == 0 )
|
||||
{
|
||||
NebulaLog::log("AuM",Log::ERROR,"Failed to load Auth. Manager driver.");
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
VectorAttribute auth_conf("AUTH_MAD",vattr->value());
|
||||
@ -375,4 +375,6 @@ void AuthManager::load_mads(int uid)
|
||||
|
||||
NebulaLog::log("AuM",Log::INFO,oss);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ extern "C" void * hm_action_loop(void *arg)
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void HookManager::load_mads(int uid)
|
||||
int HookManager::load_mads(int uid)
|
||||
{
|
||||
HookManagerDriver * hm_mad;
|
||||
ostringstream oss;
|
||||
@ -62,7 +62,7 @@ void HookManager::load_mads(int uid)
|
||||
if ( vattr == 0 )
|
||||
{
|
||||
NebulaLog::log("HKM",Log::INFO,"Failed to load Hook Manager driver.");
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
VectorAttribute hook_conf("HOOK_MAD",vattr->value());
|
||||
@ -80,6 +80,8 @@ void HookManager::load_mads(int uid)
|
||||
|
||||
NebulaLog::log("HKM",Log::INFO,oss);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -52,7 +52,7 @@ extern "C" void * im_action_loop(void *arg)
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void InformationManager::load_mads(int uid)
|
||||
int InformationManager::load_mads(int uid)
|
||||
{
|
||||
InformationManagerDriver * im_mad;
|
||||
unsigned int i;
|
||||
@ -82,7 +82,13 @@ void InformationManager::load_mads(int uid)
|
||||
|
||||
NebulaLog::log("InM",Log::INFO,oss);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -47,7 +47,7 @@ extern "C" void * image_action_loop(void *arg)
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void ImageManager::load_mads(int uid)
|
||||
int ImageManager::load_mads(int uid)
|
||||
{
|
||||
ImageManagerDriver * imagem_mad;
|
||||
ostringstream oss;
|
||||
@ -64,7 +64,7 @@ void ImageManager::load_mads(int uid)
|
||||
if ( vattr == 0 )
|
||||
{
|
||||
NebulaLog::log("ImM",Log::INFO,"Failed to load Image Manager driver.");
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
VectorAttribute image_conf("IMAGE_MAD",vattr->value());
|
||||
@ -82,6 +82,8 @@ void ImageManager::load_mads(int uid)
|
||||
|
||||
NebulaLog::log("ImM",Log::INFO,oss);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -874,18 +874,41 @@ void Nebula::start(bool bootstrap_only)
|
||||
// Load mads
|
||||
// -----------------------------------------------------------
|
||||
|
||||
sleep(2);
|
||||
sleep(1);
|
||||
|
||||
vmm->load_mads(0);
|
||||
rc = 0;
|
||||
|
||||
im->load_mads(0);
|
||||
tm->load_mads(0);
|
||||
hm->load_mads(0);
|
||||
imagem->load_mads(0);
|
||||
if (vmm->load_mads(0) != 0)
|
||||
{
|
||||
goto error_mad;
|
||||
}
|
||||
|
||||
if (im->load_mads(0) != 0)
|
||||
{
|
||||
goto error_mad;
|
||||
}
|
||||
|
||||
if (tm->load_mads(0) != 0)
|
||||
{
|
||||
goto error_mad;
|
||||
}
|
||||
|
||||
if (hm->load_mads(0) != 0)
|
||||
{
|
||||
goto error_mad;
|
||||
}
|
||||
|
||||
if (imagem->load_mads(0) != 0)
|
||||
{
|
||||
goto error_mad;
|
||||
}
|
||||
|
||||
if ( authm != 0 )
|
||||
{
|
||||
authm->load_mads(0);
|
||||
if (authm->load_mads(0) != 0)
|
||||
{
|
||||
goto error_mad;
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Request Manager ----
|
||||
@ -964,5 +987,9 @@ void Nebula::start(bool bootstrap_only)
|
||||
xmlCleanupParser();
|
||||
|
||||
NebulaLog::log("ONE", Log::INFO, "All modules finalized, exiting.\n");
|
||||
|
||||
error_mad:
|
||||
NebulaLog::log("ONE", Log::ERROR, "Could not load driver");
|
||||
throw runtime_error("Could not load an OpenNebula driver");
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ void TransferManager::do_action(const string &action, void * arg)
|
||||
(nd.get_lcm())->trigger(LifeCycleManager::EPILOG_SUCCESS,vid);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
epilog_delete_previous_action(vid);
|
||||
|
||||
}
|
||||
@ -272,7 +272,7 @@ void TransferManager::do_action(const string &action, void * arg)
|
||||
(nd.get_lcm())->trigger(LifeCycleManager::EPILOG_SUCCESS,vid);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
epilog_delete_both_action(vid);
|
||||
}
|
||||
}
|
||||
@ -1905,7 +1905,7 @@ void TransferManager::migrate_transfer_command(
|
||||
/* MAD Loading */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void TransferManager::load_mads(int uid)
|
||||
int TransferManager::load_mads(int uid)
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
@ -1927,7 +1927,7 @@ void TransferManager::load_mads(int uid)
|
||||
if ( vattr == 0 )
|
||||
{
|
||||
NebulaLog::log("TM",Log::ERROR,"Failed to load Transfer Manager driver.");
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
VectorAttribute tm_conf("TM_MAD",vattr->value());
|
||||
@ -1947,4 +1947,6 @@ void TransferManager::load_mads(int uid)
|
||||
|
||||
NebulaLog::log("TM",Log::INFO,oss);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -2194,7 +2194,7 @@ error_common:
|
||||
/* MAD Loading */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void VirtualMachineManager::load_mads(int uid)
|
||||
int VirtualMachineManager::load_mads(int uid)
|
||||
{
|
||||
unsigned int i;
|
||||
ostringstream oss;
|
||||
@ -2263,5 +2263,11 @@ void VirtualMachineManager::load_mads(int uid)
|
||||
|
||||
NebulaLog::log("VMM",Log::INFO,oss);
|
||||
}
|
||||
else
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user