1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-20 10:50:08 +03:00

Merge branch 'master' of git.opennebula.org:one

This commit is contained in:
Daniel Molina 2011-12-13 14:23:05 +01:00
commit 763f1d0cca
9 changed files with 60 additions and 56 deletions

View File

@ -959,6 +959,7 @@ OCCI_ETC_TEMPLATE_FILES="src/cloud/occi/etc/templates/common.erb \
src/cloud/occi/etc/templates/custom.erb \
src/cloud/occi/etc/templates/small.erb \
src/cloud/occi/etc/templates/medium.erb \
src/cloud/occi/etc/templates/network.erb \
src/cloud/occi/etc/templates/large.erb"
#-----------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
require 'pp'
DEFAULT=%w{optional sunstone quota cloud ozones_server acct}
DEFAULT=%w{optional sunstone quota cloud ozones_server acct auth_ldap}
if defined?(RUBY_VERSION) && RUBY_VERSION>="1.8.7"
SQLITE='sqlite3'
@ -31,11 +31,16 @@ GROUPS={
:ozones_server_mysql => %w{json data_mapper dm-mysql-adapter mysql},
:acct => ['sequel', SQLITE, 'mysql'],
:acct_sqlite => ['sequel', SQLITE],
:acct_mysql => ['sequel', 'mysql']
:acct_mysql => ['sequel', 'mysql'],
:auth_ldap => 'net-ldap'
}
PACKAGES=GROUPS.keys
GEM_TEST={
'net-ldap' => 'net/ldap'
}
DISTRIBUTIONS={
:debian => {
:id => ['Ubuntu', 'Debian'],
@ -95,8 +100,14 @@ def installed_gems
end
def try_library(name, error_message)
if GEM_TEST[name.to_s]
lib_test=GEM_TEST[name.to_s]
else
lib_test=name.to_s
end
begin
require name.to_s
require lib_test
rescue LoadError, Exception
STDERR.puts error_message
exit(-1)

View File

@ -146,7 +146,6 @@ void get_image_attribute(VirtualMachine * vm,
ImagePool * ipool = nd.get_ipool();
Image * img;
int iid = -1;
string iid_str;
int num;
vector<const Attribute *> attrs;
@ -154,7 +153,7 @@ void get_image_attribute(VirtualMachine * vm,
attr_value.clear();
if (img_name.empty() || img_name != "IMAGE_ID")
if ( img_name.empty() || (img_name!="IMAGE" && img_name!="IMAGE_ID") )
{
return;
}
@ -174,11 +173,10 @@ void get_image_attribute(VirtualMachine * vm,
continue;
}
iid_str = disk->vector_value("IMAGE_ID");
if ( iid_str == img_value )
if ( disk->vector_value(img_name.c_str()) == img_value )
{
istringstream iss(img_value);
string iid_str = disk->vector_value("IMAGE_ID");
istringstream iss(iid_str);
iss >> iid;
@ -232,7 +230,6 @@ void get_network_attribute(VirtualMachine * vm,
VirtualNetworkPool * vnpool = nd.get_vnpool();
VirtualNetwork * vn;
int vnet_id = -1;
string vnet_id_str;
int num;
vector<const Attribute *> attrs;
@ -240,7 +237,7 @@ void get_network_attribute(VirtualMachine * vm,
attr_value.clear();
if (net_name.empty() || net_name != "NETWORK_ID")
if ( net_name.empty() || (net_name!="NETWORK" && net_name!="NETWORK_ID") )
{
return;
}
@ -260,11 +257,10 @@ void get_network_attribute(VirtualMachine * vm,
continue;
}
vnet_id_str = net->vector_value("NETWORK_ID");
if ( vnet_id_str == net_value )
if ( net->vector_value(net_name.c_str()) == net_value )
{
istringstream iss(net_value);
string vnet_id_str = net->vector_value("NETWORK_ID");
istringstream iss(vnet_id_str);
iss >> vnet_id;
@ -460,7 +456,7 @@ void insert_vector(VirtualMachine * vm,
/* Line 268 of yacc.c */
#line 464 "vm_var_syntax.cc"
#line 460 "vm_var_syntax.cc"
/* Enabling traces. */
#ifndef YYDEBUG
@ -506,7 +502,7 @@ typedef union YYSTYPE
{
/* Line 293 of yacc.c */
#line 408 "vm_var_syntax.y"
#line 404 "vm_var_syntax.y"
char * val_str;
int val_int;
@ -515,7 +511,7 @@ typedef union YYSTYPE
/* Line 293 of yacc.c */
#line 519 "vm_var_syntax.cc"
#line 515 "vm_var_syntax.cc"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@ -540,7 +536,7 @@ typedef struct YYLTYPE
/* Line 343 of yacc.c */
#line 544 "vm_var_syntax.cc"
#line 540 "vm_var_syntax.cc"
#ifdef short
# undef short
@ -830,7 +826,7 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 432, 432, 433, 436, 440, 453, 468
0, 428, 428, 429, 432, 436, 449, 464
};
#endif
@ -1831,7 +1827,7 @@ yyreduce:
case 4:
/* Line 1806 of yacc.c */
#line 437 "vm_var_syntax.y"
#line 433 "vm_var_syntax.y"
{
(*parsed) << (yyvsp[(1) - (1)].val_str);
}
@ -1840,7 +1836,7 @@ yyreduce:
case 5:
/* Line 1806 of yacc.c */
#line 441 "vm_var_syntax.y"
#line 437 "vm_var_syntax.y"
{
string name((yyvsp[(1) - (2)].val_str));
@ -1858,7 +1854,7 @@ yyreduce:
case 6:
/* Line 1806 of yacc.c */
#line 454 "vm_var_syntax.y"
#line 450 "vm_var_syntax.y"
{
string name((yyvsp[(1) - (5)].val_str));
string vname((yyvsp[(3) - (5)].val_str));
@ -1878,7 +1874,7 @@ yyreduce:
case 7:
/* Line 1806 of yacc.c */
#line 469 "vm_var_syntax.y"
#line 465 "vm_var_syntax.y"
{
string name((yyvsp[(1) - (9)].val_str));
string vname((yyvsp[(3) - (9)].val_str));
@ -1901,7 +1897,7 @@ yyreduce:
/* Line 1806 of yacc.c */
#line 1905 "vm_var_syntax.cc"
#line 1901 "vm_var_syntax.cc"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@ -2139,7 +2135,7 @@ yyreturn:
/* Line 2067 of yacc.c */
#line 487 "vm_var_syntax.y"
#line 483 "vm_var_syntax.y"
extern "C" void vm_var__error(

View File

@ -56,7 +56,7 @@ typedef union YYSTYPE
{
/* Line 2068 of yacc.c */
#line 408 "vm_var_syntax.y"
#line 404 "vm_var_syntax.y"
char * val_str;
int val_int;

View File

@ -85,7 +85,6 @@ void get_image_attribute(VirtualMachine * vm,
ImagePool * ipool = nd.get_ipool();
Image * img;
int iid = -1;
string iid_str;
int num;
vector<const Attribute *> attrs;
@ -93,7 +92,7 @@ void get_image_attribute(VirtualMachine * vm,
attr_value.clear();
if (img_name.empty() || img_name != "IMAGE_ID")
if ( img_name.empty() || (img_name!="IMAGE" && img_name!="IMAGE_ID") )
{
return;
}
@ -113,11 +112,10 @@ void get_image_attribute(VirtualMachine * vm,
continue;
}
iid_str = disk->vector_value("IMAGE_ID");
if ( iid_str == img_value )
if ( disk->vector_value(img_name.c_str()) == img_value )
{
istringstream iss(img_value);
string iid_str = disk->vector_value("IMAGE_ID");
istringstream iss(iid_str);
iss >> iid;
@ -171,7 +169,6 @@ void get_network_attribute(VirtualMachine * vm,
VirtualNetworkPool * vnpool = nd.get_vnpool();
VirtualNetwork * vn;
int vnet_id = -1;
string vnet_id_str;
int num;
vector<const Attribute *> attrs;
@ -179,7 +176,7 @@ void get_network_attribute(VirtualMachine * vm,
attr_value.clear();
if (net_name.empty() || net_name != "NETWORK_ID")
if ( net_name.empty() || (net_name!="NETWORK" && net_name!="NETWORK_ID") )
{
return;
}
@ -199,11 +196,10 @@ void get_network_attribute(VirtualMachine * vm,
continue;
}
vnet_id_str = net->vector_value("NETWORK_ID");
if ( vnet_id_str == net_value )
if ( net->vector_value(net_name.c_str()) == net_value )
{
istringstream iss(net_value);
string vnet_id_str = net->vector_value("NETWORK_ID");
istringstream iss(vnet_id_str);
iss >> vnet_id;

View File

@ -72,16 +72,14 @@ class VmmAction
@vnm_src = VirtualNetworkDriver.new(@data[:net_drv],
:local_actions => @vmm.options[:local_actions],
:message => @xml_data,
:ssh_stream => @ssh_src,
:extra_data => @data)
:ssh_stream => @ssh_src)
if @data[:dest_host] and !@data[:dest_host].empty?
@ssh_dst = @vmm.get_ssh_stream(@data[:dest_host], @id)
@vnm_dst = VirtualNetworkDriver.new(@data[:dest_driver],
:local_actions => @vmm.options[:local_actions],
:message => @xml_data,
:ssh_stream => @ssh_dst,
:extra_data => @data)
:ssh_stream => @ssh_dst)
end
end
@ -149,7 +147,8 @@ class VmmAction
vnm = @vnm_src
end
result, info = vnm.do_action(@id, step[:action])
result, info = vnm.do_action(@id, step[:action],
:parameters => get_parameters(step[:parameters]))
else
result = DriverExecHelper.const_get(:RESULT)[:failure]
info = "No driver in #{step[:action]}"
@ -157,7 +156,6 @@ class VmmAction
# Save the step info
@data["#{step[:action]}_info".to_sym] = info
@data[step[:save_info_as]] = info if step[:save_info_as]
# Roll back steps, store failed info and break steps
if DriverExecHelper.failed?(result)
@ -280,12 +278,12 @@ class ExecDriver < VirtualMachineDriver
:action => :deploy,
:parameters => [dfile, :host],
:stdin => domain,
:save_info_as => :deploy_id
},
# Execute post-boot networking setup
{
:driver => :vnm,
:action => :post,
:parameters => [:deploy_info],
:fail_actions => [
{
:driver => :vmm,
@ -391,6 +389,7 @@ class ExecDriver < VirtualMachineDriver
{
:driver => :vnm,
:action => :post,
:parameters => [:deploy_id],
:fail_actions => [
{
:driver => :vmm,
@ -432,6 +431,7 @@ class ExecDriver < VirtualMachineDriver
{
:driver => :vnm,
:action => :post,
:parameters => [:deploy_id],
:destination => :true
#TODO :fail_action what to do here? cancel VM?
},
@ -448,7 +448,7 @@ class ExecDriver < VirtualMachineDriver
host = data.elements['HOST'].text
deploy_id = data.elements['DEPLOY_ID'].text
do_action("#{deploy_id} #{host}", id, host, :poll)
do_action("#{deploy_id} #{host}", id, host, ACTION[:poll])
end
end
@ -496,5 +496,3 @@ exec_driver = ExecDriver.new(hypervisor,
:local_actions => local_actions)
exec_driver.start_driver

View File

@ -37,7 +37,7 @@ output=`$XM_CREATE $domain`
error_exit $? "Unable to create domain"
domain_name=`echo $output | grep 'Started domain' | sed 's/^.*Started domain //' | tr -d '\n'`
domain_name=`echo $output | grep 'Started domain' | sed 's/^.*Started domain //' | tr -d '\n' | cut -d' ' -f1`
out=`grep -e '^\#O CPU_CREDITS =' < $domain`
@ -46,7 +46,7 @@ if [ "x$?" = "x0" ]; then
log_debug "Credits set to $credits"
name=`grep -e '^name =' < $domain | cut -d= -f2 | tr -d ' ' | tr -d "\'"`
name=`grep -e '^name =' < $domain | cut -d= -f2 | tr -d ' ' | tr -d "\'" | cut -d' ' -f1`
$XM_CREDITS -d $name -w $credits

View File

@ -31,7 +31,6 @@ class VirtualNetworkDriver
@options = options
@ssh_stream = options[:ssh_stream]
@message = options[:message]
@extra_data = options[:extra_data]
@vm_encoded = Base64.encode64(@message.elements['VM'].to_s).delete("\n")
@ -45,14 +44,17 @@ class VirtualNetworkDriver
# @param [String, Symbol] aname name of the action
# @param [Hash] ops extra options for the command
# @option ops [String] :stdin text to be writen to stdin
# @option ops [String] :parameters additional parameters for vnm action
def do_action(id, aname, ops = {})
options={
:stdin => nil,
:stdin => nil,
:parameters => nil
}.merge(ops)
deploy_id=@extra_data[:deploy_id] || '-'
cmd_params = "#{@vm_encoded}"
cmd_params << " #{options[:parameters]}" if options[:parameters]
cmd = action_command_line(aname, "#{@vm_encoded} #{deploy_id}")
cmd = action_command_line(aname, cmd_params)
if action_is_local?(aname)
execution = LocalCommand.run(cmd, log_method(id))

View File

@ -34,7 +34,7 @@
<NETWORK><![CDATA[virt-net]]></NETWORK>
<NETWORK_ID><![CDATA[3]]></NETWORK_ID>
<VLAN><![CDATA[YES]]></VLAN>
<WHITE_PORTS_TCP><![CDATA[22,80]]></WHITE_PORTS_TCP>
<WHITE_PORTS_TCP><![CDATA[22, 80]]></WHITE_PORTS_TCP>
</NIC>
<NIC>
<BRIDGE><![CDATA[onebr2]]></BRIDGE>