-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New method to get the pool through the xml-rpc interface. Some work t…
…o have XML format and plain text for the objects. git-svn-id: http://svn.opennebula.org/one/trunk@521 3034c82b-c49b-4eb3-8279-a7acafdc01c0
- Loading branch information
ruben
committed
May 22, 2009
1 parent
0710354
commit f7aef4a
Showing
9 changed files
with
371 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* -------------------------------------------------------------------------- */ | ||
/* Copyright 2002-2009, Distributed Systems Architecture Group, Universidad */ | ||
/* Complutense de Madrid (dsa-research.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 "RequestManager.h" | ||
#include "Nebula.h" | ||
|
||
/* -------------------------------------------------------------------------- */ | ||
/* -------------------------------------------------------------------------- */ | ||
|
||
void RequestManager::VirtualMachinePoolInfo::execute( | ||
xmlrpc_c::paramList const& paramList, | ||
xmlrpc_c::value * const retval) | ||
{ | ||
string session; | ||
|
||
// <vid> of the vid to retrieve the information for | ||
int vid, rc; | ||
|
||
ostringstream oss; | ||
|
||
/* -- RPC specific vars -- */ | ||
vector<xmlrpc_c::value> arrayData; | ||
xmlrpc_c::value_array * arrayresult; | ||
|
||
Nebula::log("ReM",Log::DEBUG,"VirtualMachinePoolInfo method invoked"); | ||
|
||
// Get the parameters | ||
//TODO the session id to validate with the SessionManager | ||
session = xmlrpc_c::value_string(paramList.getString(0)); | ||
vid = xmlrpc_c::value_int (paramList.getInt(1)); | ||
|
||
// Perform the allocation in the vmpool | ||
rc = VirtualMachinePoolInfo::vmpool->dump(oss,""); | ||
|
||
if ( rc != 0 ) | ||
{ | ||
goto error_dump; | ||
} | ||
|
||
// All nice, return the vm info to the client | ||
arrayData.push_back(xmlrpc_c::value_boolean(true)); // SUCCESS | ||
|
||
arrayData.push_back(xmlrpc_c::value_string(oss.str())); | ||
arrayresult = new xmlrpc_c::value_array(arrayData); | ||
// Copy arrayresult into retval mem space | ||
*retval = *arrayresult; | ||
// and get rid of the original | ||
delete arrayresult; | ||
|
||
return; | ||
|
||
error_dump: | ||
oss << "Error getting the pool info"; | ||
goto error_common; | ||
|
||
error_common: | ||
|
||
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE | ||
arrayData.push_back(xmlrpc_c::value_string(oss.str())); | ||
|
||
Nebula::log("ReM",Log::ERROR,oss); | ||
|
||
xmlrpc_c::value_array arrayresult_error(arrayData); | ||
|
||
*retval = arrayresult_error; | ||
|
||
return; | ||
} | ||
|
||
/* -------------------------------------------------------------------------- */ | ||
/* -------------------------------------------------------------------------- */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.