mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-26 06:50:09 +03:00
feature #212: Get rid of obsolete C/C++ interface
This commit is contained in:
parent
0b0888915a
commit
773233c1eb
@ -140,7 +140,6 @@ else:
|
||||
|
||||
# SCONS scripts to build
|
||||
build_scripts=[
|
||||
'src/client/SConstruct',
|
||||
'src/sql/SConstruct',
|
||||
'src/log/SConstruct',
|
||||
'src/common/SConstruct',
|
||||
|
17
install.sh
17
install.sh
@ -251,10 +251,10 @@ INSTALL_ETC_FILES[17]="OCCI_ETC_TEMPLATE_FILES:$ETC_LOCATION/occi_templates"
|
||||
|
||||
BIN_FILES="src/nebula/oned \
|
||||
src/scheduler/src/sched/mm_sched \
|
||||
src/client/ruby/onevm \
|
||||
src/client/ruby/onehost \
|
||||
src/client/ruby/onevnet \
|
||||
src/client/ruby/oneuser \
|
||||
src/cli/onevm \
|
||||
src/cli/onehost \
|
||||
src/cli/onevnet \
|
||||
src/cli/oneuser \
|
||||
share/scripts/one"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
@ -263,9 +263,8 @@ BIN_FILES="src/nebula/oned \
|
||||
# Library files, to be installed under $LIB_LOCATION
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
INCLUDE_FILES="include/OneClient.h"
|
||||
LIB_FILES="src/client/liboneapi.a \
|
||||
src/client/liboneapi.so"
|
||||
INCLUDE_FILES=""
|
||||
LIB_FILES=""
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Ruby library files, to be installed under $LIB_LOCATION/ruby
|
||||
@ -278,8 +277,8 @@ RUBY_LIB_FILES="src/mad/ruby/one_mad.rb \
|
||||
src/mad/ruby/CommandManager.rb \
|
||||
src/mad/ruby/OpenNebulaDriver.rb \
|
||||
src/mad/ruby/VirtualMachineDriver.rb \
|
||||
src/client/ruby/client_utilities.rb \
|
||||
src/client/ruby/command_parse.rb \
|
||||
src/cli/client_utilities.rb \
|
||||
src/cli/command_parse.rb \
|
||||
src/oca/ruby/OpenNebula.rb \
|
||||
src/tm_mad/TMScript.rb"
|
||||
|
||||
|
@ -1,487 +0,0 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2010, 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 "OneClient.h"
|
||||
#include <fstream>
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int OneClient::allocate(string template_file, int& vmid, string& error)
|
||||
{
|
||||
|
||||
try{
|
||||
|
||||
string str_template="";
|
||||
ifstream file;
|
||||
char c;
|
||||
|
||||
file.open(template_file.c_str());
|
||||
|
||||
if ( file.good() == false )
|
||||
{
|
||||
error = "Could not open file\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
file.get(c);
|
||||
|
||||
while (file.good())
|
||||
{
|
||||
str_template+=c;
|
||||
file.get(c);
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
xmlrpc_c::value result;
|
||||
|
||||
this->call(url,
|
||||
"one.vmallocate",
|
||||
"ss",
|
||||
&result,
|
||||
session.c_str(),
|
||||
str_template.c_str());
|
||||
|
||||
xmlrpc_c::value_array resultArray = xmlrpc_c::value_array(result);
|
||||
vector<xmlrpc_c::value> const
|
||||
paramArrayValue(resultArray.vectorValueValue());
|
||||
|
||||
//check posible errors
|
||||
xmlrpc_c::value_boolean const status(paramArrayValue[0]);
|
||||
|
||||
if(static_cast<bool>(status) == true)
|
||||
{
|
||||
xmlrpc_c::value_int const _vmid (paramArrayValue[1]);
|
||||
|
||||
vmid = static_cast<int>(_vmid);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlrpc_c::value_string const valueS(paramArrayValue[1]);
|
||||
|
||||
error=static_cast<string>(valueS);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (std::exception const &e)
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "XML-RPC Error: " << e.what() << endl;
|
||||
|
||||
error=oss.str();
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int OneClient::allocate_template(const string& str_template,
|
||||
int& vmid,
|
||||
string& error)
|
||||
{
|
||||
try{
|
||||
xmlrpc_c::value result;
|
||||
|
||||
this->call(url,
|
||||
"one.vmallocate",
|
||||
"ss",
|
||||
&result,
|
||||
session.c_str(),
|
||||
str_template.c_str());
|
||||
|
||||
xmlrpc_c::value_array resultArray = xmlrpc_c::value_array(result);
|
||||
vector<xmlrpc_c::value> const
|
||||
paramArrayValue(resultArray.vectorValueValue());
|
||||
|
||||
//check posible errors
|
||||
xmlrpc_c::value_boolean const status(paramArrayValue[0]);
|
||||
|
||||
if(static_cast<bool>(status) == true)
|
||||
{
|
||||
xmlrpc_c::value_int const _vmid (paramArrayValue[1]);
|
||||
|
||||
vmid = static_cast<int>(_vmid);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlrpc_c::value_string const valueS(paramArrayValue[1]);
|
||||
|
||||
error=static_cast<string>(valueS);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (std::exception const &e)
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "XML-RPC Error: " << e.what() << endl;
|
||||
|
||||
error=oss.str();
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int OneClient::deploy(int vmid, int hid, string& error)
|
||||
{
|
||||
try {
|
||||
xmlrpc_c::value result;
|
||||
|
||||
this->call(url,"one.vmdeploy","sii", &result,session.c_str(),vmid,hid);
|
||||
|
||||
xmlrpc_c::value_array resultArray = xmlrpc_c::value_array(result);
|
||||
|
||||
vector<xmlrpc_c::value> const
|
||||
paramArrayValue(resultArray.vectorValueValue());
|
||||
|
||||
//check posible errors
|
||||
xmlrpc_c::value_boolean const status(paramArrayValue[0]);
|
||||
|
||||
if(static_cast<bool>(status) == true)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlrpc_c::value_string const valueS(paramArrayValue[1]);
|
||||
|
||||
error=static_cast<string>(valueS);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (std::exception const &e)
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "XML-RPC Error: " << e.what() << endl;
|
||||
|
||||
error=oss.str();
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int OneClient::migrate(int vmid, int hid, bool live, string& error)
|
||||
{
|
||||
try {
|
||||
xmlrpc_c::value result;
|
||||
|
||||
this->call(url,
|
||||
"one.vmmigrate",
|
||||
"siib",
|
||||
&result,
|
||||
session.c_str(),
|
||||
vmid,hid,live);
|
||||
|
||||
xmlrpc_c::value_array resultArray = xmlrpc_c::value_array(result);
|
||||
vector<xmlrpc_c::value> const
|
||||
paramArrayValue(resultArray.vectorValueValue());
|
||||
|
||||
//check posible errors
|
||||
xmlrpc_c::value_boolean const status(paramArrayValue[0]);
|
||||
|
||||
if(static_cast<bool>(status) == true)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlrpc_c::value_string const valueS(paramArrayValue[1]);
|
||||
|
||||
error=static_cast<string>(valueS);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (std::exception const &e)
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "XML-RPC Error: " << e.what() << endl;
|
||||
|
||||
error=oss.str();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int OneClient::action(int vmid, const char * action, string& error)
|
||||
{
|
||||
try {
|
||||
xmlrpc_c::value result;
|
||||
|
||||
this->call(url,
|
||||
"one.vmaction",
|
||||
"ssi",
|
||||
&result,
|
||||
session.c_str(),
|
||||
action,
|
||||
vmid);
|
||||
|
||||
xmlrpc_c::value_array resultArray = xmlrpc_c::value_array(result);
|
||||
vector<xmlrpc_c::value> const
|
||||
paramArrayValue(resultArray.vectorValueValue());
|
||||
|
||||
//check posible errors
|
||||
xmlrpc_c::value_boolean const status(paramArrayValue[0]);
|
||||
|
||||
if(static_cast<bool>(status) == true)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlrpc_c::value_string const valueS(paramArrayValue[1]);
|
||||
|
||||
error=static_cast<string>(valueS);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (std::exception const &e)
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "XML-RPC Error: " << e.what() << endl;
|
||||
|
||||
error=oss.str();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int OneClient::info(int vmid, string& info, string& error)
|
||||
{
|
||||
try{
|
||||
xmlrpc_c::value result;
|
||||
this->call(url,"one.vmget_info","si",&result,session.c_str(),vmid);
|
||||
|
||||
xmlrpc_c::value_array resultArray = xmlrpc_c::value_array(result);
|
||||
vector<xmlrpc_c::value> const
|
||||
paramArrayValue(resultArray.vectorValueValue());
|
||||
|
||||
//check posible errors
|
||||
xmlrpc_c::value_boolean const status(paramArrayValue[0]);
|
||||
|
||||
xmlrpc_c::value_string const valueS(paramArrayValue[1]);
|
||||
|
||||
if(static_cast<bool>(status) == true)
|
||||
{
|
||||
info = static_cast<string>(valueS);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
error = static_cast<string>(valueS);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (std::exception const &e)
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "XML-RPC Error: " << e.what() << endl;
|
||||
|
||||
error=oss.str();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int OneClient::host_info(int hid, string& info, string& error)
|
||||
{
|
||||
try{
|
||||
xmlrpc_c::value result;
|
||||
this->call(url,"one.hostinfo","si",&result,session.c_str(),hid);
|
||||
|
||||
xmlrpc_c::value_array resultArray = xmlrpc_c::value_array(result);
|
||||
vector<xmlrpc_c::value> const
|
||||
paramArrayValue(resultArray.vectorValueValue());
|
||||
|
||||
//check posible Errors:
|
||||
xmlrpc_c::value_boolean const status(paramArrayValue[0]);
|
||||
|
||||
xmlrpc_c::value_string const valueS (paramArrayValue[1]);
|
||||
|
||||
if(static_cast<bool>(status) == true)
|
||||
{
|
||||
info = static_cast<string>(valueS);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
error = static_cast<string>(valueS);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (std::exception const &e)
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "XML-RPC Error: " << e.what() << endl;
|
||||
|
||||
error=oss.str();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int OneClient::host_delete(int hid, string& error)
|
||||
{
|
||||
try {
|
||||
xmlrpc_c::value result;
|
||||
this->call(url, "one.hostdelete", "si", &result,session.c_str(), hid);
|
||||
|
||||
xmlrpc_c::value_array resultArray = xmlrpc_c::value_array(result);
|
||||
vector<xmlrpc_c::value> const
|
||||
paramArrayValue(resultArray.vectorValueValue());
|
||||
|
||||
//check posible errors
|
||||
xmlrpc_c::value_boolean const status(paramArrayValue[0]);
|
||||
|
||||
if(static_cast<bool>(status) == true)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlrpc_c::value_string const valueS(paramArrayValue[1]);
|
||||
|
||||
error=static_cast<string>(valueS);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (std::exception const &e)
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "XML-RPC Error: " << e.what() << endl;
|
||||
|
||||
error=oss.str();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int OneClient::host_available(int hid, bool enable, string& error)
|
||||
{
|
||||
|
||||
try{
|
||||
xmlrpc_c::value result;
|
||||
this->call(url,
|
||||
"one.hostenable",
|
||||
"sib",
|
||||
&result,
|
||||
session.c_str(),
|
||||
hid,
|
||||
enable);
|
||||
|
||||
xmlrpc_c::value_array resultArray = xmlrpc_c::value_array(result);
|
||||
vector<xmlrpc_c::value> const
|
||||
paramArrayValue(resultArray.vectorValueValue());
|
||||
|
||||
//check posible errors
|
||||
xmlrpc_c::value_boolean const status(paramArrayValue[0]);
|
||||
|
||||
if(static_cast<bool>(status) == true)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlrpc_c::value_string const valueS(paramArrayValue[1]);
|
||||
|
||||
error=static_cast<string>(valueS);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (std::exception const &e)
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "XML-RPC Error: " << e.what() << endl;
|
||||
|
||||
error=oss.str();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int OneClient::host_allocate(string& name,
|
||||
string& im_mad,
|
||||
string& vmm_mad,
|
||||
int& hid,
|
||||
string& error)
|
||||
{
|
||||
|
||||
try{
|
||||
xmlrpc_c::value result;
|
||||
this->call(url,
|
||||
"one.hostallocate",
|
||||
"sssssb",
|
||||
&result,
|
||||
session.c_str(),
|
||||
name.c_str(),
|
||||
im_mad.c_str(),
|
||||
vmm_mad.c_str(),
|
||||
"tm_mad",
|
||||
true);
|
||||
|
||||
xmlrpc_c::value_array resultArray = xmlrpc_c::value_array(result);
|
||||
vector<xmlrpc_c::value> const
|
||||
paramArrayValue(resultArray.vectorValueValue());
|
||||
|
||||
//check posible errors:
|
||||
xmlrpc_c::value_boolean const status(paramArrayValue[0]);
|
||||
|
||||
if (static_cast<bool>(status) == true)
|
||||
{
|
||||
xmlrpc_c::value_int const valueI (paramArrayValue[1]);
|
||||
|
||||
hid = static_cast<int>(valueI);
|
||||
return 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlrpc_c::value_string const valueS = (paramArrayValue[1]);
|
||||
|
||||
error=static_cast<string>(valueS);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (std::exception const &e)
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "XML-RPC Error: " << e.what() << endl;
|
||||
|
||||
error=oss.str();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -1,263 +0,0 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2010, 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 "OneClient.h"
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
using namespace std;
|
||||
|
||||
/* ************************************************************************** */
|
||||
#define ONED_PORT 60222
|
||||
OneClient* client=0;
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
void c_oneStart()
|
||||
{
|
||||
#ifdef ONED_PORT
|
||||
client=new OneClient("localhost",ONED_PORT);
|
||||
#else
|
||||
client=new OneClient("localhost");
|
||||
#endif
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void c_oneFree()
|
||||
{
|
||||
if(client)
|
||||
delete client;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int c_oneDeploy(int vmid, int hid)
|
||||
{
|
||||
string info;
|
||||
|
||||
if(!client)
|
||||
return -1;
|
||||
|
||||
if(client->deploy(vmid,hid,info) <0)
|
||||
{
|
||||
cerr<<info<<endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int c_oneMigrate(int vmid, int hid, int flag)
|
||||
{
|
||||
string info;
|
||||
|
||||
if (!client)
|
||||
return -1;
|
||||
|
||||
if(client->migrate(vmid,hid,(bool)flag,info) <0)
|
||||
{
|
||||
cerr<<info<<endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int c_oneAllocate(char* vm_template)
|
||||
{
|
||||
string info;
|
||||
string template_file(vm_template);
|
||||
|
||||
int vmid;
|
||||
|
||||
if (!client)
|
||||
return -1;
|
||||
|
||||
if( (client->allocate(template_file,vmid, info)) <0)
|
||||
{
|
||||
cerr<<info<<endl;
|
||||
return -1;
|
||||
}
|
||||
return vmid;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int c_oneAllocateTemplate(char* vm_template)
|
||||
{
|
||||
string info;
|
||||
string template_str(vm_template);
|
||||
|
||||
int vmid;
|
||||
|
||||
if (!client)
|
||||
return -1;
|
||||
|
||||
if( (client->allocate_template(template_str,vmid, info)) <0)
|
||||
{
|
||||
cerr<<info<<endl;
|
||||
return -1;
|
||||
}
|
||||
return vmid;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int c_oneShutdown(int vmid)
|
||||
{
|
||||
string info;
|
||||
|
||||
if (!client)
|
||||
return -1;
|
||||
|
||||
if(client->shutdown(vmid,info) <0)
|
||||
{
|
||||
cerr<<info<<endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int c_oneSuspend(int vmid)
|
||||
{
|
||||
string info;
|
||||
|
||||
if (!client)
|
||||
return -1;
|
||||
|
||||
if (client->suspend(vmid,info) <0)
|
||||
{
|
||||
cerr<<info<<endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int c_oneStop(int vmid)
|
||||
{
|
||||
string info;
|
||||
|
||||
if (!client)
|
||||
return -1;
|
||||
|
||||
if (client->stop(vmid,info) <0)
|
||||
{
|
||||
cerr<<info<<endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int c_oneResume(int vmid)
|
||||
{
|
||||
string info;
|
||||
|
||||
if (!client)
|
||||
return -1;
|
||||
|
||||
if( client->resume(vmid,info) <0)
|
||||
{
|
||||
cerr<<info<<endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int c_oneCancel(int vmid)
|
||||
{
|
||||
string info;
|
||||
|
||||
if (!client)
|
||||
return -1;
|
||||
|
||||
if( client->cancel(vmid,info) <0)
|
||||
{
|
||||
cerr<<info<<endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int c_oneFinalize(int vmid)
|
||||
{
|
||||
string info;
|
||||
|
||||
if (!client)
|
||||
return -1;
|
||||
|
||||
if( client->finalize(vmid,info) <0)
|
||||
{
|
||||
cerr<<info<<endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int c_oneVmInfo(int vmid, char* ret_info,int leng)
|
||||
{
|
||||
string info;
|
||||
string error;
|
||||
|
||||
if (!client || !ret_info)
|
||||
return -1;
|
||||
|
||||
if(client->info(vmid,info,error) <0)
|
||||
{
|
||||
cerr<<error<<endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
strncpy(ret_info,info.c_str(),leng-1);
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
@ -1,35 +0,0 @@
|
||||
# SConstruct for src/mad
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, 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. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
Import('env')
|
||||
|
||||
lib_name='oneapi'
|
||||
|
||||
# Sources to generate the library
|
||||
source_files=[
|
||||
'OneClient.cc',
|
||||
'OneClient_C_Wrapper.cc'
|
||||
]
|
||||
|
||||
# Compiling flags
|
||||
env.Append(CPPFLAGS=["-fPIC"])
|
||||
|
||||
# Build library
|
||||
env.StaticLibrary(lib_name, source_files)
|
||||
env.SharedLibrary(lib_name, source_files)
|
||||
|
Loading…
x
Reference in New Issue
Block a user