mirror of
https://github.com/OpenNebula/one.git
synced 2025-04-02 10:50:07 +03:00
This commit is contained in:
parent
ecf81e38bd
commit
a4c29cc34e
@ -636,7 +636,6 @@ public:
|
||||
int pool_allocate(xmlrpc_c::paramList const& _paramList,
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att);
|
||||
};
|
||||
|
||||
|
@ -496,7 +496,6 @@ void Nebula::start(bool bootstrap_only)
|
||||
zonepool= new ZonePool(db, is_federation_slave());
|
||||
vdcpool = new VdcPool(db, is_federation_slave());
|
||||
|
||||
vrouterpool = new VirtualRouterPool(db);
|
||||
marketpool = new MarketPlacePool(db);
|
||||
apppool = new MarketPlaceAppPool(db);
|
||||
|
||||
|
@ -703,124 +703,6 @@ void Request::success_response(bool val, RequestAttributes& att)
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
string Request::object_name(PoolObjectSQL::ObjectType ob)
|
||||
{
|
||||
switch (ob)
|
||||
{
|
||||
case PoolObjectSQL::VM:
|
||||
return "virtual machine";
|
||||
case PoolObjectSQL::HOST:
|
||||
return "host";
|
||||
case PoolObjectSQL::NET:
|
||||
return "virtual network";
|
||||
case PoolObjectSQL::IMAGE:
|
||||
return "image";
|
||||
case PoolObjectSQL::USER:
|
||||
return "user";
|
||||
case PoolObjectSQL::TEMPLATE:
|
||||
return "virtual machine template";
|
||||
case PoolObjectSQL::GROUP:
|
||||
return "group";
|
||||
case PoolObjectSQL::ACL:
|
||||
return "ACL";
|
||||
case PoolObjectSQL::DATASTORE:
|
||||
return "datastore";
|
||||
case PoolObjectSQL::CLUSTER:
|
||||
return "cluster";
|
||||
case PoolObjectSQL::DOCUMENT:
|
||||
return "document";
|
||||
case PoolObjectSQL::ZONE:
|
||||
return "zone";
|
||||
case PoolObjectSQL::SECGROUP:
|
||||
return "security group";
|
||||
case PoolObjectSQL::VDC:
|
||||
return "VDC";
|
||||
case PoolObjectSQL::VROUTER:
|
||||
return "virtual router";
|
||||
case PoolObjectSQL::MARKETPLACE:
|
||||
return "marketplace";
|
||||
case PoolObjectSQL::MARKETPLACEAPP:
|
||||
return "marketplaceapp";
|
||||
}
|
||||
|
||||
return "unknown";
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
string Request::authorization_error (const string &message,
|
||||
RequestAttributes& att)
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "[" << method_name << "]" << " User [" << att.uid << "] ";
|
||||
|
||||
if ( message.empty() )
|
||||
{
|
||||
oss << "not authorized to perform action on "
|
||||
<< object_name(auth_object) << ".";
|
||||
}
|
||||
else
|
||||
{
|
||||
oss << ": " << message << ".";
|
||||
}
|
||||
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
string Request::authenticate_error()
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "[" << method_name << "]" << " User couldn't be authenticated," <<
|
||||
" aborting call.";
|
||||
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
string Request::get_error (const string &object,
|
||||
int id)
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "[" << method_name << "]" << " Error getting " <<
|
||||
object;
|
||||
|
||||
if ( id != -1 )
|
||||
{
|
||||
oss << " [" << id << "].";
|
||||
}
|
||||
else
|
||||
{
|
||||
oss << " Pool.";
|
||||
}
|
||||
|
||||
return oss.str();
|
||||
}
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
string Request::request_error (const string &err_desc, const string &err_detail)
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "[" << method_name << "] " << err_desc;
|
||||
|
||||
if (!err_detail.empty())
|
||||
{
|
||||
oss << ". " << err_detail;
|
||||
}
|
||||
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int Request::get_info(
|
||||
PoolSQL * pool,
|
||||
int id,
|
||||
|
@ -434,9 +434,9 @@ void ImageAllocate::request_execute(xmlrpc_c::paramList const& params,
|
||||
|
||||
if ( iss.fail() )
|
||||
{
|
||||
failure_response(INTERNAL,
|
||||
request_error("Cannot parse SIZE", size_str),
|
||||
att);
|
||||
att.resp_msg = "Cannot parse image SIZE: " + size_str;
|
||||
failure_response(INTERNAL, att);
|
||||
|
||||
delete tmpl;
|
||||
return;
|
||||
}
|
||||
@ -856,14 +856,13 @@ int MarketPlaceAllocate::pool_allocate(
|
||||
xmlrpc_c::paramList const& paramList,
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att)
|
||||
{
|
||||
MarketPlacePool * mppool = static_cast<MarketPlacePool *>(pool);
|
||||
MarketPlaceTemplate * ttmpl = static_cast<MarketPlaceTemplate *>(tmpl);
|
||||
|
||||
return mppool->allocate(att.uid, att.gid, att.uname, att.gname, att.umask,
|
||||
ttmpl, &id, error_str);
|
||||
ttmpl, &id, att.resp_msg);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -27,7 +27,6 @@ void MarketPlaceAppEnable::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
int rc;
|
||||
|
||||
MarketPlaceApp * app;
|
||||
std::string err_msg;
|
||||
|
||||
if ( basic_authorization(id, att) == false )
|
||||
{
|
||||
@ -38,15 +37,16 @@ void MarketPlaceAppEnable::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
|
||||
if ( app == 0 )
|
||||
{
|
||||
failure_response(NO_EXISTS,get_error(object_name(auth_object),id),att);
|
||||
att.resp_id = id;
|
||||
failure_response(NO_EXISTS, att);
|
||||
return;
|
||||
}
|
||||
|
||||
rc = app->enable(enable_flag, err_msg);
|
||||
rc = app->enable(enable_flag, att.resp_msg);
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
failure_response(INTERNAL, request_error(err_msg,""), att);
|
||||
failure_response(INTERNAL, att);
|
||||
|
||||
app->unlock();
|
||||
return;
|
||||
|
@ -47,8 +47,8 @@ source_files=[
|
||||
'RequestManagerVdc.cc',
|
||||
'RequestManagerDatastore.cc',
|
||||
'RequestManagerLock.cc',
|
||||
'RequestManagerMarketPlaceApp.cc'
|
||||
'RequestManagerVirtualRouter.cc',
|
||||
'RequestManagerMarketPlaceApp.cc',
|
||||
'RequestManagerVirtualRouter.cc'
|
||||
]
|
||||
|
||||
# Build library
|
||||
|
Loading…
x
Reference in New Issue
Block a user