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

Merge branch 'feature-1544'

This commit is contained in:
Ruben S. Montero 2012-11-15 16:31:44 +01:00
commit 0ba2a68582
6 changed files with 59 additions and 0 deletions

View File

@ -305,6 +305,12 @@ public:
nebula_configuration->Template::get(_name,value);
};
string get_configuration_xml() const
{
string xml;
return nebula_configuration->to_xml(xml);
};
private:
// -----------------------------------------------------------------------

View File

@ -60,6 +60,24 @@ public:
RequestAttributes& att);
};
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class SystemConfig : public RequestManagerSystem
{
public:
SystemConfig():
RequestManagerSystem("SystemConfig",
"Returns the OpenNebula configuration",
"A:s")
{};
~SystemConfig(){};
void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att);
};
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

View File

@ -129,6 +129,16 @@ public class Client{
return call("system.version");
}
/**
* Calls OpenNebula and retrieves oned configuration
*
* @return The server's xml-rpc response encapsulated
*/
public OneResponse get_config()
{
return call("system.config");
}
//--------------------------------------------------------------------------
// PRIVATE ATTRIBUTES AND METHODS
//--------------------------------------------------------------------------

View File

@ -171,5 +171,9 @@ module OpenNebula
def get_version()
call("system.version")
end
def get_config()
call("system.config")
end
end
end

View File

@ -366,6 +366,7 @@ void RequestManager::register_xml_methods()
// System Methods
xmlrpc_c::methodPtr system_version(new SystemVersion());
xmlrpc_c::methodPtr system_config(new SystemConfig());
/* VM related methods */
RequestManagerRegistry.addMethod("one.vm.deploy", vm_deploy);
@ -498,6 +499,7 @@ void RequestManager::register_xml_methods()
/* System related methods */
RequestManagerRegistry.addMethod("one.system.version", system_version);
RequestManagerRegistry.addMethod("one.system.config", system_config);
};

View File

@ -37,3 +37,22 @@ void SystemVersion::request_execute(xmlrpc_c::paramList const& paramList,
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
void SystemConfig::request_execute(xmlrpc_c::paramList const& paramList,
RequestAttributes& att)
{
if ( att.gid != GroupPool::ONEADMIN_ID )
{
failure_response(AUTHORIZATION,
"The oned configuration can only be retrieved by users in the oneadmin group",
att);
return;
}
success_response(Nebula::instance().get_configuration_xml(), att);
return;
}
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */