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

F #5228: Change LXD for LXC in Sunstone

Signed-off-by: Jorge Lobo <jlobo@opennebula.io>
This commit is contained in:
Tino Vazquez 2021-03-16 18:18:12 +01:00
parent 611e5114bc
commit 851acf462a
No known key found for this signature in database
GPG Key ID: 14201E424D02047E
10 changed files with 182 additions and 307 deletions

View File

@ -15,10 +15,10 @@
/* -------------------------------------------------------------------------- */
define(function(require) {
var OpenNebulaAction = require('./action');
var Locale = require('utils/locale');
var OpenNebulaError = require('./error');
var OpenNebulaHelper = require('./helper');
var OpenNebulaAction = require("./action");
var Locale = require("utils/locale");
var OpenNebulaError = require("./error");
var OpenNebulaHelper = require("./helper");
var infrastructureCache;
@ -26,7 +26,6 @@ define(function(require) {
var pcisCallbacks = [];
var customizationsCallbacks = [];
var kvmInfoCallbacks = [];
var lxdProfilesInfoCallbacks = [];
var CACHE_EXPIRE = 300000; //ms
@ -171,24 +170,6 @@ define(function(require) {
_infrastructure();
},
"lxdProfilesInfo": function(params){
var callback = params.success;
var callbackError = params.error;
var request = OpenNebulaHelper.request(RESOURCE, "infrastructure");
if (infrastructureCache &&
infrastructureCache["timestamp"] + CACHE_EXPIRE > new Date().getTime()) {
return callback ? callback(request, infrastructureCache["lxd_profiles"]) : null;
}
lxdProfilesInfoCallbacks.push({
success : callback,
error : callbackError
});
_infrastructure();
},
"kvmInfo": function(params){
var callback = params.success;
var callbackError = params.error;
@ -244,16 +225,6 @@ define(function(require) {
customizations = [customizations];
}
var lxd_profiles = response.lxd_profiles;
if (lxd_profiles == undefined){
lxd_profiles = [];
}
if (!Array.isArray(lxd_profiles)){ // If only 1 convert to array
lxd_profiles = [lxd_profiles];
}
var kvm_info = response.kvm_info;
if (kvm_info == undefined){
@ -268,8 +239,7 @@ define(function(require) {
timestamp : new Date().getTime(),
pcis : pcis,
customizations : customizations,
kvm_info : kvm_info,
lxd_profiles : lxd_profiles
kvm_info : kvm_info
};
infrastructureWaiting = false;
@ -304,17 +274,6 @@ define(function(require) {
kvmInfoCallbacks = [];
for (var i = 0; i < lxdProfilesInfoCallbacks.length; i++) {
var callback = lxdProfilesInfoCallbacks[i].success;
if (callback) {
callback(request, lxd_profiles);
}
}
lxdProfilesInfoCallbacks = [];
return;
},
error: function(response) {
@ -346,4 +305,4 @@ define(function(require) {
}
return Host;
})
});

View File

@ -19,45 +19,45 @@ define(function(require) {
DEPENDENCIES
*/
var Locale = require('utils/locale');
var Tips = require('utils/tips');
var CapacityCreate = require('./general/capacity-create');
var WizardFields = require('utils/wizard-fields');
var Config = require('sunstone-config');
var UserInputs = require('utils/user-inputs');
var UniqueId = require('utils/unique-id');
var OpenNebula = require('opennebula');
var Locale = require("utils/locale");
var Tips = require("utils/tips");
var CapacityCreate = require("./general/capacity-create");
var WizardFields = require("utils/wizard-fields");
var Config = require("sunstone-config");
var UserInputs = require("utils/user-inputs");
var UniqueId = require("utils/unique-id");
var OpenNebula = require("opennebula");
var UsersTable = require("tabs/users-tab/datatable");
var GroupTable = require("tabs/groups-tab/datatable");
var OpenNebulaHost = require("opennebula/host");
var CoresPerSocket = require("tabs/templates-tab/form-panels/create/wizard-tabs/utils/cores-per-socket");
var OpenNebulaMarketplace = require('opennebula/marketplace');
var Notifier = require('utils/notifier');
var OpenNebulaMarketplace = require("opennebula/marketplace");
var Notifier = require("utils/notifier");
/*
TEMPLATES
*/
var TemplateHTML = require('hbs!./general/html');
var TemplateHTML = require("hbs!./general/html");
/*
CONSTANTS
*/
var WIZARD_TAB_ID = require('./general/wizardTabId');
var VCPU_SELECTOR = '#VCPU';
var WIZARD_TAB_ID = require("./general/wizardTabId");
var VCPU_SELECTOR = "#VCPU";
/*
CONSTRUCTOR
*/
function WizardTab(opts) {
if (!Config.isTemplateCreationTabEnabled(opts.tabId, 'general')) {
if (!Config.isTemplateCreationTabEnabled(opts.tabId, "general")) {
throw "Wizard Tab not enabled";
}
this.wizardTabId = WIZARD_TAB_ID + UniqueId.id();
this.icon = 'fa-laptop';
this.icon = "fa-laptop";
this.title = Locale.tr("General");
if (opts.listener != undefined){
@ -90,24 +90,24 @@ define(function(require) {
function _html() {
return TemplateHTML({
'capacityCreateHTML': CapacityCreate.html(),
'logos': Config.vmLogos,
'usersDatatable': this.usersTable.dataTableHTML,
'groupDatatable': this.groupTable.dataTableHTML,
"capacityCreateHTML": CapacityCreate.html(),
"logos": Config.vmLogos,
"usersDatatable": this.usersTable.dataTableHTML,
"groupDatatable": this.groupTable.dataTableHTML,
});
}
function _onShow(context, panelForm) {
if (panelForm.action == 'create') {
$('#NAME', context)
.removeAttr('disabled')
if (panelForm.action == "create") {
$("#NAME", context)
.removeAttr("disabled")
.attr("required", "")
.prop('wizard_field_disabled', false);
} else if (panelForm.action == 'update') {
$('#NAME', context)
.prop("wizard_field_disabled", false);
} else if (panelForm.action == "update") {
$("#NAME", context)
.attr("disabled", "disabled")
.removeAttr("required")
.prop('wizard_field_disabled', true);
.prop("wizard_field_disabled", true);
}
if (panelForm.resource == "VirtualRouterTemplate"){
@ -136,7 +136,7 @@ define(function(require) {
this.groupTable.initialize();
this.groupTable.refreshResourceTableSelect();
$(document).on('click', "[href='#" + this.wizardTabId + "']", function(){
$(document).on("click", "[href='#" + this.wizardTabId + "']", function(){
//context.foundation('slider', 'reflow');
});
@ -153,7 +153,7 @@ define(function(require) {
});
context.on("change", "#DISK_COST", function() {
that.disk = parseFloat(document.getElementById('DISK_COST').value);
that.disk = parseFloat(document.getElementById("DISK_COST").value);
if(!isNaN(that.disk)){
that.templateDISKS = JSON.parse(localStorage.getItem("disksJSON"));
if (that.templateDISKS){
@ -175,25 +175,25 @@ define(function(require) {
var totalCostDisk = 0;
if (!isNaN(totalGB)){
totalCostDisk = totalGB * that.disk;
document.getElementById('total_value_disk').textContent = convertCostNumber(totalCostDisk * 24 * 30);
document.getElementById("total_value_disk").textContent = convertCostNumber(totalCostDisk * 24 * 30);
CapacityCreate.totalCost();
} else {
document.getElementById('total_value_disk').textContent = totalCostDisk;
document.getElementById("total_value_disk").textContent = totalCostDisk;
}
$(".total_disk_cost", context).show();
}
});
}
} else {
document.getElementById('total_value_disk').textContent = 0;
document.getElementById("total_value_disk").textContent = 0;
}
});
context.on("change", "#LOGO", function() {
$("#template_create_logo", context).show();
$("#template_create_logo", context).html('<span class="">' +
'<img src="' + $(this).val() + '">' +
'</span>');
$("#template_create_logo", context).html("<span class=\"\">" +
"<img src=\"" + $(this).val() + "\">" +
"</span>");
});
context.on("change", "input[name='hypervisor']", function() {
@ -202,41 +202,41 @@ define(function(require) {
$("#vcenter_instance_id", context).attr("required", "");
$("#vcenter_ccr_ref", context).attr("required", "");
$("#MEMORY", context).attr("pattern", "^([048]|\\d*[13579][26]|\\d*[24680][048])$");
$('.only_kvm').hide();
$('.only_lxd').hide();
$('.only_vcenter').show();
$(".only_kvm").hide();
$(".only_lxc").hide();
$(".only_vcenter").show();
} else {
$("#vcenter_template_ref", context).removeAttr("required");
$("#vcenter_instance_id", context).removeAttr("required");
$("#vcenter_ccr_ref", context).removeAttr("required");
$("#MEMORY", context).removeAttr("pattern");
$('.only_kvm').show();
$('.only_vcenter').hide();
if (this.value != "lxd")
$(".only_kvm").show();
$(".only_vcenter").hide();
if (this.value != "lxc")
{
$('.only_lxd').hide();
$('.not_lxd').show();
$('.raw_type').val('kvm');
$(".only_lxc").hide();
$(".not_lxc").show();
$(".raw_type").val("kvm");
}
}
// There is another listener in context.js setup
// Needs proper LXD view, this is just a workaround
// All KVM settings are available in LXD plus
// Needs proper LXC view, this is just a workaround
// All KVM settings are available in LXC plus
// Privileged, Profile and Security Nesting
if (this.value == "lxd") {
$('.only_lxd').show();
$('.not_lxd').hide();
$('.raw_type').val('lxd');
if (this.value == "lxc") {
$(".only_lxc").show();
$(".not_lxc").hide();
$(".raw_type").val("lxc");
}
var formContext = "#createVMTemplateFormWizard";
var NUMA_THREADS_MIN = 1;
var NUMA_THREADS_MAX = 2;
if (this.value == "firecracker") {
var cpu_input = "";
if (this.value === "firecracker") {
// [GENERAL]
$(".cpu_input > input", formContext).val("1");
cpu_input = "1";
// [NUMA]
$("#numa-pin-policy", formContext).val("SHARED");
$("#numa-sockets", formContext).val("1");
@ -244,23 +244,20 @@ define(function(require) {
.prop("max", NUMA_THREADS_MAX)
.val(function(_, value) {
return (value > NUMA_THREADS_MAX) ? NUMA_THREADS_MAX : NUMA_THREADS_MIN;
})
$('.disabled_firecracker', formContext).prop("disabled", true);
$('.not_firecracker', formContext).hide();
$('.not_vcenter', formContext).show();
$('.only_vcenter', formContext).hide();
}
else if (this.value == "vcenter"){
// [GENERAL]
$(".cpu_input > input", formContext).val("");
});
$(".disabled_firecracker", formContext).prop("disabled", true);
$(".not_firecracker", formContext).hide();
$(".not_vcenter", formContext).show();
$(".only_vcenter", formContext).hide();
}
else if (this.value === "vcenter"){
// [NUMA]
$("#numa-pin-policy", formContext)
.prop("disabled", false)
.val("NONE")
.prop("disabled", true);
$("#numa-sockets", formContext)
.val("");
@ -270,34 +267,38 @@ define(function(require) {
.val("1")
.prop("disabled", true);
$('.disabled_firecracker', formContext).removeAttr("disabled");
$('.not_firecracker', formContext).show();
$('.not_vcenter', formContext).hide();
$('.only_vcenter', formContext).show();
$(".disabled_firecracker", formContext).removeAttr("disabled");
$(".not_firecracker", formContext).show();
$(".not_vcenter", formContext).hide();
$(".only_vcenter", formContext).show();
CoresPerSocket.calculateSockets(VCPU_SELECTOR);
}
else {
// [GENERAL]
$(".cpu_input > input", formContext).val("");
} else {
// [NUMA]
$("#numa-pin-policy", formContext)
.prop("disabled", false)
.val("NONE");
$("#numa-sockets", formContext).val("");
$("#numa-threads", formContext)
.prop("disabled", false)
.removeAttr("max")
.val("");
$('.disabled_firecracker', formContext).removeAttr("disabled");
$('.not_firecracker', formContext).show();
$('.not_vcenter', formContext).show();
$('.only_vcenter', formContext).hide();
$(".disabled_firecracker", formContext).removeAttr("disabled");
$(".not_firecracker", formContext).show();
$(".not_vcenter", formContext).show();
$(".only_vcenter", formContext).hide();
if(this.value === "lxc"){
$(".not_lxc").hide();
$(".only_kvm").hide();
$(".only_vcenter").hide();
$(".only_firecracker").hide();
}
}
$(".cpu_input > input", formContext).val(cpu_input);
});
CapacityCreate.setup($("div.capacityCreate", context));
@ -313,104 +314,71 @@ define(function(require) {
var selectHypervisor = $("#template_hypervisor_form", context);
var id = mode+"Radio";
var option = selectHypervisor.find("#"+id).remove();
var label = selectHypervisor.find('label[for="'+id+'"]').remove();
var label = selectHypervisor.find("label[for=\""+id+"\"]").remove();
}
}
if (config["mode"] === "kvm"){
$("#kvmRadio", context).click();
removeByMode("vcenter");
$('.only_kvm').show();
$('.only_vcenter').hide();
$(".only_kvm").show();
$(".only_vcenter").hide();
} else if (config["mode"] === "vcenter"){
$("#vcenterRadio", context).click();
removeByMode("kvm");
$('.only_kvm').hide();
$('.only_vcenter').show();
$(".only_kvm").hide();
$(".only_vcenter").show();
}
fillLXDProfiles(context)
fillMarketplaces();
}
function fillMarketplaces(){
var fillMP = function(_, marketplaces){
// EMPTY
$('#MARKETPLACE_ID').empty();
$('#MARKETPLACE_ID').append('<option value="">-</option>');
$("#MARKETPLACE_ID").empty();
$("#MARKETPLACE_ID").append("<option value=\"\">-</option>");
$.each(marketplaces, function(index, marketplace){
var id = marketplace.MARKETPLACE.ID;
var text = id + ' - ' + marketplace.MARKETPLACE.NAME;
var text = id + " - " + marketplace.MARKETPLACE.NAME;
var type = marketplace.MARKETPLACE.MARKET_MAD;
if (type == "http" || type == "s3"){
$('#MARKETPLACE_ID').append('<option value="' + id + '">'+ text + "</option>")
$("#MARKETPLACE_ID").append("<option value=\"" + id + "\">"+ text + "</option>");
}
});
}
};
OpenNebulaMarketplace.list({
success: fillMP,
error: Notifier.onError,
success: fillMP,
error: Notifier.onError,
options: {force: true} // Do not use cache
});
}
function fillLXDProfiles(context){
OpenNebulaHost.lxdProfilesInfo({
data : {},
timeout: true,
success: function (request, lxdProfilesInfo){
if ($("#lxd_profile", context).html() === undefined){
lxdprofiles = lxdProfilesInfo;
var html = "<select id=\"lxd_profile\">";
html += "<option value=\"\">" + " " + "</option>";
$.each(lxdprofiles, function(i, lxdprofile){
html += "<option value='" + lxdprofile + "'>" + lxdprofile + "</option>";
});
html += "</select>";
$("#lxd_profile_label", context).append(html);
}
},
error: function(request, error_json){
console.error("There was an error requesting lxd info: " +
error_json.error.message);
}
});
}
function _retrieve(context) {
var templateJSON = WizardFields.retrieve(context);
if (templateJSON["HYPERVISOR"] == 'vcenter') {
if (templateJSON["HYPERVISOR"] == "vcenter") {
templateJSON["VCENTER_TEMPLATE_REF"] = WizardFields.retrieveInput($("#vcenter_template_ref", context));
templateJSON["VCENTER_CCR_REF"] = WizardFields.retrieveInput($("#vcenter_ccr_ref", context));
templateJSON["VCENTER_INSTANCE_ID"] = WizardFields.retrieveInput($("#vcenter_instance_id", context));
if (Config.isFeatureEnabled("vcenter_vm_folder")) {
templateJSON["VCENTER_VM_FOLDER"] = WizardFields.retrieveInput($("#vcenter_vm_folder", context))
templateJSON["VCENTER_VM_FOLDER"] = WizardFields.retrieveInput($("#vcenter_vm_folder", context));
}
}
if (templateJSON["HYPERVISOR"] == 'lxd') {
templateJSON["LXD_SECURITY_PRIVILEGED"] = WizardFields.retrieveInput($("#lxd_security_privileged", context));
templateJSON["LXD_PROFILE"] = WizardFields.retrieveInput($("#lxd_profile", context));
templateJSON["LXD_SECURITY_NESTING"] = WizardFields.retrieveInput($("#lxd_security_nesting", context));
}
var sunstone_template = {};
if ($('#sunstone_network_select:checked', context).length > 0) {
sunstone_template["NETWORK_SELECT"] = "NO"
if ($("#sunstone_network_select:checked", context).length > 0) {
sunstone_template["NETWORK_SELECT"] = "NO";
}
if (!$.isEmptyObject(sunstone_template)) {
templateJSON['SUNSTONE'] = sunstone_template;
templateJSON["SUNSTONE"] = sunstone_template;
}
var userInputs = {};
@ -418,36 +386,36 @@ define(function(require) {
// Retrieve Resource Pool Attribute
var rpInput = $(".vcenter_rp_input", context);
if (rpInput.length > 0) {
var rpModify = WizardFields.retrieveInput($('.modify_rp', rpInput));
var rpInitial = WizardFields.retrieveInput($('.initial_rp', rpInput));
var rpParams = WizardFields.retrieveInput($('.available_rps', rpInput));
var rpModify = WizardFields.retrieveInput($(".modify_rp", rpInput));
var rpInitial = WizardFields.retrieveInput($(".initial_rp", rpInput));
var rpParams = WizardFields.retrieveInput($(".available_rps", rpInput));
if (rpModify === 'fixed' && rpInitial !== '') {
templateJSON['VCENTER_RESOURCE_POOL'] = rpInitial;
} else if (rpModify === 'list' && rpParams !== '') {
if (rpModify === "fixed" && rpInitial !== "") {
templateJSON["VCENTER_RESOURCE_POOL"] = rpInitial;
} else if (rpModify === "list" && rpParams !== "") {
var rpUserInputs = UserInputs.marshall({
type: 'list',
type: "list",
description: Locale.tr("Which resource pool you want this VM to run in?"),
initial: rpInitial,
params: WizardFields.retrieveInput($('.available_rps', rpInput))
params: WizardFields.retrieveInput($(".available_rps", rpInput))
});
userInputs['VCENTER_RESOURCE_POOL'] = rpUserInputs;
userInputs["VCENTER_RESOURCE_POOL"] = rpUserInputs;
}
}
// Since the USER_INPUTS section is not enabled for vCenter, we can assume that there are no more user inputs defined
if (!$.isEmptyObject(userInputs)) {
templateJSON['USER_INPUTS'] = userInputs;
templateJSON["USER_INPUTS"] = userInputs;
}
$.extend(true, templateJSON, CapacityCreate.retrieve($("div.capacityCreate", context)));
if (templateJSON['MEMORY_COST'] && templateJSON['MEMORY_UNIT_COST'] && templateJSON['MEMORY_UNIT_COST'] == "GB") {
templateJSON['MEMORY_COST'] = templateJSON['MEMORY_COST'] / 1024;
if (templateJSON["MEMORY_COST"] && templateJSON["MEMORY_UNIT_COST"] && templateJSON["MEMORY_UNIT_COST"] == "GB") {
templateJSON["MEMORY_COST"] = templateJSON["MEMORY_COST"] / 1024;
}
if (templateJSON['DISK_COST']) {
templateJSON['DISK_COST'] = (templateJSON['DISK_COST'] / 1024).toString();
if (templateJSON["DISK_COST"]) {
templateJSON["DISK_COST"] = (templateJSON["DISK_COST"] / 1024).toString();
}
var as_uid = this.usersTable.retrieveResourceTableSelect();
@ -461,16 +429,16 @@ define(function(require) {
}
templateJSON.HOT_RESIZE = {
'CPU_HOT_ADD_ENABLED': templateJSON['CPU_HOT_ADD_ENABLED'],
'MEMORY_HOT_ADD_ENABLED': templateJSON['MEMORY_HOT_ADD_ENABLED'],
}
"CPU_HOT_ADD_ENABLED": templateJSON["CPU_HOT_ADD_ENABLED"],
"MEMORY_HOT_ADD_ENABLED": templateJSON["MEMORY_HOT_ADD_ENABLED"],
};
delete templateJSON.CPU_HOT_ADD_ENABLED;
delete templateJSON.MEMORY_HOT_ADD_ENABLED;
templateJSON.BACKUP = {
'FREQUENCY_SECONDS': templateJSON['FREQUENCY_SECONDS'],
'MARKETPLACE_ID': templateJSON['MARKETPLACE_ID'],
}
"FREQUENCY_SECONDS": templateJSON["FREQUENCY_SECONDS"],
"MARKETPLACE_ID": templateJSON["MARKETPLACE_ID"],
};
delete templateJSON.FREQUENCY_SECONDS;
delete templateJSON.MARKETPLACE_ID;
@ -479,11 +447,11 @@ define(function(require) {
function _fill(context, templateJSON) {
if (templateJSON['MEMORY_COST'] && templateJSON['MEMORY_UNIT_COST'] && templateJSON['MEMORY_UNIT_COST'] == "GB") {
templateJSON['MEMORY_COST'] = templateJSON['MEMORY_COST'] * 1024;
if (templateJSON["MEMORY_COST"] && templateJSON["MEMORY_UNIT_COST"] && templateJSON["MEMORY_UNIT_COST"] == "GB") {
templateJSON["MEMORY_COST"] = templateJSON["MEMORY_COST"] * 1024;
}
if (templateJSON['DISK_COST']) {
templateJSON['DISK_COST'] = templateJSON['DISK_COST'] * 1024;
if (templateJSON["DISK_COST"]) {
templateJSON["DISK_COST"] = templateJSON["DISK_COST"] * 1024;
}
that.templateDISKS = $.extend(true, {}, templateJSON.DISK);
@ -499,7 +467,7 @@ define(function(require) {
}
if (Config.isFeatureEnabled("vcenter_vm_folder")) {
if (templateJSON["HYPERVISOR"] == 'vcenter' &&
if (templateJSON["HYPERVISOR"] == "vcenter" &&
templateJSON["VCENTER_VM_FOLDER"]) {
WizardFields.fillInput($("#vcenter_vm_folder", context), templateJSON["VCENTER_VM_FOLDER"]);
}
@ -509,7 +477,7 @@ define(function(require) {
delete templateJSON["VCENTER_VM_FOLDER"];
if (templateJSON["HYPERVISOR"] == 'vcenter') {
if (templateJSON["HYPERVISOR"] == "vcenter") {
var publicClouds = templateJSON["PUBLIC_CLOUD"];
if (publicClouds != undefined) {
@ -526,13 +494,11 @@ define(function(require) {
}
}
// LXD specific attributes
if (templateJSON["HYPERVISOR"] == 'lxd') {
fillLXD(context, templateJSON)
}
// LXC specific attributes
if (templateJSON["HYPERVISOR"] == "lxc") {}
if (templateJSON["HYPERVISOR"]) {
$("input[name='hypervisor'][value='"+templateJSON["HYPERVISOR"]+"']", context).trigger("click")
$("input[name='hypervisor'][value='"+templateJSON["HYPERVISOR"]+"']", context).trigger("click");
delete templateJSON["HYPERVISOR"];
}
@ -540,17 +506,17 @@ define(function(require) {
if (templateJSON["USER_INPUTS"]["VCENTER_RESOURCE_POOL"]) {
var rp = UserInputs.unmarshall(templateJSON["USER_INPUTS"]["VCENTER_RESOURCE_POOL"]);
$('.modify_rp', context).val('list');
$('.initial_rp', context).val(rp.initial);
$('.available_rps', context).val(rp.params);
$(".modify_rp", context).val("list");
$(".initial_rp", context).val(rp.initial);
$(".available_rps", context).val(rp.params);
delete templateJSON["USER_INPUTS"]["VCENTER_RESOURCE_POOL"];
}
}
if (templateJSON["VCENTER_RESOURCE_POOL"]) {
$('.modify_rp', context).val('fixed');
WizardFields.fillInput($('.initial_rp', context), templateJSON["VCENTER_RESOURCE_POOL"]);
$(".modify_rp", context).val("fixed");
WizardFields.fillInput($(".initial_rp", context), templateJSON["VCENTER_RESOURCE_POOL"]);
delete templateJSON["VCENTER_RESOURCE_POOL"];
}
@ -590,45 +556,28 @@ define(function(require) {
delete templateJSON["AS_GID"];
}
if (templateJSON['HOT_RESIZE']){
if (templateJSON.HOT_RESIZE['MEMORY_HOT_ADD_ENABLED']){
WizardFields.fillInput($('#MEMORY_HOT_ADD_ENABLED',context), templateJSON.HOT_RESIZE['MEMORY_HOT_ADD_ENABLED']);
if (templateJSON["HOT_RESIZE"]){
if (templateJSON.HOT_RESIZE["MEMORY_HOT_ADD_ENABLED"]){
WizardFields.fillInput($("#MEMORY_HOT_ADD_ENABLED",context), templateJSON.HOT_RESIZE["MEMORY_HOT_ADD_ENABLED"]);
}
if (templateJSON.HOT_RESIZE['CPU_HOT_ADD_ENABLED']){
WizardFields.fillInput($('#CPU_HOT_ADD_ENABLED',context), templateJSON.HOT_RESIZE['CPU_HOT_ADD_ENABLED']);
if (templateJSON.HOT_RESIZE["CPU_HOT_ADD_ENABLED"]){
WizardFields.fillInput($("#CPU_HOT_ADD_ENABLED",context), templateJSON.HOT_RESIZE["CPU_HOT_ADD_ENABLED"]);
}
delete templateJSON['HOT_RESIZE'];
delete templateJSON["HOT_RESIZE"];
}
// Fill backup attributes
if (templateJSON['BACKUP']){
if (templateJSON.BACKUP['FREQUENCY_SECONDS']){
WizardFields.fillInput($('#FREQUENCY_SECONDS',context), templateJSON.BACKUP['FREQUENCY_SECONDS']);
if (templateJSON["BACKUP"]){
if (templateJSON.BACKUP["FREQUENCY_SECONDS"]){
WizardFields.fillInput($("#FREQUENCY_SECONDS",context), templateJSON.BACKUP["FREQUENCY_SECONDS"]);
}
if (templateJSON.BACKUP['MARKETPLACE_ID']){
WizardFields.fillInput($('#MARKETPLACE_ID',context), templateJSON.BACKUP['MARKETPLACE_ID']);
if (templateJSON.BACKUP["MARKETPLACE_ID"]){
WizardFields.fillInput($("#MARKETPLACE_ID",context), templateJSON.BACKUP["MARKETPLACE_ID"]);
}
delete templateJSON['BACKUP'];
delete templateJSON["BACKUP"];
}
WizardFields.fill(context, templateJSON);
}
function fillLXD(context, templateJSON) {
if (templateJSON["LXD_SECURITY_PRIVILEGED"]){
WizardFields.fillInput($("#lxd_security_privileged", context), templateJSON["LXD_SECURITY_PRIVILEGED"]);
delete templateJSON["LXD_SECURITY_PRIVILEGED"];
}
if (templateJSON["LXD_PROFILE"]){
WizardFields.fillInput($("#lxd_profile", context), templateJSON["LXD_PROFILE"]);
delete templateJSON["LXD_PROFILE"];
}
if (templateJSON["LXD_SECURITY_NESTING"]){
WizardFields.fillInput($("#lxd_security_nesting", context), templateJSON["LXD_SECURITY_NESTING"]);
delete templateJSON["LXD_SECURITY_NESTING"];
}
}
});

View File

@ -31,8 +31,8 @@
<label for="kvmRadio">{{tr "KVM"}}</label>
<input type="radio" wizard_field="HYPERVISOR" name="hypervisor" value="vcenter" id="vcenterRadio">
<label for="vcenterRadio">{{tr "vCenter"}}</label>
<input type="radio" wizard_field="HYPERVISOR" name="hypervisor" value="lxd" id="lxdRadio">
<label for="lxdRadio">{{tr "LXD"}}</label>
<input type="radio" wizard_field="HYPERVISOR" name="hypervisor" value="lxc" id="lxcRadio">
<label for="lxcRadio">{{tr "LXC"}}</label>
<input type="radio" wizard_field="HYPERVISOR" name="hypervisor" value="firecracker" id="firecrackerRadio">
<label for="firecrackerRadio">{{tr "Firecracker"}}</label>
</div>
@ -121,38 +121,6 @@
</div>
</div>
</fieldset>
<fieldset class="hypervisor only_lxd" style="display: none;">
<legend>{{tr "LXD"}}</legend>
<div class="row hypervisor only_lxd" style="display: none;">
<div class="medium-6 columns">
<label for="lxd_security_privileged">
{{tr "Security Privileged"}}
</label>
<select id="lxd_security_privileged">
<option value="yes">Yes</option>
<option selected="selected" value="no">No</option>
</select>
</div>
</div>
<div class="row hypervisor only_lxd" style="display: none;">
<div class="medium-6 columns">
<label for="lxd_security_nesting">
{{tr "Security Nesting"}}
</label>
<select id="lxd_security_nesting">
<option value="yes">Yes</option>
<option selected="selected" value="no">No</option>
</select>
</div>
</div>
<div class="row hypervisor only_lxd" style="display: none;">
<div class="medium-6 columns">
<label id="lxd_profile_label">
{{tr "Profile"}}
</label>
</div>
</div>
</fieldset>
{{#isFeatureEnabled "showback"}}
<div class="row">
<div class="medium-12 columns">

View File

@ -27,10 +27,10 @@
<span class="hypervisor only_vcenter vmrc_inout_option">&nbsp;/&nbsp;VMRC</span>
<span class="hypervisor only_kvm guac_inout_option">&nbsp;/&nbsp;GUAC</span>
</label>
<input type="radio" wizard_field="TYPE" name="graphics_type" ID="radioSdlType{{uniqueId}}" value="SDL" class="hypervisor only_kvm not_lxd" >
<label class="hypervisor only_kvm not_lxd" for="radioSdlType{{uniqueId}}">SDL</label>
<input type="radio" wizard_field="TYPE" name="graphics_type" ID="radioSpiceType{{uniqueId}}" value="SPICE" class="hypervisor only_kvm not_lxd" >
<label class="hypervisor only_kvm not_lxd" for="radioSpiceType{{uniqueId}}">SPICE</label>
<input type="radio" wizard_field="TYPE" name="graphics_type" ID="radioSdlType{{uniqueId}}" value="SDL" class="hypervisor only_kvm not_lxc" >
<label class="hypervisor only_kvm not_lxc" for="radioSdlType{{uniqueId}}">SDL</label>
<input type="radio" wizard_field="TYPE" name="graphics_type" ID="radioSpiceType{{uniqueId}}" value="SPICE" class="hypervisor only_kvm not_lxc" >
<label class="hypervisor only_kvm not_lxc" for="radioSpiceType{{uniqueId}}">SPICE</label>
</div>
</div>
<br>
@ -73,7 +73,7 @@
</label>
</div>
</div>
<div class="hypervisor only_lxd">
<div class="hypervisor not_lxc">
<div class="columns large-12">
<label>
{{tr "Command"}}

View File

@ -33,7 +33,7 @@
<p><br/></p>
</div>
</div>
<div class="row not_lxd not_firecracker">
<div class="row not_lxc not_firecracker">
<div class="medium-6 columns">
<label for="DEFAULT_MODEL">
{{tr "Default hardware model to emulate for all NICs"}}
@ -41,7 +41,7 @@
<input type="text" id="DEFAULT_MODEL" name="DEFAULT_MODEL"/>
</div>
</div>
<div class="row not_lxd">
<div class="row not_lxc">
<div class="medium-6 columns">
<label for="DEFAULT_FILTER">
{{tr "Default network filtering rule for all NICs"}}

View File

@ -326,7 +326,7 @@
</div>
</div>
<div class="row nic-model-row">
<div class="medium-6 columns not_lxd">
<div class="medium-6 columns not_lxc">
<label for="MODEL">
{{tr "Hardware model to emulate"}}
</label>

View File

@ -19,16 +19,16 @@
<li class="tabs-title is-active">
<a href="#bootTab{{uniqueId}}">{{tr "Boot"}}</a>
</li>
<li class="tabs-title vm_updateconf_hide only_kvm not_lxd">
<li class="tabs-title vm_updateconf_hide only_kvm not_lxc">
<a href="#kernelTab{{uniqueId}}">{{tr "Kernel"}}</a>
</li>
<li class="tabs-title vm_updateconf_hide only_kvm not_lxd not_firecracker">
<li class="tabs-title vm_updateconf_hide only_kvm not_lxc not_firecracker">
<a href="#ramdiskTab{{uniqueId}}">{{tr "Ramdisk"}}</a>
</li>
<li class="tabs-title only_kvm not_lxd not_firecracker">
<li class="tabs-title only_kvm not_lxc not_firecracker">
<a href="#featuresTab{{uniqueId}}">{{tr "Features"}}</a>
</li>
<li class="tabs-title only_kvm not_lxd not_firecracker">
<li class="tabs-title only_kvm not_lxc not_firecracker">
<a href="#cpuTab{{uniqueId}}">{{tr "CPU Model"}}</a>
</li>
</ul>
@ -37,7 +37,7 @@
<div class="tabs-content vertical" data-tabs-content="osTabs">
<div class="wizard_internal_tab is-active tabs-panel bootTab" id="bootTab{{uniqueId}}">
<div class="row">
<div class="medium-4 columns only_kvm not_lxd not_firecracker">
<div class="medium-4 columns only_kvm not_lxc not_firecracker">
<label>
{{tr "CPU Architecture"}}
<select wizard_field="ARCH">
@ -47,12 +47,12 @@
</select>
</label>
</div>
<div class="medium-4 columns hypervisor only_kvm not_lxd not_firecracker">
<div class="medium-4 columns hypervisor only_kvm not_lxc not_firecracker">
<label id="sd-disk-bus-info">
{{tr "Bus for SD disks"}}
</label>
</div>
<div class="medium-4 columns hypervisor only_kvm not_lxd not_firecracker">
<div class="medium-4 columns hypervisor only_kvm not_lxc not_firecracker">
<label id="kvm-info">
{{tr "Machine type"}}
</label>
@ -60,7 +60,7 @@
</div>
<hr class="not_firecracker">
<div class="row">
<div class="medium-4 columns only_kvm not_lxd">
<div class="medium-4 columns only_kvm not_lxc">
<label>
{{tr "Root device"}}
<input type="text" wizard_field="ROOT" placeholder="sda1"/>
@ -81,7 +81,7 @@
</div>
<br/>
<div class="row">
<div class="large-12 columns only_kvm not_lxd">
<div class="large-12 columns only_kvm not_lxc">
<label>
{{tr "Kernel boot parameters"}}
<input type="text" wizard_field="KERNEL_CMD" placeholder="ro console=tty1"/>
@ -89,7 +89,7 @@
</div>
</div>
<div class="row not_firecracker">
<div class="large-12 columns only_kvm not_lxd">
<div class="large-12 columns only_kvm not_lxc">
<label>
{{tr "Path to the bootloader executable"}}
<input type="text" wizard_field="BOOTLOADER"/>
@ -97,7 +97,7 @@
</div>
</div>
<div class="row not_firecracker">
<div class="large-12 columns not_lxd">
<div class="large-12 columns not_lxc">
<label>
{{tr "Unique ID of the VM"}}
{{{tip (tr "Its referenced as machine ID inside the VM. Could be used to force ID for licensing purposes")}}}

View File

@ -24,7 +24,7 @@
{{tr "Type"}}
<select class="raw_type" disabled>
<option selected="select" value="kvm">{{tr "kvm"}}</option>
<option value="lxd">{{tr "lxd"}}</option>
<option value="lxc">{{tr "lxc"}}</option>
</select>
</label>
</div>

View File

@ -18,8 +18,8 @@
<div class="large-12 columns">
<input id="{{diskTabId}}radioImage" type="radio" name="{{diskTabId}}" value="image" checked>
<label for="{{diskTabId}}radioImage">{{tr "Image"}}</label>
<input id="{{diskTabId}}radioVolatile" type="radio" name="{{diskTabId}}" value="volatile" class="not_lxd">
<label for="{{diskTabId}}radioVolatile" class="not_lxd">{{tr "Volatile disk"}}</label>
<input id="{{diskTabId}}radioVolatile" type="radio" name="{{diskTabId}}" value="volatile">
<label for="{{diskTabId}}radioVolatile">{{tr "Volatile disk"}}</label>
</div>
</div>
<div id="disk_type" class="image">

View File

@ -1,9 +1,8 @@
<div class="row">
<div class="medium-6 columns hypervisor only_kvm not_firecracker">
<div class="medium-6 columns hypervisor only_kvm not_firecracker not_lxc">
<label for="TARGET">
<span class="hypervisor only_kvm"> {{tr "Target device"}} </span>
<span class="hypervisor only_lxd"> {{tr "Mountpoint"}} </span>
{{{tip (tr "Device to map image disk. If set, it will overwrite the default device mapping. In LXD this setting specifies a disk mount point like /mnt.")}}}
{{{tip (tr "Device to map image disk. If set, it will overwrite the default device mapping.")}}}
</label>
<input type="text" wizard_field="TARGET" id="TARGET" name="target" placeholder="sdc"/>
</div>
@ -17,7 +16,7 @@
<option value="no">{{tr "no"}}</option>
</select>
</div>
<div class="medium-6 columns hypervisor only_kvm not_lxd not_firecracker">
<div class="medium-6 columns hypervisor only_kvm not_lxc not_firecracker">
<label>
{{tr "BUS"}}
<select id="disk_dev_prefix" name="disk_dev_prefix">
@ -58,7 +57,7 @@
</div>
</div>
<div class="row vm_param">
<div class="medium-6 columns hypervisor only_kvm not_lxd not_firecracker">
<div class="medium-6 columns hypervisor only_kvm not_lxc not_firecracker">
<label for="CACHE">
{{tr "Cache"}}
</label>
@ -72,7 +71,7 @@
<option value="unsafe">unsafe</option>
</select>
</div>
<div class="medium-6 columns hypervisor only_kvm not_lxd not_firecracker">
<div class="medium-6 columns hypervisor only_kvm not_lxc not_firecracker">
<label for="IO">
{{tr "IO policy"}}
</label>
@ -82,7 +81,7 @@
<option value="native">native</option>
</select>
</div>
<div class="medium-6 columns hypervisor only_kvm not_lxd not_firecracker">
<div class="medium-6 columns hypervisor only_kvm not_lxc not_firecracker">
<label for="DISCARD">
{{tr "Discard"}}
</label>