mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-22 22:03:39 +03:00
parent
c2af378c6a
commit
ca64f96f26
@ -104,6 +104,8 @@ public:
|
||||
void call(const std::string &method, const std::string &format,
|
||||
xmlrpc_c::value * const result, ...);
|
||||
|
||||
void refresh_authentication();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Creates a new xml-rpc client with specified options.
|
||||
|
@ -298,3 +298,15 @@ int Client::call(const std::string& endpoint, const std::string& method,
|
||||
return xml_rc;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void Client::refresh_authentication()
|
||||
{
|
||||
string err;
|
||||
|
||||
if (read_oneauth(one_auth, err) != 0 )
|
||||
{
|
||||
NebulaLog::log("XMLRPC", Log::ERROR, err);
|
||||
}
|
||||
}
|
@ -828,8 +828,17 @@ class ClusterSet
|
||||
def monitor(conf)
|
||||
@mutex.synchronize do
|
||||
# Get current server raft status, to skip monitor being FOLLOWER
|
||||
rc = @client.call('zone.raftstatus')
|
||||
|
||||
if OpenNebula.is_error?(rc)
|
||||
# Try to reinit the authentication, in case of authentication error
|
||||
@client = OpenNebula::Client.new if rc.errno == OpenNebula::Error::EAUTHENTICATION
|
||||
|
||||
next
|
||||
end
|
||||
|
||||
xml_e = OpenNebula::XMLElement.build_xml(
|
||||
@client.call('zone.raftstatus'),
|
||||
rc,
|
||||
'RAFT'
|
||||
)
|
||||
|
||||
|
@ -1876,6 +1876,16 @@ void Scheduler::timer_action()
|
||||
else
|
||||
{
|
||||
NebulaLog::log("SCHED", Log::ERROR, "Cannot contact oned: " + msg);
|
||||
|
||||
int errcode = xmlrpc_c::value_int(values[2]);
|
||||
|
||||
if (errcode == 0x00100) // Authentication error
|
||||
{
|
||||
NebulaLog::log("SCHED", Log::INFO, "Trying to reinit the authentication");
|
||||
|
||||
Client::client()->refresh_authentication();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user