1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

Master bis (#203)

* removed bug of creation of template and vm

* F #2347 added section for vmgroup into cloud.yaml

* F #2347 added section for select vmgroup when you intanciate a machine

* F #2347 Filling mvgroup when instantiating a vm from a template
This commit is contained in:
juanmont 2017-03-01 17:12:25 +01:00 committed by Tino Vázquez
parent 1fbe34f3d2
commit 2090e4e5f4
7 changed files with 67 additions and 9 deletions

View File

@ -78,6 +78,8 @@ tabs:
capacity_select: true
# True to allow NIC customization
network_select: true
# True to allow vmgroup customization
vmgroup_select: true
# True to allow DISK size customization
disk_resize: true
settings-tab:
@ -135,4 +137,13 @@ tabs:
- 2 # Owner
#- 3 # Group
- 4 # Name
#- 5 # Labels
#- 5 # Labels
vmgroup-tab:
table_columns:
- 0 # Checkbox
- 1 # ID
- 2 # Owner
- 3 # Group
- 4 # Name
#- 5 # Labels
#- 6 # Search data

View File

@ -34,6 +34,7 @@ define(function(require) {
var RangeSlider = require('utils/range-slider');
var DisksResize = require('utils/disks-resize');
var NicsSection = require('utils/nics-section');
var VMGroupSection = require('utils/vmgroup-section');
var TemplateUtils = require('utils/template-utils');
var WizardFields = require('utils/wizard-fields');
var UserInputs = require('utils/user-inputs');
@ -927,6 +928,7 @@ define(function(require) {
$(".provision_accordion_template a").first().trigger("click");
$("#provision_create_vm .provision_vmgroup").show();
OpenNebula.Template.show({
data : {
id: template_id,
@ -959,6 +961,12 @@ define(function(require) {
$(".provision_network_selector", create_vm_context).html("");
}
if (Config.provision.create_vm.isEnabled("vmgroup_select")) {
VMGroupSection.insert(template_json, $(".vmgroupContext", create_vm_context));
} else {
$(".provision_vmgroup_selector", create_vm_context).html("");
}
if (template_json.VMTEMPLATE.TEMPLATE.USER_INPUTS) {
UserInputs.vmTemplateInsert(
$(".provision_custom_attributes_selector", create_vm_context),
@ -1009,6 +1017,12 @@ define(function(require) {
}
}
var vmgroup = VMGroupSection.retrieve($(".vmgroupContext"+ template_id));
if(vmgroup){
$.extend(extra_info.template, vmgroup);
}
if (nics.length > 0) {
extra_info.template.nic = nics;
}

View File

@ -123,4 +123,20 @@
<div class="provision_network_selector"></div>
</div>
</div>
<div class="row provision_vmgroup" hidden="true">
<div class="small-12 columns vmgroupContext{{element.ID}}">
<fieldset>
<legend>
<i class="fa fa-globe"></i> {{tr "VM Group"}}
</legend>
<div>
<a class="button small provision_add_vmgroup">
<i class="fa fa-lg fa-plus-circle add_vmgroup"></i> {{tr "VM Group"}}
</a>
</div>
<div class="provision_vmgroup_selector">
</div>
</fieldset>
</div>
</div>
</form>

View File

@ -178,7 +178,12 @@ define(function(require) {
function _retrieve(context) {
var templateJSON = WizardFields.retrieve(context);
templateJSON["DISK_COST"] = templateJSON["DISK_COST"] * 1024;
if(templateJSON["DISK_COST"]){
templateJSON["DISK_COST"] = templateJSON["DISK_COST"] * 1024;
}
else{
templateJSON["DISK_COST"] = "0";
}
if(templateJSON["MEMORY_UNIT_COST"] == "GB")
templateJSON["MEMORY_COST"] = templateJSON["MEMORY_COST"] * 1024;
if (templateJSON["HYPERVISOR"] == 'vcenter') {

View File

@ -146,7 +146,12 @@ define(function(require) {
}
var tmpl = WizardFields.retrieve(selectedContext);
tmpl["SIZE"] = tmpl["SIZE"] * 1024;
if(tmpl["SIZE"]){
tmpl["SIZE"] = tmpl["SIZE"] * 1024;
}
else{
return {};
}
var dev_prefix = WizardFields.retrieveInput($('#disk_dev_prefix', selectedContext));
if (dev_prefix != undefined && dev_prefix.length) {
if (dev_prefix == "custom") {

View File

@ -80,7 +80,7 @@ define(function(require) {
}
function _retrieve(context) {
return vmgroupSection.retrieve(context);
return vmgroupSection.retrieve(context, this.vmGroupTable);
}
function _fill(context, templateJSON) {

View File

@ -66,6 +66,7 @@ define(function(require) {
function _insert(template_json, context) {
var templateVmgroup = null;
var that = this;
this.vmGroupTable = new VMGroupsTable('vmgroups_table'+UniqueId.id(), { 'select': true });
var that = this;
var templateVmgroup = $(TemplateSection({
@ -92,19 +93,25 @@ define(function(require) {
});
$("#role_section",context).hide();
$(".role_table_section", context).prop('required', false);
if(template_json.VMTEMPLATE.TEMPLATE.VMGROUP){
this.vmGroupTable.selectResourceTableSelect({ids:template_json.VMTEMPLATE.TEMPLATE.VMGROUP.VMGROUP_ID});
_generate_provision_role_table(context, template_json.VMTEMPLATE.TEMPLATE.VMGROUP.VMGROUP_ID, template_json.VMTEMPLATE.TEMPLATE.VMGROUP.ROLE);
}
}
function _fill(context, templateJSON, vmGroupTable=undefined){
var element = templateJSON.VMGROUP;
vmGroupTable.selectResourceTableSelect({ids:element.VMGROUP_ID});
_generate_provision_role_table(context,element.VMGROUP_ID, element.ROLE);
if(templateJSON.VMGROUP){
var element = templateJSON.VMGROUP;
vmGroupTable.selectResourceTableSelect({ids:element.VMGROUP_ID});
_generate_provision_role_table(context,element.VMGROUP_ID, element.ROLE);
}
}
function _retrieve(context, vmGroupTable=undefined) {
var role_selected = $('.role_table_section').val();
var role_selected = $('.role_table_section', context).val();
var vmgroup_selected = undefined;
if(this.vmGroupTable)
this.vmGroupTable.retrieveResourceTableSelect();
vmgroup_selected = this.vmGroupTable.retrieveResourceTableSelect();
if(vmGroupTable)
vmgroup_selected = vmGroupTable.retrieveResourceTableSelect();
if(vmgroup_selected){