diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index 76592e1fff..bff69b1a60 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -77,9 +77,11 @@ var create_vm_tmpl ='
\
\ \
\ - \ - \ + \ +
\ + \ + \
\ \
\ @@ -767,8 +769,21 @@ function setupCreateVMDialog(){ $('#create_vm_dialog #create_vm_proceed').click(function(){ var vm_name = $('#create_vm_form #vm_name').val(); var template_id = $('#create_vm_form #template_id').val(); + var n_times = $('#create_vm_form #vm_n_times').val(); + var n_times_int=1; + if (n_times.length){ + n_times_int=parseInt(n_times,10); + } - Sunstone.runAction("VM.create",template_id,vm_name); + if (n_times_int>1){ + for (var i=0; i< n_times_int; i++){ + Sunstone.runAction("Template.instantiate",template_id,vm_name+"_"+i); + }; + } else { + Sunstone.runAction("Template.instantiate",template_id,vm_name); + }; + + Sunstone.runAction("VM.list"); $('#create_vm_dialog').dialog('close'); return false; });