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

F #4816 Make configurable a persistent instance done

This commit is contained in:
abelCoronado93 2017-06-29 12:24:11 +02:00 committed by Tino Vázquez
parent 1e277b4ac0
commit 517341624c
13 changed files with 60 additions and 26 deletions

View File

@ -51,7 +51,10 @@ features:
instantiate_hide_cpu: false
# False to not scale the CPU. Number [0, 1] to scale from VCPU
instanciate_cpu_factor: false
instantiate_cpu_factor: false
# True to show the option to make persistent a instance
instantiate_persistent: true
# True to show an input to specify the the VMs and Template path/folder where a vCenter VM will
# deployed to

View File

@ -51,7 +51,10 @@ features:
instantiate_hide_cpu: false
# False to not scale the CPU. Number [0, 1] to scale from VCPU
instanciate_cpu_factor: false
instantiate_cpu_factor: false
# True to show the option to make persistent a instance
instantiate_persistent: true
# True to show an input to specify the the VMs and Template path/folder where a vCenter VM will
# deployed to

View File

@ -19,7 +19,10 @@ features:
instantiate_hide_cpu: false
# False to not scale the CPU. Number [0, 1] to scale from VCPU
instanciate_cpu_factor: false
instantiate_cpu_factor: false
# True to show the option to make persistent a instance
instantiate_persistent: true
tabs:
provision-tab:
panel_tabs:

View File

@ -19,7 +19,10 @@ features:
instantiate_hide_cpu: true
# False to not scale the CPU. Number [0, 1] to scale from VCPU
instanciate_cpu_factor: false
instantiate_cpu_factor: false
# True to show the option to make persistent a instance
instantiate_persistent: true
tabs:
provision-tab:
panel_tabs:

View File

@ -51,7 +51,10 @@ features:
instantiate_hide_cpu: false
# False to not scale the CPU. Number [0, 1] to scale from VCPU
instanciate_cpu_factor: false
instantiate_cpu_factor: false
# True to show the option to make persistent a instance
instantiate_persistent: true
# True to show an input to specify the the VMs and Template path/folder where a vCenter VM will
# deployed to

View File

@ -51,7 +51,10 @@ features:
instantiate_hide_cpu: true
# False to not scale the CPU. Number [0, 1] to scale from VCPU
instanciate_cpu_factor: false
instantiate_cpu_factor: false
# True to show the option to make persistent a instance
instantiate_persistent: true
# True to show an input to specify the the VMs and Template path/folder where a vCenter VM will
# deployed to

View File

@ -51,7 +51,10 @@ features:
instantiate_hide_cpu: false
# False to not scale the CPU. Number [0, 1] to scale from VCPU
instanciate_cpu_factor: false
instantiate_cpu_factor: false
# True to show the option to make persistent a instance
instantiate_persistent: true
# True to show an input to specify the the VMs and Template path/folder where a vCenter VM will
# deployed to

View File

@ -156,7 +156,7 @@ define(function(require) {
'enabledTabs': _config['view']['enabled_tabs'],
'onedConf': _config['oned_conf'],
'confirmVMActions': _config['view']['confirm_vms'],
'scaleFactor': _config['view']['features']['instanciate_cpu_factor'],
'scaleFactor': _config['view']['features']['instantiate_cpu_factor'],
'filterView': _config['view']['filter_view'],
"allTabs": function() {

View File

@ -961,10 +961,14 @@ define(function(require) {
disksContext.data("template_json", template_json);
if (Config.provision.create_vm.isEnabled("disk_resize")) {
var pers = $("input.instantiate_pers", create_vm_context).prop("checked");
if(pers == undefined){
pers = false;
}
DisksResize.insert({
template_json: template_json,
disksContext: disksContext,
force_persistent: $("input.instantiate_pers", create_vm_context).prop("checked"),
force_persistent: pers,
cost_callback: _calculateCost
});
} else {

View File

@ -29,6 +29,7 @@
<div class="medium-6 columns">
<input type="text" id="vm_name" class="provision-input" placeholder="{{tr "Virtual Machine Name"}}"/>
</div>
{{#isFeatureEnabled "instantiate_persistent"}}
<div class="large-3 medium-6 columns">
<div class="switch left">
<input class="switch-input instantiate_pers" id="instantiate_pers" type="checkbox">
@ -41,6 +42,7 @@
{{{tip (tr "Creates a private persistent copy of the template plus any image defined in DISK, and instantiates that copy")}}}
</label>
</div>
{{/isFeatureEnabled}}
<div class="large-3 medium-6 columns">
<button href="#" class="button success expanded" type="submit">{{tr "Create"}}</button>
<div data-alert class="label alert-box-error" hidden></div>

View File

@ -135,7 +135,7 @@ define(function(require) {
$("div.vcpu_input", context).html(input);
if (Config.isFeatureEnabled("instanciate_cpu_factor")){
if (Config.isFeatureEnabled("instantiate_cpu_factor")){
$("div.vcpu_input input", context).on("change", function(){
var vcpuValue = $("div.vcpu_input input", context).val();
$("div.cpu_input input", context).val(vcpuValue * Config.scaleFactor);

View File

@ -88,26 +88,31 @@ define(function(require) {
function _setup(context) {
var that = this;
$("input.instantiate_pers", context).on("change", function(){
var persistent = $(this).prop('checked');
if(Config.isFeatureEnabled("instantiate_persistent")){
$("input.instantiate_pers", context).on("change", function(){
var persistent = $(this).prop('checked');
if(persistent){
$("#vm_n_times_disabled", context).show();
$("#vm_n_times", context).hide();
} else {
$("#vm_n_times_disabled", context).hide();
$("#vm_n_times", context).show();
}
if(persistent){
$("#vm_n_times_disabled", context).show();
$("#vm_n_times", context).hide();
} else {
$("#vm_n_times_disabled", context).hide();
$("#vm_n_times", context).show();
}
$.each(that.template_objects, function(index, template_json) {
DisksResize.insert({
template_json: template_json,
disksContext: $(".disksContext" + template_json.VMTEMPLATE.ID, context),
force_persistent: persistent,
cost_callback: that.calculateCost.bind(that)
$.each(that.template_objects, function(index, template_json) {
DisksResize.insert({
template_json: template_json,
disksContext: $(".disksContext" + template_json.VMTEMPLATE.ID, context),
force_persistent: persistent,
cost_callback: that.calculateCost.bind(that)
});
});
});
});
} else {
$("#vm_n_times_disabled", context).hide();
$("#vm_n_times", context).show();
}
}
function _calculateCost(){

View File

@ -21,6 +21,7 @@
</div>
<div class="row persistentContainer">
<div class="large-12 large-centered columns">
{{#isFeatureEnabled "instantiate_persistent"}}
<div class="switch left">
<input class="switch-input instantiate_pers" id="{{formPanelId}}instantiate_pers" type="checkbox">
<label class="switch-paddle" for="{{formPanelId}}instantiate_pers">
@ -31,6 +32,7 @@
{{tr "Instantiate as persistent"}}
{{{tip (tr "Creates a private persistent copy of the template plus any image defined in DISK, and instantiates that copy")}}}
</label>
{{/isFeatureEnabled}}
</div>
</div>
<div class="row nameContainer">