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

F #5461: Support empty attributes in merges in Sunstone (#534)

* F #5461: Support empty attributes in merges in Sunstone

* F #5461: Added SCHED_REQUIREMENTS instantiate VM
This commit is contained in:
Abel Coronado 2017-10-19 15:42:32 +02:00 committed by Tino Vázquez
parent 9e08508d8b
commit 7c4c03540c
2 changed files with 17 additions and 6 deletions

View File

@ -107,6 +107,13 @@ module OpenNebulaJSON
end
template = template_to_str(params['template'])
['NIC', 'SCHED_ACTION', 'SCHED_REQUIREMENTS', 'SCHED_DS_REQUIREMENTS'].each { |i|
if params['template'][i] && params['template'][i].empty?
template << "\n#{i} = []"
end
}
super(params['vm_name'], params['hold'], template, persistent)
else
super(params['vm_name'], params['hold'], "", persistent)

View File

@ -259,16 +259,22 @@ define(function(require) {
var vmgroup = VMGroupSection.retrieve($(".vmgroupContext"+ template_id));
if(vmgroup){
$.extend(tmp_json, vmgroup);
} else {
tmp_json.VMGROUP = [];
}
var sched = WizardFields.retrieveInput($("#SCHED_REQUIREMENTS" + template_id, context));
if(sched){
if (sched){
tmp_json.SCHED_REQUIREMENTS = sched;
} else {
tmp_json.SCHED_REQUIREMENTS = [];
}
var sched_ds = WizardFields.retrieveInput($("#SCHED_DS_REQUIREMENTS" + template_id, context));
if(sched_ds){
if (sched_ds){
tmp_json.SCHED_DS_REQUIREMENTS = sched_ds;
} else {
tmp_json.SCHED_DS_REQUIREMENTS = [];
}
var nics = [];
@ -277,14 +283,12 @@ define(function(require) {
$.each(networks, function(){
if (this.TYPE == "NIC"){
pcis.push(this);
}else{
} else {
nics.push(this);
}
});
if (nics.length > 0) {
tmp_json.NIC = nics;
}
tmp_json.NIC = nics;
// Replace PCIs of type nic only
var original_tmpl = that.template_objects[index].VMTEMPLATE;