mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
feature #687: The scheduler cheks user authorization for the host. Log messages for filtered hosts
This commit is contained in:
parent
db1a3ae691
commit
5801e9c53e
@ -330,11 +330,17 @@ void Scheduler::match()
|
||||
|
||||
if ( matched == false )
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "Host " << host->get_hid() <<
|
||||
" filtered out. It does not fullfil REQUIREMENTS.";
|
||||
|
||||
NebulaLog::log("SCHED",Log::DEBUG,oss);
|
||||
continue;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Check host capacity
|
||||
// Check if user is authorized
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
user = upool->get(uid);
|
||||
@ -342,21 +348,28 @@ void Scheduler::match()
|
||||
|
||||
if ( user != 0 )
|
||||
{
|
||||
set<int> groups = user->get_groups();
|
||||
//TODO Authorization test for this user on this host
|
||||
// 1.- user = uid
|
||||
// 2.- gid
|
||||
// 3.- groups
|
||||
// 4.- DEPLOY on host->get_hid
|
||||
set<int> groups = user->get_groups();
|
||||
|
||||
matched = acls->authorize(uid,
|
||||
groups,
|
||||
AuthRequest::HOST,
|
||||
host->get_hid(),
|
||||
-1,
|
||||
AuthRequest::USE);
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO Log debug info (user not authorized)?
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( matched == false )
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "Host " << host->get_hid() <<
|
||||
" filtered out. User is not authorized to use it.";
|
||||
|
||||
NebulaLog::log("SCHED",Log::DEBUG,oss);
|
||||
continue;
|
||||
}
|
||||
// -----------------------------------------------------------------
|
||||
@ -374,6 +387,16 @@ void Scheduler::match()
|
||||
vm->add_host(host->get_hid());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "Host " << host->get_hid() <<
|
||||
" filtered out. It does not have enough capacity.";
|
||||
|
||||
NebulaLog::log("SCHED",Log::DEBUG,oss);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user