diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index 7bc5086441..c8ef6d0e79 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -56,6 +56,12 @@ features: # True to show the option to make an instance persistent instantiate_persistent: true + # True to show the datastore datatable to instantiate VM + show_ds_instantiate: true + + # True to show the host datatable to instantiate VM + show_host_instantiate: true + # True to show an input to specify the the VMs and Template path/folder where a vCenter VM will # deployed to vcenter_vm_folder: false diff --git a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml index 5583046484..3c9b6ed7dc 100644 --- a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml @@ -56,6 +56,12 @@ features: # True to show the option to make an instance persistent instantiate_persistent: true + # True to show the datastore datatable to instantiate VM + show_ds_instantiate: false + + # True to show the host datatable to instantiate VM + show_host_instantiate: false + # True to show an input to specify the the VMs and Template path/folder where a vCenter VM will # deployed to vcenter_vm_folder: true diff --git a/src/sunstone/etc/sunstone-views/cloud.yaml b/src/sunstone/etc/sunstone-views/cloud.yaml index e0399756d4..428b71a36c 100644 --- a/src/sunstone/etc/sunstone-views/cloud.yaml +++ b/src/sunstone/etc/sunstone-views/cloud.yaml @@ -88,6 +88,8 @@ tabs: vmgroup_select: true # True to allow DISK size customization disk_resize: true + # True to allow datastore customization + datastore_select: true settings-tab: panel_tabs: settings_info_tab: false @@ -153,4 +155,20 @@ tabs: - 4 # Owner - 5 # Vms #- 6 # Labels - #- 7 # Search data \ No newline at end of file + #- 7 # Search data + datastores-tab: + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + #- 5 # Capacity + #- 6 # Cluster + #- 7 # Basepath + #- 8 # TM + #- 9 # DS + #- 10 # Type + - 11 # Status + #- 12 # Labels + #- 13 # Search data \ No newline at end of file diff --git a/src/sunstone/etc/sunstone-views/groupadmin.yaml b/src/sunstone/etc/sunstone-views/groupadmin.yaml index 230a0ccee8..1795a6e60d 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin.yaml @@ -56,6 +56,12 @@ features: # True to show the option to make an instance persistent instantiate_persistent: true + # True to show the datastore datatable to instantiate VM + show_ds_instantiate: false + + # True to show the host datatable to instantiate VM + show_host_instantiate: false + # True to show an input to specify the the VMs and Template path/folder where a vCenter VM will # deployed to vcenter_vm_folder: false diff --git a/src/sunstone/etc/sunstone-views/user.yaml b/src/sunstone/etc/sunstone-views/user.yaml index 219138323b..d7c8af53a0 100644 --- a/src/sunstone/etc/sunstone-views/user.yaml +++ b/src/sunstone/etc/sunstone-views/user.yaml @@ -56,6 +56,12 @@ features: # True to show the option to make an instance persistent instantiate_persistent: true + # True to show the datastore datatable to instantiate VM + show_ds_instantiate: false + + # True to show the host datatable to instantiate VM + show_host_instantiate: false + # True to show an input to specify the the VMs and Template path/folder where a vCenter VM will # deployed to vcenter_vm_folder: false diff --git a/src/sunstone/public/app/tabs/provision-tab.js b/src/sunstone/public/app/tabs/provision-tab.js index 30638bdd61..c418d787e8 100644 --- a/src/sunstone/public/app/tabs/provision-tab.js +++ b/src/sunstone/public/app/tabs/provision-tab.js @@ -40,6 +40,8 @@ define(function(require) { var UserInputs = require('utils/user-inputs'); var CapacityInputs = require('tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-inputs'); var LabelsUtils = require('utils/labels/utils'); + var DatastoresTable = require('tabs/datastores-tab/datatable'); + var UniqueId = require('utils/unique-id'); var ProvisionVmsList = require('./provision-tab/vms/list'); var ProvisionTemplatesList = require('./provision-tab/templates/list'); @@ -92,6 +94,7 @@ define(function(require) { $("#vm_name", context).val(''); $(".provision_selected_networks").html(""); $(".provision_vmgroup_selector").html(""); + $(".provision_ds_selector").html(""); $(".provision-pricing-table", context).removeClass("selected"); $(".alert-box-error", context).hide(); $(".total_cost_div", context).hide(); @@ -569,8 +572,10 @@ define(function(require) { $("#provision_create_vm .provision_disk_selector").removeData("template_json"); $("#provision_create_vm .provision_network_selector").html(""); $("#provision_create_vm .provision_vmgroup_selector").html(""); + $("#provision_create_vm .provision_ds_selector").html(""); $("#provision_create_vm .provision_add_vmgroup").show(); $("#provision_create_vm .provision_vmgroup").hide(); + $("#provision_create_vm .provision_ds").hide(); $("#provision_create_vm .provision_custom_attributes_selector").html("") @@ -595,12 +600,13 @@ define(function(require) { $(".provision_vmgroup_selector", context).html(""); $(".provision_add_vmgroup", context).show(); $(".provision_vmgroup", context).hide(); + //$(".provision_ds", context).hide(); $(".provision_custom_attributes_selector", context).html(""); $(".provision_accordion_flow_template .selected_template", context).hide(); $(".provision_accordion_flow_template .select_template", context).show(); - $("li:not(.is-active) a[href='#provision_dd_flow_template']", context).trigger("click") + $("li:not(.is-active) a[href='#provision_dd_flow_template']", context).trigger("click"); $(".total_cost_div", context).hide(); $(".alert-box-error", context).hide(); @@ -946,6 +952,7 @@ define(function(require) { $(".provision_accordion_template a").first().trigger("click"); $("#provision_create_vm .provision_vmgroup").show(); + $("#provision_create_vm .provision_ds").show(); OpenNebula.Template.show({ data : { id: template_id, @@ -983,11 +990,45 @@ define(function(require) { } if (Config.provision.create_vm.isEnabled("vmgroup_select")) { + $(".provision_vmgroup_selector", create_vm_context).html(""); + $("#provision_create_vm .provision_add_vmgroup").show(); VMGroupSection.insert(template_json, $(".vmgroupContext", create_vm_context)); } else { $(".provision_vmgroup_selector", create_vm_context).html(""); } + if (Config.provision.create_vm.isEnabled("datastore_select")) { + $(".provision_ds_selector", create_vm_context).html(""); + var options = { + 'select': true, + 'selectOptions': { + 'multiple_choice': true + } + } + this.datastoresTable = new DatastoresTable('DatastoresTable' + UniqueId.id(), options); + $(".provision_ds_selector", create_vm_context).html(this.datastoresTable.dataTableHTML); + this.datastoresTable.initialize(); + this.datastoresTable.filter("system", 10); + this.datastoresTable.refreshResourceTableSelect(); + if(template_json.VMTEMPLATE.TEMPLATE.SCHED_DS_REQUIREMENTS){ + var dsReqJSON = template_json.VMTEMPLATE.TEMPLATE.SCHED_DS_REQUIREMENTS; + var dsReq = TemplateUtils.escapeDoubleQuotes(dsReqJSON); + var ds_id_regexp = /(\s|\||\b)ID=\\"([0-9]+)\\"/g; + var ds = []; + while (match = ds_id_regexp.exec(dsReq)) { + ds.push(match[2]); + } + var selectedResources = { + ids : ds + } + this.datastoresTable.selectResourceTableSelect(selectedResources); + $(".provision_ds_selector", create_vm_context).data("dsTable", this.datastoresTable); + } + } else { + $(".provision_ds_selector", create_vm_context).html(""); + $(".provision_ds", create_vm_context).hide(); + } + if (template_json.VMTEMPLATE.TEMPLATE.USER_INPUTS) { UserInputs.vmTemplateInsert( $(".provision_custom_attributes_selector", create_vm_context), @@ -1044,6 +1085,20 @@ define(function(require) { $.extend(extra_info.template, vmgroup); } + var dsTable = $(".provision_ds_selector", context).data("dsTable"); + if(dsTable != undefined){ + var req_string = []; + var ds = dsTable.retrieveResourceTableSelect(); + if(ds){ + $.each(ds, function(index, dsId) { + req_string.push('ID="' + dsId + '"'); + }); + req_string = req_string.join(" | "); + req_string = TemplateUtils.escapeDoubleQuotes(req_string); + extra_info.template.SCHED_DS_REQUIREMENTS = req_string; + } + } + if (nics.length > 0) { extra_info.template.nic = nics; } diff --git a/src/sunstone/public/app/tabs/provision-tab/vms/create.hbs b/src/sunstone/public/app/tabs/provision-tab/vms/create.hbs index 7f2fd3ac8f..56544be5fe 100644 --- a/src/sunstone/public/app/tabs/provision-tab/vms/create.hbs +++ b/src/sunstone/public/app/tabs/provision-tab/vms/create.hbs @@ -140,4 +140,14 @@ +