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

Merge branch 'feature-2187'

This commit is contained in:
Ruben S. Montero 2013-09-09 17:11:16 +02:00
commit db155f8896
2 changed files with 51 additions and 9 deletions

View File

@ -248,6 +248,19 @@ EOT
:large => '--boot device',
:description => 'Select boot device (hd|fd|cdrom|network)',
:format => String
},
{
:name => 'files_ds',
:large => '--files_ds file1,file2',
:format => Array,
:description => 'Add files to the contextualization CD from the' <<
'files datastore'
},
{
:name => 'init',
:large => '--init script1,script2',
:format => Array,
:description => 'Script or scripts to start in context'
}
]
@ -774,7 +787,8 @@ EOT
end
def self.create_context(options)
if !(options.keys & [:ssh, :net_context, :context]).empty?
context_options = [:ssh, :net_context, :context, :init, :files_ds]
if !(options.keys & context_options).empty?
lines=[]
if options[:ssh]
@ -792,11 +806,25 @@ EOT
end
if options[:net_context]
lines << "NETWORK = \"YES\""
lines << "NETWORK = \"YES\""
end
lines+=options[:context] if options[:context]
if options[:files_ds]
text='FILES_DS="'
text << options[:files_ds].map do |file|
%Q<$FILE[IMAGE=\\"#{file}\\"]>
end.join(' ')
text << '"'
lines << text
end
if options[:init]
lines << %Q<INIT_SCRIPTS="#{options[:init].join(' ')}">
end
if !lines.empty?
"CONTEXT=[\n"<<lines.map{|l| " "<<l }.join(",\n")<<"\n]\n"
else

View File

@ -2865,7 +2865,7 @@ function setupCreateTemplateDialog(){
}
});
$("#refresh_ramdisk_table").die();
$("#refresh_ramdisk_table").live('click', function(){
@ -3178,16 +3178,27 @@ function setupCreateTemplateDialog(){
'</div>'+
'<div class="row vm_param">'+
'<br>'+
'<div class="four columns">'+
'<div class="two columns">'+
'<label class="right inline" for="FILES_DS">'+tr("FILES_DS")+':</label>'+
'</div>'+
'<div class="six columns">'+
'<div class="nine columns">'+
'<input type="text" id="FILES_DS" name="FILES_DS" />'+
'</div>'+
'<div class="two columns">'+
'<div class="one columns">'+
'<div class="tip"></div>'+
'</div>'+
'</div>'+
'<div class="row vm_param">'+
'<div class="two columns">'+
'<label class="right inline" for="INIT_SCRIPTS">'+tr("Init scripts")+':</label>'+
'</div>'+
'<div class="nine columns">'+
'<input type="text" id="INIT_SCRIPTS" name="INIT_SCRIPTS" />'+
'</div>'+
'<div class="one columns">'+
'<div class="tip">'+tr("If the VM uses the OpenNebula contextualization package the init.sh file is executed by default. When the init script added is not called init.sh or more than one init script is added, this list contains the scripts to run and the order. Ex. “init.sh users.sh mysql.sh”")+'</div>'+
'</div>'+
'</div>'+
'</li>'+
'<li class="wizard_internal_tab" id="zcustomTab">'+
'<div class="row">'+
@ -3287,7 +3298,7 @@ function setupCreateTemplateDialog(){
}
});
$("#refresh_context_table").die();
$("#refresh_context_table").live('click', function(){
@ -4601,6 +4612,9 @@ function fillTemplatePopUp(request, response){
else if (net_regexp.test(key)) {
$("#network_context", context_section).attr('checked','checked');
}
else if ("INIT_SCRIPTS" == key){
$("input#INIT_SCRIPTS").val(value);
}
else if ("FILES_DS" == key){
$('#FILES_DS', context_section).val(context["FILES_DS"])
var files = [];
@ -5034,7 +5048,7 @@ function setupInstantiateTemplateDialog(easy_provision){
dialog.addClass("reveal-modal large");
dialog.removeClass("max-height")
}
setupTips(dialog);
@ -5071,7 +5085,7 @@ function setupInstantiateTemplateDialog(easy_provision){
'image_id': image_id
}
}
}
}
if (!vm_name.length){ //empty name use OpenNebula core default
for (var i=0; i< n_times_int; i++){