1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

Merge branch 'master' of git.opennebula.org:one

This commit is contained in:
Carlos Martín 2011-07-07 19:23:19 +02:00
commit a35d52fc02
39 changed files with 476 additions and 763 deletions

View File

@ -54,7 +54,7 @@ public:
* authorizes the operation.
*
* @param uid The user ID requesting to be authorized
* @param user_groups Set of group IDs that the user is part of
* @param gid Group ID of the user
* @param obj_type The object over which the operation will be performed
* @param obj_id The object ID
* @param obj_gid The object's group ID
@ -62,7 +62,7 @@ public:
* @return true if the authorization is granted by any rule
*/
const bool authorize(int uid,
const set<int>& user_groups,
int gid,
AuthRequest::Object obj_type,
int obj_id,
int obj_gid,

View File

@ -18,7 +18,6 @@
#define AUTH_MANAGER_H_
#include <time.h>
#include <set>
#include "MadManager.h"
#include "ActionManager.h"
@ -260,11 +259,11 @@ private:
class AuthRequest : public ActionListener
{
public:
AuthRequest(int _uid, set<int> _gids):
AuthRequest(int _uid, int _gid):
result(false),
timeout(false),
uid(_uid),
gids(_gids),
gid(_gid),
time_out(0),
self_authorize(true)
{
@ -463,9 +462,9 @@ private:
int uid;
/**
* The user groups ID set
* The user group ID
*/
set<int> gids;
int gid;
/**
* Timeout for this request

View File

@ -57,29 +57,27 @@ public:
protected:
/* ------------------- Attributes of the Request ---------------------- */
/* ---------------------------------------------------------------------*/
/* Attributes of the Request */
/* ---------------------------------------------------------------------*/
/* -------- Dynamic (specific for a request of the same method) -------- */
struct RequestAttributes
{
int uid; /**< id of the user */
int gid; /**< id of the user's group */
int uid; /**< id of the user */
int gid; /**< id of the user's group */
string uname; /**< name of the user */
string gname; /**< name of the user's group */
string uname; /**< name of the user */
string gname; /**< name of the user's group */
set<int> group_ids; /**< set of user's group ids */
string session; /**< Session from ONE XML-RPC API */
/**
* Session token from the OpenNebula XML-RPC API
*/
string session;
/**
* Return value of the request from libxmlrpc-c
*/
xmlrpc_c::value * retval;
xmlrpc_c::value * retval; /**< Return value from libxmlrpc-c */
};
/* -------- Static (shared among request of the same method) -------- */
PoolSQL * pool; /**< Pool of objects */
string method_name; /**< The name of the XML-RPC method */

View File

@ -166,10 +166,6 @@ public:
};
~UserDelete(){};
/* -------------------------------------------------------------------- */
int drop(int oid, PoolObjectSQL * object, string& error_msg);
};
/* -------------------------------------------------------------------------- */

View File

@ -72,41 +72,6 @@ public:
string& err);
};
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class UserAddGroup : public RequestManagerUser
{
public:
UserAddGroup():
RequestManagerUser("UserAddGroup",
"Adds a new group to the user",
"A:sii"){};
~UserAddGroup(){};
int user_action(User * user,
xmlrpc_c::paramList const& _paramList,
string& err);
};
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class UserDelGroup : public RequestManagerUser
{
public:
UserDelGroup():
RequestManagerUser("UserDelGroup",
"Deletes a new group to the user",
"A:sii"){};
~UserDelGroup(){};
int user_action(User * user,
xmlrpc_c::paramList const& _paramList,
string& err);
};
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

View File

@ -18,7 +18,6 @@
#define USER_H_
#include "PoolSQL.h"
#include "ObjectCollection.h"
using namespace std;
@ -28,7 +27,7 @@ using namespace std;
/**
* The User class.
*/
class User : public PoolObjectSQL, public ObjectCollection
class User : public PoolObjectSQL
{
public:
@ -90,47 +89,6 @@ public:
**/
static int split_secret(const string secret, string& user, string& pass);
/**
* Returns a copy of the groups for the user
*/
set<int> get_groups()
{
return get_collection_copy();
};
// *************************************************************************
// Group IDs set Management
// *************************************************************************
/**
* Adds a group ID to the groups set.
*
* @param id The new id
* @return 0 on success, -1 if the ID was already in the set
*/
int add_group(int group_id)
{
return add_collection_id(group_id);
}
/**
* Deletes a group ID from the groups set.
*
* @param id The id
* @return 0 on success,
* -1 if the ID was not in the set,
* -2 if the group to delete is the main group
*/
int del_group(int group_id)
{
if( group_id == gid )
{
return -2;
}
return del_collection_id(group_id);
}
private:
// -------------------------------------------------------------------------
// Friends
@ -196,7 +154,6 @@ protected:
const string& _password,
bool _enabled):
PoolObjectSQL(id,_uname,-1,_gid,"",_gname,table),
ObjectCollection("GROUPS"),
password(_password),
enabled(_enabled){};

View File

@ -105,15 +105,14 @@ public:
* @param gid of the user if authN succeeded -1 otherwise
* @param uname of the user if authN succeeded "" otherwise
* @param gname of the group if authN succeeded "" otherwise
* @param group_ids the user groups if authN succeeded, is empty otherwise
*
* @return false if authn failed, true otherwise
*/
bool authenticate(const string& session,
int& uid,
int& gid,
string& uname,
string& gname,
set<int>& group_ids);
string& gname);
/**
* Returns whether there is a user with given username/password or not
* @param ar, an Authorization Request

View File

@ -829,14 +829,15 @@ SUNSTONE_PUBLIC_JS_FILES="src/sunstone/public/js/layout.js \
src/sunstone/public/js/opennebula.js"
SUNSTONE_PUBLIC_JS_PLUGINS_FILES="\
src/sunstone/public/js/plugins/dashboard-tab.js \
src/sunstone/public/js/plugins/hosts-tab.js \
src/sunstone/public/js/plugins/groups-tab.js \
src/sunstone/public/js/plugins/images-tab.js \
src/sunstone/public/js/plugins/templates-tab.js \
src/sunstone/public/js/plugins/users-tab.js \
src/sunstone/public/js/plugins/vms-tab.js \
src/sunstone/public/js/plugins/vnets-tab.js"
src/sunstone/public/js/plugins/dashboard-tab.js \
src/sunstone/public/js/plugins/dashboard-users-tab.js \
src/sunstone/public/js/plugins/hosts-tab.js \
src/sunstone/public/js/plugins/groups-tab.js \
src/sunstone/public/js/plugins/images-tab.js \
src/sunstone/public/js/plugins/templates-tab.js \
src/sunstone/public/js/plugins/users-tab.js \
src/sunstone/public/js/plugins/vms-tab.js \
src/sunstone/public/js/plugins/vnets-tab.js"
SUNSTONE_PUBLIC_CSS_FILES="src/sunstone/public/css/application.css \
src/sunstone/public/css/layout.css \

View File

@ -103,7 +103,7 @@ AclManager::~AclManager()
const bool AclManager::authorize(
int uid,
const set<int>& user_groups,
int gid,
AuthRequest::Object obj_type,
int obj_id,
int obj_gid,
@ -213,24 +213,17 @@ const bool AclManager::authorize(
// Look for rules that apply to each one of the user's groups
// ----------------------------------------------------------
set<int>::iterator g_it;
for (g_it = user_groups.begin(); g_it != user_groups.end(); g_it++)
user_req = AclRule::GROUP_ID | gid;
auth = match_rules(user_req,
resource_oid_req,
resource_gid_req,
resource_all_req,
rights_req,
resource_oid_mask,
resource_gid_mask);
if ( auth == true )
{
user_req = AclRule::GROUP_ID | *g_it;
auth = match_rules(user_req,
resource_oid_req,
resource_gid_req,
resource_all_req,
rights_req,
resource_oid_mask,
resource_gid_mask);
if ( auth == true )
{
return true;
}
return true;
}
oss.str("No more rules, permission not granted ");

View File

@ -79,7 +79,7 @@ void AuthRequest::add_auth(Object ob,
if (
// User is oneadmin, or is in the oneadmin group
uid == 0 ||
gids.count( GroupPool::ONEADMIN_ID ) == 1 ||
gid == GroupPool::ONEADMIN_ID ||
// User is the owner of the object, for certain operations
( owner == uid &&
@ -88,7 +88,7 @@ void AuthRequest::add_auth(Object ob,
) ||
// Object is public and user is in its group, for certain operations
( pub && ( gids.count( ob_gid ) == 1 ) &&
( pub && ( gid == ob_gid ) &&
(op == USE || op == INSTANTIATE || op == INFO ) &&
(ob == NET || ob == IMAGE || ob == TEMPLATE)
)
@ -101,7 +101,7 @@ void AuthRequest::add_auth(Object ob,
Nebula& nd = Nebula::instance();
AclManager* aclm = nd.get_aclm();
auth = aclm->authorize(uid, gids, ob, ob_id_int, ob_gid, op);
auth = aclm->authorize(uid, gid, ob, ob_id_int, ob_gid, op);
}
oss << auth; // Store the ACL authorization result in the request

View File

@ -146,8 +146,7 @@ public:
//This test needs a driver that takes more than 3 secs to AUTHENTICATE
void timeout()
{
set<int> empty_set;
AuthRequest ar(2, empty_set);
AuthRequest ar(2, 2);
ar.add_authenticate("timeout","the_pass","the_secret");
@ -163,8 +162,7 @@ public:
void authenticate()
{
set<int> empty_set;
AuthRequest ar(2, empty_set);
AuthRequest ar(2, 2);
ar.add_authenticate("the_user","the_pass","the_secret");
@ -177,8 +175,7 @@ public:
void authorize()
{
set<int> empty_set;
AuthRequest ar(2, empty_set);
AuthRequest ar(2, 2);
//OBJECT:OBJECT_ID:ACTION:OWNER:PUBLIC:CORE_RESULT
@ -238,16 +235,14 @@ public:
void self_authorize()
{
// Make all users belong to the USERS (1) group
set<int> gid_set;
gid_set.insert(1);
AuthRequest ar(2, gid_set);
AuthRequest ar1(2, gid_set);
AuthRequest ar2(3, gid_set);
AuthRequest ar3(4, gid_set);
AuthRequest ar4(2, gid_set);
AuthRequest ar5(0, gid_set);
AuthRequest ar6(0, gid_set);
AuthRequest ar(2, 1);
AuthRequest ar1(2, 1);
AuthRequest ar2(3, 1);
AuthRequest ar3(4, 1);
AuthRequest ar4(2, 1);
AuthRequest ar5(0, 1);
AuthRequest ar6(0, 1);
ar.add_auth(AuthRequest::VM,"dGhpcy",-1,AuthRequest::CREATE,2,false);
ar.add_auth(AuthRequest::NET,2,1,AuthRequest::USE,2,false);
@ -279,10 +274,8 @@ public:
void self_authenticate()
{
set<int> empty_set;
AuthRequest ar(2, empty_set);
AuthRequest ar1(2,empty_set);
AuthRequest ar(2, 2);
AuthRequest ar1(2,2);
ar.add_authenticate("the_user","the_pass","the_secret");
CPPUNIT_ASSERT(ar.plain_authenticate() == false);

View File

@ -71,6 +71,9 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
puts str % ["NAME", vm.name]
puts str % ["STATE", vm.state_str]
puts str % ["LCM_STATE", vm.lcm_state_str]
puts str % ["HOSTNAME",
vm['/VM/HISTORY_RECORDS/HISTORY[last()]/HOSTNAME']] if
%w{ACTIVE SUSPENDED}.include? vm.state_str
puts str % ["START TIME", OpenNebulaHelper.time_to_str(vm['STIME'])]
puts str % ["END TIME", OpenNebulaHelper.time_to_str(vm['ETIME'])]
value=vm['DEPLOY_ID']
@ -89,6 +92,13 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
CLIHelper.print_header(str_h1 % "VIRTUAL MACHINE TEMPLATE",false)
puts vm.template_str
if vm['/VM/HISTORY_RECORDS/HISTORY']
puts
CLIHelper.print_header(str_h1 % "VIRTUAL MACHINE HISTORY",false)
format_history(vm)
end
end
def format_pool(pool, options, top=false)
@ -123,7 +133,9 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
end
column :HOSTNAME, "Host where the VM is running", :size=>15 do |d|
d["HISTORY"]["HOSTNAME"] if d["HISTORY"]
if d['HISTORY_RECORDS'] && d['HISTORY_RECORDS']['HISTORY']
d['HISTORY_RECORDS']['HISTORY']['HOSTNAME']
end
end
column :TIME, "Time since the VM was submitted", :size=>11 do |d|
@ -142,4 +154,53 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
table.show(pool, options)
end
end
def format_history(vm)
table=CLIHelper::ShowTable.new(nil, self) do
column :SEQ, "Sequence number", :size=>4 do |d|
d["SEQ"]
end
column :HOSTNAME, "Host name", :size=>15 do |d|
d["HOSTNAME"]
end
column :REASON, "VM state change reason", :size=>6 do |d|
VirtualMachine.get_reason d["REASON"]
end
column :START, "Time when the state changed", :size=>15 do |d|
OpenNebulaHelper.time_to_str(d['STIME'])
end
column :TIME, "Total time in this state", :size=>11 do |d|
stime = Time.at(d["STIME"].to_i)
etime = d["ETIME"]=="0" ? Time.now : Time.at(d["ETIME"].to_i)
dtime = Time.at(etime-stime).getgm
"%02d %02d:%02d:%02d" % [dtime.yday-1, dtime.hour,
dtime.min, dtime.sec]
end
column :PTIME, "Prolog time for this state", :size=>11 do |d|
stime = Time.at(d["PSTIME"].to_i)
if d["PSTIME"]=="0"
etime=Time.at(0)
else
etime = d["PETIME"]=="0" ? Time.now :
Time.at(d["PETIME"].to_i)
end
dtime = Time.at(etime-stime).getgm
"%02d %02d:%02d:%02d" % [dtime.yday-1, dtime.hour,
dtime.min, dtime.sec]
end
default :SEQ, :HOSTNAME, :REASON, :START, :TIME, :PTIME
end
vm_hash=vm.to_hash
history=vm_hash['VM']['HISTORY_RECORDS']['HISTORY']
table.show(history)
end
end

View File

@ -124,30 +124,6 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
end
addgroup_desc = <<-EOT.unindent
Adds the User to a secondary group
EOT
command :addgroup, addgroup_desc, [:range, :userid_list], :groupid do
gid = args[1]
helper.perform_actions(args[0],options,"group added") do |user|
user.addgroup( gid )
end
end
delgroup_desc = <<-EOT.unindent
Removes the User from a secondary group
EOT
command :delgroup, delgroup_desc, [:range, :userid_list], :groupid do
gid = args[1]
helper.perform_actions(args[0],options,"group deleted") do |user|
user.delgroup( gid )
end
end
list_desc = <<-EOT.unindent
Lists Users in the pool
EOT

View File

@ -104,30 +104,6 @@ module OpenNebula
return rc
end
# Adds a secondary group
# gid:: _Integer_ the new group id.
# [return] nil in case of success or an Error object
def addgroup(gid)
return Error.new('ID not defined') if !@pe_id
rc = @client.call(USER_METHODS[:addgroup], @pe_id, gid)
rc = nil if !OpenNebula.is_error?(rc)
return rc
end
# Deletes a secondary group. Fails if the group is the main one
# gid:: _Integer_ the group id.
# [return] nil in case of success or an Error object
def delgroup(gid)
return Error.new('ID not defined') if !@pe_id
rc = @client.call(USER_METHODS[:delgroup], @pe_id, gid)
rc = nil if !OpenNebula.is_error?(rc)
return rc
end
# ---------------------------------------------------------------------
# Helpers to get User information
# ---------------------------------------------------------------------

View File

@ -39,8 +39,7 @@ void Request::execute(
att.uid,
att.gid,
att.uname,
att.gname,
att.group_ids) == false )
att.gname) == false )
{
failure_response(AUTHENTICATION, authenticate_error(), att);
}
@ -87,7 +86,7 @@ bool Request::basic_authorization(int oid,
object->unlock();
}
AuthRequest ar(att.uid, att.group_ids);
AuthRequest ar(att.uid, att.gid);
ar.add_auth(auth_object, oid, ogid, op, ouid, pub);

View File

@ -232,8 +232,6 @@ void RequestManager::register_xml_methods()
{
// User Methods
xmlrpc_c::methodPtr user_change_password(new UserChangePassword());
xmlrpc_c::methodPtr user_add_group(new UserAddGroup());
xmlrpc_c::methodPtr user_del_group(new UserDelGroup());
// VMTemplate Methods
xmlrpc_c::methodPtr template_instantiate(new VMTemplateInstantiate());
@ -370,8 +368,6 @@ void RequestManager::register_xml_methods()
RequestManagerRegistry.addMethod("one.user.allocate", user_allocate);
RequestManagerRegistry.addMethod("one.user.delete", user_delete);
RequestManagerRegistry.addMethod("one.user.info", user_info);
RequestManagerRegistry.addMethod("one.user.addgroup", user_add_group);
RequestManagerRegistry.addMethod("one.user.delgroup", user_del_group);
RequestManagerRegistry.addMethod("one.user.passwd", user_change_password);
RequestManagerRegistry.addMethod("one.user.chgrp", user_chown);

View File

@ -31,7 +31,7 @@ bool RequestManagerAllocate::allocate_authorization(Template * tmpl,
return true;
}
AuthRequest ar(att.uid, att.group_ids);
AuthRequest ar(att.uid, att.gid);
if ( tmpl == 0 )
{
@ -67,7 +67,7 @@ bool VirtualMachineAllocate::allocate_authorization(Template * tmpl,
return true;
}
AuthRequest ar(att.uid, att.group_ids);
AuthRequest ar(att.uid, att.gid);
string t64;

View File

@ -175,9 +175,6 @@ void UserChown::request_execute(xmlrpc_c::paramList const& paramList,
}
user->set_group(ngid,ngname);
user->add_group(ngid);
user->del_group(old_gid);
upool->update(user);

View File

@ -70,43 +70,3 @@ int ImageDelete::drop(int oid, PoolObjectSQL * object, string& error_msg)
return rc;
}
/* ------------------------------------------------------------------------- */
int UserDelete::drop(int oid, PoolObjectSQL * object, string& error_msg)
{
set<int> group_set;
User * user = static_cast<User *>(object);
group_set = user->get_groups();
int rc = pool->drop(object, error_msg);
object->unlock();
if ( rc == 0 )
{
Nebula& nd = Nebula::instance();
GroupPool * gpool = nd.get_gpool();
Group * group;
set<int>::iterator it;
for ( it = group_set.begin(); it != group_set.end(); it++ )
{
group = gpool->get(*it, true);
if( group == 0 )
{
continue;
}
group->del_user(oid);
gpool->update(group);
group->unlock();
}
}
return rc;
}

View File

@ -88,12 +88,8 @@ void RequestManagerPoolInfoFilter::request_execute(
case MINE_GROUP:
uid_filter << "uid = " << att.uid;
for ( it = att.group_ids.begin() ; it != att.group_ids.end(); it++ )
{
uid_filter << " OR gid = " << *it;
}
uid_filter << "uid = " << att.uid << " OR "
<< "gid = " << att.gid;
request_op = AuthRequest::INFO_POOL_MINE;
break;

View File

@ -70,119 +70,6 @@ int UserChangePassword::user_action(User * user,
return 0;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int UserAddGroup::user_action(User * user,
xmlrpc_c::paramList const& paramList,
string& error_str)
{
int user_id = xmlrpc_c::value_int(paramList.getInt(1));
int group_id = xmlrpc_c::value_int(paramList.getInt(2));
int rc;
rc = user->add_group(group_id);
if ( rc != 0 )
{
user->unlock();
error_str = "User is already in this group";
return rc;
}
pool->update(user);
user->unlock();
Nebula& nd = Nebula::instance();
GroupPool * gpool = nd.get_gpool();
Group * group = gpool->get(group_id, true);
if( group == 0 )
{
User * user = static_cast<User *>(pool->get(user_id,true));
if ( user != 0 )
{
user->del_group(group_id);
pool->update(user);
user->unlock();
}
error_str = "Group does not exist";
return -1;
}
group->add_user(user_id);
gpool->update(group);
group->unlock();
return 0;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int UserDelGroup::user_action(User * user,
xmlrpc_c::paramList const& paramList,
string& error_str)
{
int user_id = xmlrpc_c::value_int(paramList.getInt(1));
int group_id = xmlrpc_c::value_int(paramList.getInt(2));
int rc;
rc = user->del_group(group_id);
if ( rc != 0 )
{
user->unlock();
if ( rc == -1 )
{
error_str = "User is not part of this group";
}
else if ( rc == -2 )
{
error_str = "Can not remove main group from user";
}
else
{
error_str = "Can not remove group from user";
}
return rc;
}
pool->update(user);
user->unlock();
Nebula& nd = Nebula::instance();
GroupPool * gpool = nd.get_gpool();
Group * group = gpool->get(group_id, true);
if( group == 0 )
{
//Group does not exists, should never occur
error_str = "Can not remove user from group";
return -1;
}
group->del_user(user_id);
gpool->update(group);
group->unlock();
return 0;
}
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */

View File

@ -59,7 +59,7 @@ void VMTemplateInstantiate::request_execute(xmlrpc_c::paramList const& paramList
if ( att.uid != 0 )
{
AuthRequest ar(att.uid, att.group_ids);
AuthRequest ar(att.uid, att.gid);
ar.add_auth(auth_object, id, ogid, auth_op, ouid, false);

View File

@ -51,7 +51,7 @@ bool RequestManagerVirtualMachine::vm_authorization(int oid,
object->unlock();
AuthRequest ar(att.uid, att.group_ids);
AuthRequest ar(att.uid, att.gid);
ar.add_auth(auth_object, oid, ogid, auth_op, ouid, false);

View File

@ -18,7 +18,6 @@
#define SCHEDULER_H_
#include "Log.h"
#include "UserPoolXML.h"
#include "HostPoolXML.h"
#include "VirtualMachinePoolXML.h"
#include "SchedulerPolicy.h"
@ -50,7 +49,6 @@ protected:
int _machines_limit, int _dispatch_limit, int _host_dispatch_limit):
hpool(0),
vmpool(0),
upool(0),
acls(0),
timer(_timer),
url(_url),
@ -75,11 +73,6 @@ protected:
delete vmpool;
}
if ( upool != 0)
{
delete upool;
}
if ( acls != 0)
{
delete acls;
@ -97,7 +90,7 @@ protected:
HostPoolXML * hpool;
VirtualMachinePoolXML * vmpool;
UserPoolXML * upool;
AclXML * acls;
// ---------------------------------------------------------------

View File

@ -1,57 +0,0 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
#ifndef USER_POOL_XML_H_
#define USER_POOL_XML_H_
#include "PoolXML.h"
#include "UserXML.h"
using namespace std;
class UserPoolXML : public PoolXML
{
public:
UserPoolXML(Client* client):PoolXML(client){};
int set_up();
/**
* Gets an object from the pool
* @param oid the object unique identifier
*
* @return a pointer to the object, 0 in case of failure
*/
UserXML * get(int oid) const
{
return static_cast<UserXML *>(PoolXML::get(oid));
};
protected:
int get_suitable_nodes(vector<xmlNodePtr>& content)
{
return get_nodes("/USER_POOL/USER[ENABLED=1]", content);
};
void add_object(xmlNodePtr node);
int load_info(xmlrpc_c::value &result);
};
#endif /* HOST_POOL_XML_H_ */

View File

@ -1,63 +0,0 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
#ifndef USER_XML_H_
#define USER_XML_H_
#include "ObjectXML.h"
#include <set>
using namespace std;
class UserXML : public ObjectXML
{
public:
UserXML(const string &xml_doc):ObjectXML(xml_doc)
{
init_attributes();
};
UserXML(const xmlNodePtr node):ObjectXML(node)
{
init_attributes();
};
int get_uid()
{
return oid;
};
int get_gid()
{
return gid;
};
const set<int>& get_groups()
{
return group_ids;
};
private:
int oid;
int gid;
set<int> group_ids;
void init_attributes();
};
#endif /* USER_XML_H_ */

View File

@ -51,6 +51,11 @@ public:
return uid;
};
int get_gid() const
{
return gid;
};
/**
* Adds a new share to the map of suitable shares to start this VM
* @param hid of the selected host
@ -144,6 +149,7 @@ protected:
int oid;
int uid;
int gid;
int memory;
float cpu;

View File

@ -22,8 +22,6 @@ lib_name='scheduler_pool'
source_files=[
'AclXML.cc',
'UserPoolXML.cc',
'UserXML.cc',
'HostPoolXML.cc',
'HostXML.cc',
'VirtualMachinePoolXML.cc',

View File

@ -1,90 +0,0 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
#include "UserPoolXML.h"
int UserPoolXML::set_up()
{
ostringstream oss;
int rc;
rc = PoolXML::set_up();
if ( rc == 0 )
{
oss.str("");
oss << "Users (enabled):";
map<int,ObjectXML*>::iterator it;
for (it=objects.begin();it!=objects.end();it++)
{
oss << " " << it->first;
}
NebulaLog::log("HOST",Log::DEBUG,oss);
}
return rc;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void UserPoolXML::add_object(xmlNodePtr node)
{
if ( node == 0 || node->children == 0 )
{
NebulaLog::log("USER",Log::ERROR,
"XML Node does not represent a valid User");
return;
}
UserXML* user = new UserXML(node);
objects.insert(pair<int,ObjectXML*>(user->get_uid(), user));
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int UserPoolXML::load_info(xmlrpc_c::value &result)
{
try
{
client->call(client->get_endpoint(), // serverUrl
"one.userpool.info", // methodName
"s", // arguments format
&result, // resultP
client->get_oneauth().c_str()); // argument
return 0;
}
catch (exception const& e)
{
ostringstream oss;
oss << "Exception raised: " << e.what();
NebulaLog::log("USER", Log::ERROR, oss);
return -1;
}
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

View File

@ -1,74 +0,0 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
#include "UserXML.h"
#include <sstream>
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void UserXML::init_attributes()
{
vector<xmlNodePtr> content;
oid = atoi(((*this)["/USER/ID"] )[0].c_str() );
gid = atoi(((*this)["/USER/GID"] )[0].c_str() );
get_nodes("/USER/GROUPS",content);
if (!content.empty())
{
xmlNodePtr cur_node = 0;
istringstream iss;
int id;
for (cur_node = content[0]->children;
cur_node != 0;
cur_node = cur_node->next)
{
if ((cur_node->type == XML_ELEMENT_NODE) &&
(cur_node->children != 0) &&
((cur_node->children->type == XML_TEXT_NODE ) ||
(cur_node->children->type == XML_CDATA_SECTION_NODE)))
{
iss.clear();
iss.str(reinterpret_cast<const char *>(cur_node->children->content));
iss >> dec >> id;
if ( iss.fail() )
{
//TODO Print a warning message
break;
}
else
{
group_ids.insert(id);
}
}
else
{
//TODO Print a warning message
break;
}
}
}
free_nodes(content);
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

View File

@ -24,6 +24,7 @@ void VirtualMachineXML::init_attributes()
oid = atoi(((*this)["/VM/ID"] )[0].c_str());
uid = atoi(((*this)["/VM/UID"])[0].c_str());
gid = atoi(((*this)["/VM/GID"])[0].c_str());
result = ((*this)["/VM/TEMPLATE/MEMORY"]);
if (result.size() > 0)

View File

@ -313,15 +313,15 @@ int main(int argc, char ** argv)
const string FriendVirtualMachinePool::xmls[] =
{
" <VM> <ID> 0 </ID> <UID> 0 </UID> <NAME> vm-example </NAME> <LAST_POLL> 0 </LAST_POLL> <STATE> 1 </STATE> <LCM_STATE> 0 </LCM_STATE> <STIME> 1274087556 </STIME> <ETIME> 1274087589 </ETIME> <DEPLOY_ID/> <MEMORY> 0 </MEMORY> <CPU> 0 </CPU> <NET_TX> 0 </NET_TX> <NET_RX> 0 </NET_RX> <TEMPLATE> <CONTEXT> <HOSTNAME> vm-example </HOSTNAME> <IP_GEN> 10.0.0. </IP_GEN> <IP_PRIVATE> 10.0.0.1 </IP_PRIVATE> </CONTEXT> <CPU> 0.5 </CPU> <DISK> <READONLY> no </READONLY> <SOURCE> /local/xen/domains/etch/disk.img </SOURCE> <TARGET> sda1 </TARGET> </DISK> <DISK> <READONLY> no </READONLY> <SOURCE> /local/xen/domains/etch/swap.img </SOURCE> <TARGET> sda2 </TARGET> </DISK> <GRAPHICS> <LISTEN> 127.0.0.1 </LISTEN> <PORT> 5 </PORT> <TYPE> vnc </TYPE> </GRAPHICS> <MEMORY> 128 </MEMORY> <NAME> vm-example </NAME> <NIC> <BRIDGE> eth0 </BRIDGE> <IP> 10.0.0.1 </IP> <MAC> 00:03:0a:00:00:01 </MAC> <NETWORK> Private LAN </NETWORK> <VNID> 0 </VNID> </NIC> <OS> <INITRD> /initrd.img </INITRD> <KERNEL> /vmlinuz </KERNEL> <ROOT> sda1 </ROOT> </OS> <VMID> 0 </VMID> </TEMPLATE> <HISTORY> <SEQ> 0 </SEQ> <HOSTNAME> host16 </HOSTNAME> <HID> 15 </HID> <STIME> 1274087589 </STIME> <ETIME> 1274087589 </ETIME> <PSTIME> 1274087589 </PSTIME> <PETIME> 1274087589 </PETIME> <RSTIME> 0 </RSTIME> <RETIME> 0 </RETIME> <ESTIME> 0 </ESTIME> <EETIME> 0 </EETIME> <REASON> 1 </REASON> </HISTORY> </VM> ",
" <VM> <ID> 0 </ID> <UID> 0 </UID> <GID>2</GID> <NAME> vm-example </NAME> <LAST_POLL> 0 </LAST_POLL> <STATE> 1 </STATE> <LCM_STATE> 0 </LCM_STATE> <STIME> 1274087556 </STIME> <ETIME> 1274087589 </ETIME> <DEPLOY_ID/> <MEMORY> 0 </MEMORY> <CPU> 0 </CPU> <NET_TX> 0 </NET_TX> <NET_RX> 0 </NET_RX> <TEMPLATE> <CONTEXT> <HOSTNAME> vm-example </HOSTNAME> <IP_GEN> 10.0.0. </IP_GEN> <IP_PRIVATE> 10.0.0.1 </IP_PRIVATE> </CONTEXT> <CPU> 0.5 </CPU> <DISK> <READONLY> no </READONLY> <SOURCE> /local/xen/domains/etch/disk.img </SOURCE> <TARGET> sda1 </TARGET> </DISK> <DISK> <READONLY> no </READONLY> <SOURCE> /local/xen/domains/etch/swap.img </SOURCE> <TARGET> sda2 </TARGET> </DISK> <GRAPHICS> <LISTEN> 127.0.0.1 </LISTEN> <PORT> 5 </PORT> <TYPE> vnc </TYPE> </GRAPHICS> <MEMORY> 128 </MEMORY> <NAME> vm-example </NAME> <NIC> <BRIDGE> eth0 </BRIDGE> <IP> 10.0.0.1 </IP> <MAC> 00:03:0a:00:00:01 </MAC> <NETWORK> Private LAN </NETWORK> <VNID> 0 </VNID> </NIC> <OS> <INITRD> /initrd.img </INITRD> <KERNEL> /vmlinuz </KERNEL> <ROOT> sda1 </ROOT> </OS> <VMID> 0 </VMID> </TEMPLATE> <HISTORY> <SEQ> 0 </SEQ> <HOSTNAME> host16 </HOSTNAME> <HID> 15 </HID> <STIME> 1274087589 </STIME> <ETIME> 1274087589 </ETIME> <PSTIME> 1274087589 </PSTIME> <PETIME> 1274087589 </PETIME> <RSTIME> 0 </RSTIME> <RETIME> 0 </RETIME> <ESTIME> 0 </ESTIME> <EETIME> 0 </EETIME> <REASON> 1 </REASON> </HISTORY> </VM> ",
"<VM> <ID> 1 </ID> <UID> 0 </UID> <NAME> vm-example </NAME> <LAST_POLL> 0 </LAST_POLL> <STATE> 1 </STATE> <LCM_STATE> 0 </LCM_STATE> <STIME> 1274087557 </STIME> <ETIME> 1274087590 </ETIME> <DEPLOY_ID/> <MEMORY> 0 </MEMORY> <CPU> 0 </CPU> <NET_TX> 0 </NET_TX> <NET_RX> 0 </NET_RX> <TEMPLATE> <CONTEXT> <HOSTNAME> vm-example </HOSTNAME> <IP_GEN> 10.0.0. </IP_GEN> <IP_PRIVATE> 10.0.0.2 </IP_PRIVATE> </CONTEXT> <CPU> 0.5 </CPU> <DISK> <READONLY> no </READONLY> <SOURCE> /local/xen/domains/etch/disk.img </SOURCE> <TARGET> sda1 </TARGET> </DISK> <DISK> <READONLY> no </READONLY> <SOURCE> /local/xen/domains/etch/swap.img </SOURCE> <TARGET> sda2 </TARGET> </DISK> <GRAPHICS> <LISTEN> 127.0.0.1 </LISTEN> <PORT> 5 </PORT> <TYPE> vnc </TYPE> </GRAPHICS> <MEMORY> 128 </MEMORY> <NAME> vm-example </NAME> <NIC> <BRIDGE> eth0 </BRIDGE> <IP> 10.0.0.2 </IP> <MAC> 00:03:0a:00:00:02 </MAC> <NETWORK> Private LAN </NETWORK> <VNID> 0 </VNID> </NIC> <OS> <INITRD> /initrd.img </INITRD> <KERNEL> /vmlinuz </KERNEL> <ROOT> sda1 </ROOT> </OS> <VMID> 1 </VMID> </TEMPLATE> <HISTORY> <SEQ> 0 </SEQ> <HOSTNAME> host16 </HOSTNAME> <HID> 15 </HID> <STIME> 1274087589 </STIME> <ETIME> 1274087589 </ETIME> <PSTIME> 1274087589 </PSTIME> <PETIME> 1274087589 </PETIME> <RSTIME> 0 </RSTIME> <RETIME> 0 </RETIME> <ESTIME> 0 </ESTIME> <EETIME> 0 </EETIME> <REASON> 1 </REASON> </HISTORY> </VM> ",
"<VM> <ID> 1 </ID> <UID> 0 </UID> <GID>2</GID> <NAME> vm-example </NAME> <LAST_POLL> 0 </LAST_POLL> <STATE> 1 </STATE> <LCM_STATE> 0 </LCM_STATE> <STIME> 1274087557 </STIME> <ETIME> 1274087590 </ETIME> <DEPLOY_ID/> <MEMORY> 0 </MEMORY> <CPU> 0 </CPU> <NET_TX> 0 </NET_TX> <NET_RX> 0 </NET_RX> <TEMPLATE> <CONTEXT> <HOSTNAME> vm-example </HOSTNAME> <IP_GEN> 10.0.0. </IP_GEN> <IP_PRIVATE> 10.0.0.2 </IP_PRIVATE> </CONTEXT> <CPU> 0.5 </CPU> <DISK> <READONLY> no </READONLY> <SOURCE> /local/xen/domains/etch/disk.img </SOURCE> <TARGET> sda1 </TARGET> </DISK> <DISK> <READONLY> no </READONLY> <SOURCE> /local/xen/domains/etch/swap.img </SOURCE> <TARGET> sda2 </TARGET> </DISK> <GRAPHICS> <LISTEN> 127.0.0.1 </LISTEN> <PORT> 5 </PORT> <TYPE> vnc </TYPE> </GRAPHICS> <MEMORY> 128 </MEMORY> <NAME> vm-example </NAME> <NIC> <BRIDGE> eth0 </BRIDGE> <IP> 10.0.0.2 </IP> <MAC> 00:03:0a:00:00:02 </MAC> <NETWORK> Private LAN </NETWORK> <VNID> 0 </VNID> </NIC> <OS> <INITRD> /initrd.img </INITRD> <KERNEL> /vmlinuz </KERNEL> <ROOT> sda1 </ROOT> </OS> <VMID> 1 </VMID> </TEMPLATE> <HISTORY> <SEQ> 0 </SEQ> <HOSTNAME> host16 </HOSTNAME> <HID> 15 </HID> <STIME> 1274087589 </STIME> <ETIME> 1274087589 </ETIME> <PSTIME> 1274087589 </PSTIME> <PETIME> 1274087589 </PETIME> <RSTIME> 0 </RSTIME> <RETIME> 0 </RETIME> <ESTIME> 0 </ESTIME> <EETIME> 0 </EETIME> <REASON> 1 </REASON> </HISTORY> </VM> ",
"<VM> <ID> 2 </ID> <UID> 0 </UID> <NAME> vm-example </NAME> <LAST_POLL> 0 </LAST_POLL> <STATE> 1 </STATE> <LCM_STATE> 0 </LCM_STATE> <STIME> 1274087557 </STIME> <ETIME> 1274087590 </ETIME> <DEPLOY_ID/> <MEMORY> 0 </MEMORY> <CPU> 0 </CPU> <NET_TX> 0 </NET_TX> <NET_RX> 0 </NET_RX> <TEMPLATE> <CONTEXT> <HOSTNAME> vm-example </HOSTNAME> <IP_GEN> 10.0.0. </IP_GEN> <IP_PRIVATE> 10.0.0.3 </IP_PRIVATE> </CONTEXT> <CPU> 0.5 </CPU> <DISK> <READONLY> no </READONLY> <SOURCE> /local/xen/domains/etch/disk.img </SOURCE> <TARGET> sda1 </TARGET> </DISK> <DISK> <READONLY> no </READONLY> <SOURCE> /local/xen/domains/etch/swap.img </SOURCE> <TARGET> sda2 </TARGET> </DISK> <GRAPHICS> <LISTEN> 127.0.0.1 </LISTEN> <PORT> 5 </PORT> <TYPE> vnc </TYPE> </GRAPHICS> <MEMORY> 128 </MEMORY> <NAME> vm-example </NAME> <NIC> <BRIDGE> eth0 </BRIDGE> <IP> 10.0.0.3 </IP> <MAC> 00:03:0a:00:00:03 </MAC> <NETWORK> Private LAN </NETWORK> <VNID> 0 </VNID> </NIC> <OS> <INITRD> /initrd.img </INITRD> <KERNEL> /vmlinuz </KERNEL> <ROOT> sda1 </ROOT> </OS> <VMID> 2 </VMID> </TEMPLATE> <HISTORY> <SEQ> 0 </SEQ> <HOSTNAME> host16 </HOSTNAME> <HID> 15 </HID> <STIME> 1274087589 </STIME> <ETIME> 1274087590 </ETIME> <PSTIME> 1274087589 </PSTIME> <PETIME> 1274087590 </PETIME> <RSTIME> 0 </RSTIME> <RETIME> 0 </RETIME> <ESTIME> 0 </ESTIME> <EETIME> 0 </EETIME> <REASON> 1 </REASON> </HISTORY> </VM> "
"<VM> <ID> 2 </ID> <UID> 0 </UID> <GID> 1 </GID> <NAME> vm-example </NAME> <LAST_POLL> 0 </LAST_POLL> <STATE> 1 </STATE> <LCM_STATE> 0 </LCM_STATE> <STIME> 1274087557 </STIME> <ETIME> 1274087590 </ETIME> <DEPLOY_ID/> <MEMORY> 0 </MEMORY> <CPU> 0 </CPU> <NET_TX> 0 </NET_TX> <NET_RX> 0 </NET_RX> <TEMPLATE> <CONTEXT> <HOSTNAME> vm-example </HOSTNAME> <IP_GEN> 10.0.0. </IP_GEN> <IP_PRIVATE> 10.0.0.3 </IP_PRIVATE> </CONTEXT> <CPU> 0.5 </CPU> <DISK> <READONLY> no </READONLY> <SOURCE> /local/xen/domains/etch/disk.img </SOURCE> <TARGET> sda1 </TARGET> </DISK> <DISK> <READONLY> no </READONLY> <SOURCE> /local/xen/domains/etch/swap.img </SOURCE> <TARGET> sda2 </TARGET> </DISK> <GRAPHICS> <LISTEN> 127.0.0.1 </LISTEN> <PORT> 5 </PORT> <TYPE> vnc </TYPE> </GRAPHICS> <MEMORY> 128 </MEMORY> <NAME> vm-example </NAME> <NIC> <BRIDGE> eth0 </BRIDGE> <IP> 10.0.0.3 </IP> <MAC> 00:03:0a:00:00:03 </MAC> <NETWORK> Private LAN </NETWORK> <VNID> 0 </VNID> </NIC> <OS> <INITRD> /initrd.img </INITRD> <KERNEL> /vmlinuz </KERNEL> <ROOT> sda1 </ROOT> </OS> <VMID> 2 </VMID> </TEMPLATE> <HISTORY> <SEQ> 0 </SEQ> <HOSTNAME> host16 </HOSTNAME> <HID> 15 </HID> <STIME> 1274087589 </STIME> <ETIME> 1274087590 </ETIME> <PSTIME> 1274087589 </PSTIME> <PETIME> 1274087590 </PETIME> <RSTIME> 0 </RSTIME> <RETIME> 0 </RETIME> <ESTIME> 0 </ESTIME> <EETIME> 0 </EETIME> <REASON> 1 </REASON> </HISTORY> </VM> "
};
const string FriendVirtualMachinePool::vm_dump =
"<VM_POOL> <VM> <ID> 0 </ID> <UID> 0 </UID> <USERNAME> carlos </USERNAME> <NAME> vm-example </NAME> <LAST_POLL> 0 </LAST_POLL> <STATE> 1 </STATE> <LCM_STATE> 0 </LCM_STATE> <STIME> 1274087556 </STIME> <ETIME> 1274087589 </ETIME> <DEPLOY_ID/> <MEMORY> 0 </MEMORY> <CPU> 0 </CPU> <NET_TX> 0 </NET_TX> <NET_RX> 0 </NET_RX> <HISTORY> <SEQ> 0 </SEQ> <HOSTNAME> host16 </HOSTNAME> <HID> 15 </HID> <STIME> 1274087589 </STIME> <ETIME> 1274087589 </ETIME> <PSTIME> 1274087589 </PSTIME> <PETIME> 1274087589 </PETIME> <RSTIME> 0 </RSTIME> <RETIME> 0 </RETIME> <ESTIME> 0 </ESTIME> <EETIME> 0 </EETIME> <REASON> 1 </REASON> </HISTORY> </VM> <VM> <ID> 1 </ID> <UID> 0 </UID> <USERNAME> carlos </USERNAME> <NAME> vm-example </NAME> <LAST_POLL> 0 </LAST_POLL> <STATE> 1 </STATE> <LCM_STATE> 0 </LCM_STATE> <STIME> 1274087557 </STIME> <ETIME> 1274087590 </ETIME> <DEPLOY_ID/> <MEMORY> 0 </MEMORY> <CPU> 0 </CPU> <NET_TX> 0 </NET_TX> <NET_RX> 0 </NET_RX> <HISTORY> <SEQ> 0 </SEQ> <HOSTNAME> host16 </HOSTNAME> <HID> 15 </HID> <STIME> 1274087589 </STIME> <ETIME> 1274087589 </ETIME> <PSTIME> 1274087589 </PSTIME> <PETIME> 1274087589 </PETIME> <RSTIME> 0 </RSTIME> <RETIME> 0 </RETIME> <ESTIME> 0 </ESTIME> <EETIME> 0 </EETIME> <REASON> 1 </REASON> </HISTORY> </VM> <VM> <ID> 2 </ID> <UID> 0 </UID> <USERNAME> carlos </USERNAME> <NAME> vm-example </NAME> <LAST_POLL> 0 </LAST_POLL> <STATE> 1 </STATE> <LCM_STATE> 0 </LCM_STATE> <STIME> 1274087557 </STIME> <ETIME> 1274087590 </ETIME> <DEPLOY_ID/> <MEMORY> 0 </MEMORY> <CPU> 0 </CPU> <NET_TX> 0 </NET_TX> <NET_RX> 0 </NET_RX> <HISTORY> <SEQ> 0 </SEQ> <HOSTNAME> host16 </HOSTNAME> <HID> 15 </HID> <STIME> 1274087589 </STIME> <ETIME> 1274087590 </ETIME> <PSTIME> 1274087589 </PSTIME> <PETIME> 1274087590 </PETIME> <RSTIME> 0 </RSTIME> <RETIME> 0 </RETIME> <ESTIME> 0 </ESTIME> <EETIME> 0 </EETIME> <REASON> 1 </REASON> </HISTORY> </VM> </VM_POOL> ";
"<VM_POOL> <VM> <ID> 0 </ID> <UID> 0 </UID> <GID> 0 </GID> <USERNAME> carlos </USERNAME> <NAME> vm-example </NAME> <LAST_POLL> 0 </LAST_POLL> <STATE> 1 </STATE> <LCM_STATE> 0 </LCM_STATE> <STIME> 1274087556 </STIME> <ETIME> 1274087589 </ETIME> <DEPLOY_ID/> <MEMORY> 0 </MEMORY> <CPU> 0 </CPU> <NET_TX> 0 </NET_TX> <NET_RX> 0 </NET_RX> <HISTORY> <SEQ> 0 </SEQ> <HOSTNAME> host16 </HOSTNAME> <HID> 15 </HID> <STIME> 1274087589 </STIME> <ETIME> 1274087589 </ETIME> <PSTIME> 1274087589 </PSTIME> <PETIME> 1274087589 </PETIME> <RSTIME> 0 </RSTIME> <RETIME> 0 </RETIME> <ESTIME> 0 </ESTIME> <EETIME> 0 </EETIME> <REASON> 1 </REASON> </HISTORY> </VM> <VM> <ID> 1 </ID> <UID> 0 </UID> <GID> 0 </GID> <USERNAME> carlos </USERNAME> <NAME> vm-example </NAME> <LAST_POLL> 0 </LAST_POLL> <STATE> 1 </STATE> <LCM_STATE> 0 </LCM_STATE> <STIME> 1274087557 </STIME> <ETIME> 1274087590 </ETIME> <DEPLOY_ID/> <MEMORY> 0 </MEMORY> <CPU> 0 </CPU> <NET_TX> 0 </NET_TX> <NET_RX> 0 </NET_RX> <HISTORY> <SEQ> 0 </SEQ> <HOSTNAME> host16 </HOSTNAME> <HID> 15 </HID> <STIME> 1274087589 </STIME> <ETIME> 1274087589 </ETIME> <PSTIME> 1274087589 </PSTIME> <PETIME> 1274087589 </PETIME> <RSTIME> 0 </RSTIME> <RETIME> 0 </RETIME> <ESTIME> 0 </ESTIME> <EETIME> 0 </EETIME> <REASON> 1 </REASON> </HISTORY> </VM> <VM> <ID> 2 </ID> <UID> 0 </UID> <GID> 1 </GID> <USERNAME> carlos </USERNAME> <NAME> vm-example </NAME> <LAST_POLL> 0 </LAST_POLL> <STATE> 1 </STATE> <LCM_STATE> 0 </LCM_STATE> <STIME> 1274087557 </STIME> <ETIME> 1274087590 </ETIME> <DEPLOY_ID/> <MEMORY> 0 </MEMORY> <CPU> 0 </CPU> <NET_TX> 0 </NET_TX> <NET_RX> 0 </NET_RX> <HISTORY> <SEQ> 0 </SEQ> <HOSTNAME> host16 </HOSTNAME> <HID> 15 </HID> <STIME> 1274087589 </STIME> <ETIME> 1274087590 </ETIME> <PSTIME> 1274087589 </PSTIME> <PETIME> 1274087590 </PETIME> <RSTIME> 0 </RSTIME> <RETIME> 0 </RETIME> <ESTIME> 0 </ESTIME> <EETIME> 0 </EETIME> <REASON> 1 </REASON> </HISTORY> </VM> </VM_POOL> ";
const string FriendHostPool::xmls[] =
{

View File

@ -121,7 +121,7 @@ void Scheduler::start()
hpool = new HostPoolXML(client);
vmpool = new VirtualMachinePoolXML(client, machines_limit);
upool = new UserPoolXML(client);
acls = new AclXML(client);
// -----------------------------------------------------------
@ -230,17 +230,6 @@ int Scheduler::set_up_pools()
return rc;
}
//--------------------------------------------------------------------------
//Cleans the cache and get the users
//--------------------------------------------------------------------------
rc = upool->set_up();
if ( rc != 0 )
{
return rc;
}
//--------------------------------------------------------------------------
//Cleans the cache and get the ACLs
//--------------------------------------------------------------------------
@ -267,11 +256,15 @@ int Scheduler::set_up_pools()
void Scheduler::match()
{
VirtualMachineXML * vm;
int vm_memory;
int vm_cpu;
int vm_disk;
int uid;
string reqs;
int vm_memory;
int vm_cpu;
int vm_disk;
int uid;
int gid;
string reqs;
HostXML * host;
int host_memory;
@ -279,9 +272,6 @@ void Scheduler::match()
char * error;
bool matched;
UserXML * user;
set<int> gids;
int rc;
map<int, ObjectXML*>::const_iterator vm_it;
@ -296,7 +286,9 @@ void Scheduler::match()
vm = static_cast<VirtualMachineXML*>(vm_it->second);
reqs = vm->get_requirements();
uid = vm->get_uid();
gid = vm->get_gid();
for (h_it=hosts.begin(), matched=false; h_it != hosts.end(); h_it++)
{
@ -343,30 +335,20 @@ void Scheduler::match()
// Check if user is authorized
// -----------------------------------------------------------------
user = upool->get(uid);
matched = false;
if ( user != 0 )
if ( uid == 0 || gid == 0 )
{
const set<int> groups = user->get_groups();
if ( uid == 0 || user->get_gid() == 0 )
{
matched = true;
}
else
{
matched = acls->authorize(uid,
groups,
AuthRequest::HOST,
host->get_hid(),
-1,
AuthRequest::USE);
}
matched = true;
}
else
{
continue;
matched = acls->authorize(uid,
gid,
AuthRequest::HOST,
host->get_hid(),
-1,
AuthRequest::USE);
}
if ( matched == false )

View File

@ -4,6 +4,11 @@
:user:
:group:
oneadmin: true
- plugins/dashboard-users-tab.js:
:ALL: true
:user:
:group:
oneadmin: false
- plugins/hosts-tab.js:
:ALL: false
:user:

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
var HISTORY_LENGTH=40;
var GRAPH_AUTOREFRESH_INTERVAL=100000; //100 secs
var GRAPH_AUTOREFRESH_INTERVAL=60000; //60 secs
var graph1 = {
title : "graph1",
@ -84,8 +84,8 @@ var dashboard_tab_content =
<td class="value_td"><span id="total_images"></span><span id="public_images"></span></td>\
</tr>\
<tr>\
<td class="key_td oneadmin">Users</td>\
<td class="value_td oneadmin"><span id="total_users"></span></td>\
<td class="key_td">Users</td>\
<td class="value_td"><span id="total_users"></span></td>\
</tr>\
</table>\
\
@ -104,10 +104,9 @@ var dashboard_tab_content =
<input type="radio" name="quickstart" value="Group.create_dialog">Group</input><br />\
<input type="radio" name="quickstart" value="Template.create_dialog">VM Template</input><br />\
<input type="radio" name="quickstart" value="VM.create_dialog">VM Instance</input><br />\
<input type="radio" name="quickstart" value="Network.create_dialog">Virtual Network</input><br />\
<input type="radio" name="quickstart" value="Image.create_dialog">Image</input><br />\
<input type="radio" name="quickstart" value="User.create_dialog">User</input><br />\
</td><td>\
<button id="quickstart">Go</button></fieldset></form>\
</td></tr></table>\
</div>\
</td>\
@ -117,7 +116,7 @@ var dashboard_tab_content =
<div class="panel">\
<h3>Sunstone documentation</h3>\
<ul style="list-style-type:none;">\
<li>Sunstone installation and setup</li>\
<li><a href="http://opennebula.org/documentation:rel3.0:sunstone" target="_blank">Sunstone installation and setup</a></li>\
<li>Sunstone plugin guide</li>\
<li>Sunstone plugin reference</li>\
</ul>\
@ -209,23 +208,15 @@ function plot_global_graph(data,info){
function quickstart_setup(){
$('#quickstart').button("disable");
$('#quickstart_form input').click(function(){
$('#quickstart').val($(this).val());
$('#quickstart').button("enable");
});
$('#quickstart').click(function(){
Sunstone.runAction($(this).val());
return false;
});
}
function graph_autorefresh(){
setInterval(function(){
refresh_graphs();
},GRAPH_AUTOREFRESH_INTERVAL);
},GRAPH_AUTOREFRESH_INTERVAL+someTime());
}
@ -246,9 +237,6 @@ $(document).ready(function(){
});
emptyDashboard();
if (uid!=0) {
$("td.oneadmin").hide();
}
quickstart_setup();
@ -333,4 +321,4 @@ function updateDashboard(what,json_info){
$('#public_templates',db).html(public_templates);
break;
}
}
}

View File

@ -0,0 +1,298 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
var HISTORY_LENGTH=40;
var GRAPH_AUTOREFRESH_INTERVAL=60000; //60 secs
var graph1 = {
title : "graph1",
monitor_resources : "total,active,error",
history_length : HISTORY_LENGTH
};
var graph2 = {
title : "graph2",
monitor_resources : "cpu",
history_length : HISTORY_LENGTH
};
var graph3 = {
title : "graph3",
monitor_resources : "memory",
history_length : HISTORY_LENGTH
};
var graph4 = {
title : "graph4",
monitor_resources : "net_tx,net_rx",
history_length : HISTORY_LENGTH
};
var dashboard_tab_content =
'<table id="dashboard_table">\
<tr>\
<td style="width:40%">\
<table id="information_table">\
<tr>\
<td>\
<div class="panel">\
<h3>Summary of resources</h3>\
<div class="panel_info">\
\
<table class="info_table">\
<tr>\
<td class="key_td">VM Templates (total/public)</td>\
<td class="value_td"><span id="total_templates"></span><span id="public_templates"></span></td>\
</tr>\
<tr>\
<td class="key_td">VM Instances (total/<span class="green">running</span>/<span class="red">failed</span>)</td>\
<td class="value_td"><span id="total_vms"></span><span id="running_vms" class="green"></span><span id="failed_vms" class="red"></span></td>\
</tr>\
<tr>\
<td class="key_td">Virtual Networks (total/public)</td>\
<td class="value_td"><span id="total_vnets"></span><span id="public_vnets"></span></td>\
</tr>\
<tr>\
<td class="key_td">Images (total/public)</td>\
<td class="value_td"><span id="total_images"></span><span id="public_images"></span></td>\
</tr>\
</table>\
\
</div>\
</div>\
</td>\
</tr>\
<tr>\
<td>\
<div class="panel">\
<h3>Quickstart</h3>\
<form id="quickstart_form"><fieldset>\
<table style="width:100%;"><tr style="vertical-align:middle;"><td style="width:70%">\
<label style="font-weight:bold;width:40px;height:7em;">New:</label>\
<input type="radio" name="quickstart" value="Template.create_dialog">VM Template</input><br />\
<input type="radio" name="quickstart" value="VM.create_dialog">VM Instance</input><br />\
<input type="radio" name="quickstart" value="Network.create_dialog">Virtual Network</input><br />\
<input type="radio" name="quickstart" value="Image.create_dialog">Image</input><br />\
</td></tr></table>\
</div>\
</td>\
</tr>\
<tr>\
<td>\
<div class="panel">\
<h3>Sunstone documentation</h3>\
<ul style="list-style-type:none;">\
<li><a href="http://opennebula.org/documentation:rel3.0:sunstone" target="_blank">Sunstone installation and setup</a></li>\
<li>Sunstone plugin guide</li>\
<li>Sunstone plugin reference</li>\
</ul>\
</div>\
</td>\
</tr>\
</table>\
</td>\
<td style="width:60%">\
<table id="historical_table" style="width:100%">\
<tr>\
<td>\
<div class="panel">\
<h3>Historical monitoring information</h3>\
<div class="panel_info">\
<table class="info_table">\
<tr><td class="key_td graph_td">Total VM count</td>\
<td class="graph_td" id="graph1_legend"></td></tr>\
<tr><td id="graph1" colspan="2">'+spinner+'</td></tr>\
<tr><td class="key_td graph_td">Total VM CPU</td>\
<td class="graph_td" id="graph2_legend"></td></tr>\
<tr><td id="graph2" colspan="2">'+spinner+'</td></tr>\
<tr><td class="key_td graph_td">Total VM Memory</td>\
<td class="graph_td" id="graph3_legend"></td></tr>\
<tr><td id="graph3" colspan="2">'+spinner+'</td></tr>\
<tr><td class="key_td graph_td">VM Network stats</td>\
<td class="graph_td" id="graph4_legend"></td></tr>\
<tr><td id="graph4" colspan="2">'+spinner+'</td></tr>\
</table>\
</div>\
</div>\
</td>\
</tr>\
</table>\
</td>\
</tr></table>';
var dashboard_tab = {
title: 'Dashboard',
content: dashboard_tab_content,
condition : True
}
Sunstone.addMainTab('dashboard_tab',dashboard_tab);
function plot_global_graph(data,info){
var id = info.title;
var labels_arr = info.monitor_resources.split(',');
var serie;
var series = [];
var width = ($(window).width()-129)*45/100;
$('#'+id).html('<div id="'+id+'_graph" style="height:70px;width:'+width+'px"><div>');
for (var i = 0; i< labels_arr.length; i++) {
serie = {
label: labels_arr[i],
data: data[i]
};
series.push(serie);
};
var options = {
legend : {
show : true,
noColumns: labels_arr.length,
container: $('#'+id+'_legend')
},
xaxis : {
mode: "time",
timeformat: "%h:%M"
},
yaxis : { labelWidth: 40 }
}
switch (id){
case "graph4":
options["yaxis"]["tickFormatter"] = function(val,axis) {
return humanize_size(val);
}
}
$.plot($('#'+id+'_graph'),series,options);
}
function quickstart_setup(){
$('#quickstart_form input').click(function(){
Sunstone.runAction($(this).val());
});
}
function graph_autorefresh(){
setInterval(function(){
refresh_graphs();
},GRAPH_AUTOREFRESH_INTERVAL+someTime());
}
function refresh_graphs(){
Sunstone.runAction("VM.monitor_all", graph1);
Sunstone.runAction("VM.monitor_all", graph2);
Sunstone.runAction("VM.monitor_all", graph3);
Sunstone.runAction("VM.monitor_all", graph4);
}
$(document).ready(function(){
//Dashboard link listener
$("#dashboard_table h3 a").live("click", function (){
var tab = $(this).attr('href');
showTab(tab);
return false;
});
emptyDashboard();
quickstart_setup();
refresh_graphs();
graph_autorefresh();
});
//puts the dashboard values into "retrieving"
function emptyDashboard(){
$("#dashboard_tab .value_td span").html(spinner);
}
function updateDashboard(what,json_info){
var db = $('#dashboard_tab');
switch (what){
case "hosts":
var total_hosts=json_info.length;
var active_hosts=0;
$.each(json_info,function(){
if (parseInt(this.HOST.STATE) < 3){
active_hosts++;}
});
$('#total_hosts',db).html(total_hosts+'&nbsp;/&nbsp;');
$('#active_hosts',db).html(active_hosts);
break;
case "groups":
var total_groups=json_info.length;
$('#total_groups',db).html(total_groups);
break;
case "vms":
var total_vms=json_info.length;
var running_vms=0;
failed_vms=0;
$.each(json_info,function(){
vm_state = parseInt(this.VM.STATE);
if (vm_state == 3){
running_vms++;
}
else if (vm_state == 7) {
failed_vms++;
}
});
$('#total_vms',db).html(total_vms+'&nbsp;/&nbsp;');
$('#running_vms',db).html(running_vms+'&nbsp;/&nbsp;');
$('#failed_vms',db).html(failed_vms);
break;
case "vnets":
var public_vnets=0;
var total_vnets=json_info.length;
$.each(json_info,function(){
if (parseInt(this.VNET.PUBLIC)){
public_vnets++;}
});
$('#total_vnets',db).html(total_vnets+'&nbsp;/&nbsp;');
$('#public_vnets',db).html(public_vnets);
break;
case "users":
var total_users=json_info.length;
$('#total_users',db).html(total_users);
break;
case "images":
var total_images=json_info.length;
var public_images=0;
$.each(json_info,function(){
if (parseInt(this.IMAGE.PUBLIC)){
public_images++;}
});
$('#total_images',db).html(total_images+'&nbsp;/&nbsp;');
$('#public_images',db).html(public_images);
break;
case "templates":
var total_templates=json_info.length;
var public_templates=0;
$.each(json_info,function(){
if (parseInt(this.VMTEMPLATE.PUBLIC)){
public_templates++;
}
});
$('#total_templates',db).html(total_templates+'&nbsp;/&nbsp;');
$('#public_templates',db).html(public_templates);
break;
}
}

View File

@ -124,8 +124,6 @@ string& User::to_xml(string& xml) const
int enabled_int = enabled?1:0;
ObjectCollection::to_xml(collection_xml);
oss <<
"<USER>"
"<ID>" << oid <<"</ID>" <<
@ -134,7 +132,6 @@ string& User::to_xml(string& xml) const
"<NAME>" << name <<"</NAME>" <<
"<PASSWORD>" << password <<"</PASSWORD>"<<
"<ENABLED>" << enabled_int <<"</ENABLED>" <<
collection_xml <<
"</USER>";
xml = oss.str();
@ -163,19 +160,6 @@ int User::from_xml(const string& xml)
enabled = int_enabled;
// Get associated classes
ObjectXML::get_nodes("/USER/GROUPS", content);
if (content.empty())
{
return -1;
}
// Set of IDs
rc += ObjectCollection::from_xml_node(content[0]);
ObjectXML::free_nodes(content);
if (rc != 0)
{
return -1;

View File

@ -151,8 +151,6 @@ int UserPool::allocate (
// Build a new User object
user = new User(-1, gid, uname, gname, password, enabled);
user->add_collection_id(gid); //Adds the primary group to the collection
// Insert the Object in the pool
*oid = PoolSQL::allocate(user, error_str);
@ -200,8 +198,7 @@ bool UserPool::authenticate(const string& session,
int& user_id,
int& group_id,
string& uname,
string& gname,
set<int>& group_ids)
string& gname)
{
map<string, int>::iterator index;
@ -243,8 +240,6 @@ bool UserPool::authenticate(const string& session,
tuname = user->name;
tgname = user->gname;
group_ids = user->get_groups();
user->unlock();
}
else //External User
@ -254,7 +249,7 @@ bool UserPool::authenticate(const string& session,
gid = -1;
}
AuthRequest ar(uid, group_ids);
AuthRequest ar(uid, gid);
ar.add_authenticate(username,u_pass,secret);
@ -336,7 +331,6 @@ bool UserPool::authenticate(const string& session,
}
else
{
group_ids.insert( GroupPool::USERS_ID );
group_id = GroupPool::USERS_ID;
uname = mad_name;

View File

@ -31,10 +31,10 @@ const string usernames[] = { "A user", "B user", "C user", "D user", "E user" };
const string passwords[] = { "A pass", "B pass", "C pass", "D pass", "E pass" };
const string dump_result =
"<USER_POOL><USER><ID>0</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>one_user_test</NAME><PASSWORD>5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8</PASSWORD><ENABLED>1</ENABLED><GROUPS><ID>0</ID></GROUPS></USER><USER><ID>1</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a</NAME><PASSWORD>p</PASSWORD><ENABLED>1</ENABLED><GROUPS><ID>0</ID></GROUPS></USER><USER><ID>2</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a name</NAME><PASSWORD>pass</PASSWORD><ENABLED>1</ENABLED><GROUPS><ID>0</ID></GROUPS></USER><USER><ID>3</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a_name</NAME><PASSWORD>password</PASSWORD><ENABLED>1</ENABLED><GROUPS><ID>0</ID></GROUPS></USER><USER><ID>4</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>another name</NAME><PASSWORD>secret</PASSWORD><ENABLED>1</ENABLED><GROUPS><ID>0</ID></GROUPS></USER><USER><ID>5</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>user</NAME><PASSWORD>1234</PASSWORD><ENABLED>1</ENABLED><GROUPS><ID>0</ID></GROUPS></USER></USER_POOL>";
"<USER_POOL><USER><ID>0</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>one_user_test</NAME><PASSWORD>5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>1</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a</NAME><PASSWORD>p</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>2</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a name</NAME><PASSWORD>pass</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>3</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a_name</NAME><PASSWORD>password</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>4</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>another name</NAME><PASSWORD>secret</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>5</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>user</NAME><PASSWORD>1234</PASSWORD><ENABLED>1</ENABLED></USER></USER_POOL>";
const string dump_where_result =
"<USER_POOL><USER><ID>1</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a</NAME><PASSWORD>p</PASSWORD><ENABLED>1</ENABLED><GROUPS><ID>0</ID></GROUPS></USER><USER><ID>2</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a name</NAME><PASSWORD>pass</PASSWORD><ENABLED>1</ENABLED><GROUPS><ID>0</ID></GROUPS></USER><USER><ID>3</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a_name</NAME><PASSWORD>password</PASSWORD><ENABLED>1</ENABLED><GROUPS><ID>0</ID></GROUPS></USER><USER><ID>4</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>another name</NAME><PASSWORD>secret</PASSWORD><ENABLED>1</ENABLED><GROUPS><ID>0</ID></GROUPS></USER></USER_POOL>";
"<USER_POOL><USER><ID>1</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a</NAME><PASSWORD>p</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>2</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a name</NAME><PASSWORD>pass</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>3</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a_name</NAME><PASSWORD>password</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>4</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>another name</NAME><PASSWORD>secret</PASSWORD><ENABLED>1</ENABLED></USER></USER_POOL>";
#include "NebulaTest.h"
@ -187,14 +187,13 @@ public:
bool rc;
int oid, gid;
set<int> groups;
string uname, gname;
// There is an initial user, created with the one_auth file:
// one_user_test:password
string session="one_user_test:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8";
rc = user_pool->authenticate( session, oid, gid, uname, gname, groups );
rc = user_pool->authenticate( session, oid, gid, uname, gname);
CPPUNIT_ASSERT( rc == true );
CPPUNIT_ASSERT( oid == 0 );
CPPUNIT_ASSERT( gid == 0 );
@ -202,13 +201,13 @@ public:
CPPUNIT_ASSERT( gname == "oneadmin" );
session = "one_user_test:wrong_password";
rc = user_pool->authenticate( session, oid, gid , uname, gname, groups );
rc = user_pool->authenticate( session, oid, gid , uname, gname);
CPPUNIT_ASSERT( rc == false );
CPPUNIT_ASSERT( oid == -1 );
CPPUNIT_ASSERT( gid == -1 );
session = "unknown_user:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8";
rc = user_pool->authenticate( session, oid, gid, uname, gname, groups );
rc = user_pool->authenticate( session, oid, gid, uname, gname);
CPPUNIT_ASSERT( rc == false );
CPPUNIT_ASSERT( oid == -1 );
CPPUNIT_ASSERT( gid == -1 );