mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-12 09:17:41 +03:00
* Added hosts requirements intantiate VM * F #5217 Added Host requirements instantiate VM
This commit is contained in:
parent
27e61baeb4
commit
902a0183f1
@ -35,6 +35,7 @@ define(function(require) {
|
|||||||
var VcenterVMFolder = require('utils/vcenter-vm-folder');
|
var VcenterVMFolder = require('utils/vcenter-vm-folder');
|
||||||
var CapacityInputs = require('tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-inputs');
|
var CapacityInputs = require('tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-inputs');
|
||||||
var Config = require('sunstone-config');
|
var Config = require('sunstone-config');
|
||||||
|
var HostsTable = require('tabs/hosts-tab/datatable');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CONSTANTS
|
CONSTANTS
|
||||||
@ -172,11 +173,15 @@ define(function(require) {
|
|||||||
var networks = NicsSection.retrieve($(".nicsContext" + template_id, context));
|
var networks = NicsSection.retrieve($(".nicsContext" + template_id, context));
|
||||||
|
|
||||||
var vmgroup = VMGroupSection.retrieve($(".vmgroupContext"+ template_id));
|
var vmgroup = VMGroupSection.retrieve($(".vmgroupContext"+ template_id));
|
||||||
|
|
||||||
if(vmgroup){
|
if(vmgroup){
|
||||||
$.extend(tmp_json, vmgroup);
|
$.extend(tmp_json, vmgroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sched = WizardFields.retrieveInput($("#SCHED_REQUIREMENTS" + template_id, context));
|
||||||
|
if(sched){
|
||||||
|
tmp_json.SCHED_REQUIREMENTS = sched;
|
||||||
|
}
|
||||||
|
|
||||||
var nics = [];
|
var nics = [];
|
||||||
var pcis = [];
|
var pcis = [];
|
||||||
|
|
||||||
@ -261,13 +266,35 @@ define(function(require) {
|
|||||||
timeout: true,
|
timeout: true,
|
||||||
success: function (request, template_json) {
|
success: function (request, template_json) {
|
||||||
that.template_objects.push(template_json);
|
that.template_objects.push(template_json);
|
||||||
|
var options = {
|
||||||
|
'select': true,
|
||||||
|
'selectOptions': {
|
||||||
|
'multiple_choice': true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
that.hostsTable = new HostsTable('HostsTable' + template_json.VMTEMPLATE.ID, options);
|
||||||
templatesContext.append(
|
templatesContext.append(
|
||||||
TemplateRowHTML(
|
TemplateRowHTML(
|
||||||
{ element: template_json.VMTEMPLATE,
|
{ element: template_json.VMTEMPLATE,
|
||||||
capacityInputsHTML: CapacityInputs.html()
|
capacityInputsHTML: CapacityInputs.html(),
|
||||||
|
hostsDatatable: that.hostsTable.dataTableHTML
|
||||||
}) );
|
}) );
|
||||||
|
|
||||||
|
$(".provision_host_selector" + template_json.VMTEMPLATE.ID, context).data("hostsTable", that.hostsTable);
|
||||||
|
var selectOptions = {
|
||||||
|
'selectOptions': {
|
||||||
|
'select_callback': function(aData, options) {
|
||||||
|
generateRequirements($(".provision_host_selector" + template_json.VMTEMPLATE.ID, context).data("hostsTable"), context, template_json.VMTEMPLATE.ID);
|
||||||
|
},
|
||||||
|
'unselect_callback': function(aData, options) {
|
||||||
|
generateRequirements($(".provision_host_selector"+ template_json.VMTEMPLATE.ID, context).data("hostsTable"), context, template_json.VMTEMPLATE.ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
that.hostsTable.initialize(selectOptions);
|
||||||
|
that.hostsTable.refreshResourceTableSelect();
|
||||||
|
|
||||||
DisksResize.insert({
|
DisksResize.insert({
|
||||||
template_json: template_json,
|
template_json: template_json,
|
||||||
disksContext: $(".disksContext" + template_json.VMTEMPLATE.ID, context),
|
disksContext: $(".disksContext" + template_json.VMTEMPLATE.ID, context),
|
||||||
@ -356,4 +383,21 @@ define(function(require) {
|
|||||||
Tips.setup(context);
|
Tips.setup(context);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
function generateRequirements(hosts_table, context, id) {
|
||||||
|
var req_string=[];
|
||||||
|
//var req_ds_string=[];
|
||||||
|
var selected_hosts = hosts_table.retrieveResourceTableSelect();
|
||||||
|
//var selected_ds = this.datastoresTable.retrieveResourceTableSelect();
|
||||||
|
|
||||||
|
$.each(selected_hosts, function(index, hostId) {
|
||||||
|
req_string.push('ID="'+hostId+'"');
|
||||||
|
});
|
||||||
|
|
||||||
|
/*$.each(selected_ds, function(index, dsId) {
|
||||||
|
req_ds_string.push('ID="'+dsId+'"');
|
||||||
|
});*/
|
||||||
|
|
||||||
|
$('#SCHED_REQUIREMENTS' + id, context).val(req_string.join(" | "));
|
||||||
|
//$('#SCHED_DS_REQUIREMENTS', context).val(req_ds_string.join(" | "));
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
@ -66,6 +66,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="small-12 columns hostContext{{element.ID}}">
|
||||||
|
<fieldset>
|
||||||
|
<legend>
|
||||||
|
<i class="fa fa-globe"></i> {{tr "Host"}}
|
||||||
|
</legend>
|
||||||
|
<div class="provision_host_selector{{element.ID}}" data-tab-content>{{{hostsDatatable}}}</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="large-12 columns">
|
||||||
|
<label for="SCHED_REQUIREMENTS">
|
||||||
|
{{tr "Expression"}}
|
||||||
|
{{{tip (tr "Boolean expression that rules out entries from the pool of datastores suitable to run this VM.")}}}
|
||||||
|
</label>
|
||||||
|
<input type="text" wizard_field="SCHED_REQUIREMENTS" id="SCHED_REQUIREMENTS{{element.ID}}" name="requirements" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="medium-6 small-12 columns vcenterVMFolderContext{{element.ID}}">
|
<div class="medium-6 small-12 columns vcenterVMFolderContext{{element.ID}}">
|
||||||
|
Loading…
Reference in New Issue
Block a user