mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
feature #687: Place holder for ACL integration ready
This commit is contained in:
parent
2a12216760
commit
facdf35009
@ -41,6 +41,11 @@ public:
|
||||
return oid;
|
||||
};
|
||||
|
||||
set<int> get_groups()
|
||||
{
|
||||
return group_ids;
|
||||
};
|
||||
|
||||
private:
|
||||
int oid;
|
||||
int gid;
|
||||
|
@ -46,6 +46,11 @@ public:
|
||||
return oid;
|
||||
};
|
||||
|
||||
int get_uid() const
|
||||
{
|
||||
return uid;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a new share to the map of suitable shares to start this VM
|
||||
* @param hid of the selected host
|
||||
@ -138,6 +143,8 @@ protected:
|
||||
*/
|
||||
int oid;
|
||||
|
||||
int uid;
|
||||
|
||||
int memory;
|
||||
float cpu;
|
||||
|
||||
|
@ -22,7 +22,8 @@ void VirtualMachineXML::init_attributes()
|
||||
{
|
||||
vector<string> result;
|
||||
|
||||
oid = atoi(((*this)["/VM/ID"] )[0].c_str() );
|
||||
oid = atoi(((*this)["/VM/ID"] )[0].c_str());
|
||||
uid = atoi(((*this)["/VM/UID"])[0].c_str());
|
||||
|
||||
result = ((*this)["/VM/TEMPLATE/MEMORY"]);
|
||||
if (result.size() > 0)
|
||||
|
@ -230,7 +230,7 @@ int Scheduler::set_up_pools()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//Cleans the cache and get the pending VMs
|
||||
//Cleans the cache and get the users
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
rc = upool->set_up();
|
||||
@ -240,6 +240,14 @@ int Scheduler::set_up_pools()
|
||||
return rc;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//Cleans the cache and get the ACLs
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
//TODO
|
||||
// 1.- one.acl.list
|
||||
// 2.- from_xml
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//Get the matching hosts for each VM
|
||||
//--------------------------------------------------------------------------
|
||||
@ -258,6 +266,7 @@ void Scheduler::match()
|
||||
int vm_memory;
|
||||
int vm_cpu;
|
||||
int vm_disk;
|
||||
int uid;
|
||||
string reqs;
|
||||
|
||||
HostXML * host;
|
||||
@ -266,6 +275,9 @@ void Scheduler::match()
|
||||
char * error;
|
||||
bool matched;
|
||||
|
||||
UserXML * user;
|
||||
set<int> gids;
|
||||
|
||||
int rc;
|
||||
|
||||
map<int, ObjectXML*>::const_iterator vm_it;
|
||||
@ -280,8 +292,9 @@ void Scheduler::match()
|
||||
vm = static_cast<VirtualMachineXML*>(vm_it->second);
|
||||
|
||||
reqs = vm->get_requirements();
|
||||
uid = vm->get_uid();
|
||||
|
||||
for (h_it=hosts.begin(); h_it != hosts.end(); h_it++)
|
||||
for (h_it=hosts.begin(), matched=false; h_it != hosts.end(); h_it++)
|
||||
{
|
||||
host = static_cast<HostXML *>(h_it->second);
|
||||
|
||||
@ -310,12 +323,38 @@ void Scheduler::match()
|
||||
{
|
||||
matched = true;
|
||||
}
|
||||
|
||||
if ( matched == false )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Check host capacity
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
user = upool->get(uid);
|
||||
matched = false;
|
||||
|
||||
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
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO Log debug info (user not authorized)?
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( matched == false )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Check host capacity
|
||||
// -----------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user