From 6e21acba9fd8f06e5c4e829ffb3d3a87b01853cb Mon Sep 17 00:00:00 2001 From: Sergio Betanzos Date: Wed, 12 Feb 2020 18:34:46 +0100 Subject: [PATCH] B #4177: Fix VM scheduler requirements (#4183) --- .../templates-tab/form-panels/instantiate.js | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js index 192538002b..7bac5f427f 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js @@ -614,19 +614,23 @@ define(function(require) { function generateRequirements(hosts_table, ds_table, context, id) { var req_string = []; var req_ds_string = []; - var selected_hosts = hosts_table.retrieveResourceTableSelect(); - var selected_ds = ds_table.retrieveResourceTableSelect(); - $.each(selected_hosts, function(index, hostId) { - req_string.push("ID=\"" + hostId + "\""); - }); + if (hosts_table) { + var selected_hosts = hosts_table.retrieveResourceTableSelect(); + + $.each(selected_hosts, function(index, hostId) { + req_string.push("ID=\"" + hostId + "\""); + }); + } + if (ds_table) { + var selected_ds = ds_table.retrieveResourceTableSelect(); - $.each(selected_ds, function(index, dsId) { - req_ds_string.push("ID=\"" + dsId + "\""); - }); + $.each(selected_ds, function(index, dsId) { + req_ds_string.push("ID=\"" + dsId + "\""); + }); + } $("#SCHED_REQUIREMENTS" + id, context).val(req_string.join(" | ")); $("#SCHED_DS_REQUIREMENTS" + id, context).val(req_ds_string.join(" | ")); } - });