mirror of
https://github.com/OpenNebula/one.git
synced 2025-04-01 06:50:25 +03:00
Feature #1523: New xmlrpc method one.system.version added to RequestManager
This commit is contained in:
parent
033e573387
commit
6ff8972279
67
include/RequestManagerSystem.h
Normal file
67
include/RequestManagerSystem.h
Normal file
@ -0,0 +1,67 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2012, 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 REQUEST_MANAGER_SYSTEM_H
|
||||
#define REQUEST_MANAGER_SYSTEM_H
|
||||
|
||||
#include "Request.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class RequestManagerSystem: public Request
|
||||
{
|
||||
protected:
|
||||
RequestManagerSystem( const string& method_name,
|
||||
const string& help,
|
||||
const string& params)
|
||||
:Request(method_name,params,help)
|
||||
{};
|
||||
|
||||
~RequestManagerSystem(){};
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
virtual void request_execute(xmlrpc_c::paramList const& _paramList,
|
||||
RequestAttributes& att) = 0;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class SystemVersion : public RequestManagerSystem
|
||||
{
|
||||
public:
|
||||
SystemVersion():
|
||||
RequestManagerSystem("SystemVersion",
|
||||
"Returns the OpenNebula version",
|
||||
"A:s")
|
||||
{};
|
||||
|
||||
~SystemVersion(){};
|
||||
|
||||
void request_execute(xmlrpc_c::paramList const& _paramList,
|
||||
RequestAttributes& att);
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
#endif
|
@ -37,6 +37,8 @@
|
||||
#include "RequestManagerCluster.h"
|
||||
#include "RequestManagerGroup.h"
|
||||
|
||||
#include "RequestManagerSystem.h"
|
||||
|
||||
#include <sys/signal.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
@ -362,6 +364,9 @@ void RequestManager::register_xml_methods()
|
||||
xmlrpc_c::methodPtr cluster_addvnet(new ClusterAddVNet());
|
||||
xmlrpc_c::methodPtr cluster_delvnet(new ClusterDelVNet());
|
||||
|
||||
// System Methods
|
||||
xmlrpc_c::methodPtr system_version(new SystemVersion());
|
||||
|
||||
/* VM related methods */
|
||||
RequestManagerRegistry.addMethod("one.vm.deploy", vm_deploy);
|
||||
RequestManagerRegistry.addMethod("one.vm.action", vm_action);
|
||||
@ -490,6 +495,11 @@ void RequestManager::register_xml_methods()
|
||||
RequestManagerRegistry.addMethod("one.document.clone", doc_clone);
|
||||
|
||||
RequestManagerRegistry.addMethod("one.documentpool.info",docpool_info);
|
||||
|
||||
/* System related methods */
|
||||
RequestManagerRegistry.addMethod("one.system.version", system_version);
|
||||
|
||||
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
39
src/rm/RequestManagerSystem.cc
Normal file
39
src/rm/RequestManagerSystem.cc
Normal file
@ -0,0 +1,39 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2012, 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 "RequestManagerSystem.h"
|
||||
#include "Nebula.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
void SystemVersion::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
RequestAttributes& att)
|
||||
{
|
||||
// TODO: request_execute will not be executed if the session string
|
||||
// is not authenticated in Request::execute.
|
||||
// Should we make the version call accessible even
|
||||
// if no user is provided?
|
||||
|
||||
success_response(Nebula::instance().db_version(), att);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* ------------------------------------------------------------------------- */
|
@ -40,7 +40,8 @@ source_files=[
|
||||
'RequestManagerAcl.cc',
|
||||
'RequestManagerChmod.cc',
|
||||
'RequestManagerCluster.cc',
|
||||
'RequestManagerClone.cc'
|
||||
'RequestManagerClone.cc',
|
||||
'RequestManagerSystem.cc'
|
||||
]
|
||||
|
||||
# Build library
|
||||
|
Loading…
x
Reference in New Issue
Block a user