1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-22 17:57:46 +03:00

Feature #2653: Temporary fix for stand-alone mode

This commit is contained in:
Carlos Martín 2014-01-24 18:50:09 +01:00
parent 82ba60ed39
commit 63d0b8f5a3
6 changed files with 20 additions and 10 deletions

View File

@ -34,9 +34,9 @@ class PoolObjectAuth;
class AclManager : public Callbackable
{
public:
AclManager(SqlDB * _db);
AclManager(SqlDB * _db, int zone_id);
AclManager():db(0),lastOID(0)
AclManager(int _zone_id):zone_id(_zone_id),db(0),lastOID(0)
{
pthread_mutex_init(&mutex, 0);
};
@ -275,11 +275,15 @@ private:
long long resource_req,
long long resource_mask);
// ----------------------------------------
// Local zone
// ----------------------------------------
int zone_id;
// TODO
int get_zone_id() const
{
return 10;
return zone_id;
};
// ----------------------------------------

View File

@ -48,7 +48,8 @@ int AclManager::init_cb(void *nil, int num, char **values, char **names)
/* -------------------------------------------------------------------------- */
AclManager::AclManager(SqlDB * _db) : db(_db), lastOID(-1)
AclManager::AclManager(SqlDB * _db, int _zone_id)
: zone_id(_zone_id), db(_db), lastOID(-1)
{
ostringstream oss;

View File

@ -911,7 +911,7 @@ void Nebula::start(bool bootstrap_only)
// ---- ACL Manager ----
try
{
aclm = new AclManager(db);
aclm = new AclManager(db, zone_id);
}
catch (bad_alloc&)
{

View File

@ -26,9 +26,9 @@ void PoolObjectAuth::get_acl_rules(AclRule& owner_rule,
perm_resource = obj_type | AclRule::INDIVIDUAL_ID | oid;
// TODO
// TODO: zone id is 0 in stand alone mode
//perm_zone = AclRule::INDIVIDUAL_ID | Nebula::instance().get_zone_id();
perm_zone = AclRule::INDIVIDUAL_ID | 10;
perm_zone = AclRule::INDIVIDUAL_ID | 0;
// -------------------------------------------------------------------------
// Rule "#uid ob_type/#oid user_rights #zone"

View File

@ -28,7 +28,8 @@ using namespace std;
class AclXML : public AclManager
{
public:
AclXML(Client * _client):AclManager(), client(_client){};
AclXML(Client * _client, int zone_id):AclManager(zone_id), client(_client)
{};
virtual ~AclXML(){};

View File

@ -228,7 +228,11 @@ void Scheduler::start()
dspool = new SystemDatastorePoolXML(client);
img_dspool = new ImageDatastorePoolXML(client);
acls = new AclXML(client);
// TODO: In stand alone mode, Nebula.cc inits zone_id to 0. But we need
// to know the local zone id in the sched. Either from sched.conf, or
// from one.system.config
int zone_id = 0;
acls = new AclXML(client, zone_id);
// -----------------------------------------------------------
// Load scheduler policies