From 13e66c5e78db58e45124feba26fac88b9dc68b45 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Maharana Date: Tue, 2 Feb 2016 23:23:42 +0530 Subject: [PATCH] CLOUDSTACK-9269: Missing field for Switch type for Management and Storage traffic types Showing vswitchtype for all traffic types in case of VMware. --- ui/scripts/ui-custom/zoneWizard.js | 100 ++++++++++++++--------------- 1 file changed, 49 insertions(+), 51 deletions(-) diff --git a/ui/scripts/ui-custom/zoneWizard.js b/ui/scripts/ui-custom/zoneWizard.js index f8e8e204ec94..e659df0c09df 100644 --- a/ui/scripts/ui-custom/zoneWizard.js +++ b/ui/scripts/ui-custom/zoneWizard.js @@ -310,69 +310,67 @@ }; if(zoneType == 'Advanced') { - if($trafficType.hasClass('guest') || $trafficType.hasClass('public')) { - if(trafficData.vSwitchType == null) { - var useDvs = false; + if(trafficData.vSwitchType == null) { + var useDvs = false; + $.ajax({ + url: createURL('listConfigurations'), + data: { + name: 'vmware.use.dvswitch' + }, + async: false, + success: function(json) { + if (json.listconfigurationsresponse.configuration[0].value == 'true') { + useDvs = true; + } + } + }); + if (useDvs == true) { + var useNexusDvs = false; $.ajax({ url: createURL('listConfigurations'), data: { - name: 'vmware.use.dvswitch' + name: 'vmware.use.nexus.vswitch' }, async: false, success: function(json) { if (json.listconfigurationsresponse.configuration[0].value == 'true') { - useDvs = true; + useNexusDvs = true; } } }); - if (useDvs == true) { - var useNexusDvs = false; - $.ajax({ - url: createURL('listConfigurations'), - data: { - name: 'vmware.use.nexus.vswitch' - }, - async: false, - success: function(json) { - if (json.listconfigurationsresponse.configuration[0].value == 'true') { - useNexusDvs = true; - } - } - }); - if (useNexusDvs == true) { - trafficData.vSwitchType = 'nexusdvs'; - fields.vSwitchName.defaultValue = 'epp0'; - } else { - trafficData.vSwitchType = 'vmwaredvs'; - fields.vSwitchName.defaultValue = 'dvSwitch0'; - } - } else { //useDvs == false - trafficData.vSwitchType = 'vmwaresvs'; - fields.vSwitchName.defaultValue = 'vSwitch0'; + if (useNexusDvs == true) { + trafficData.vSwitchType = 'nexusdvs'; + fields.vSwitchName.defaultValue = 'epp0'; + } else { + trafficData.vSwitchType = 'vmwaredvs'; + fields.vSwitchName.defaultValue = 'dvSwitch0'; } - } - - $.extend(fields, { - vSwitchType: { - label: 'label.vSwitch.type', - select: function (args) { - args.response.success({ - data: [{ - id: 'nexusdvs', - description: 'Cisco Nexus 1000v Distributed Virtual Switch' - }, { - id: 'vmwaresvs', - description: 'VMware vNetwork Standard Virtual Switch' - }, { - id: 'vmwaredvs', - description: 'VMware vNetwork Distributed Virtual Switch' - }] - }); - }, - defaultValue: trafficData.vSwitchType - } - }); + } else { //useDvs == false + trafficData.vSwitchType = 'vmwaresvs'; + fields.vSwitchName.defaultValue = 'vSwitch0'; + } } + + $.extend(fields, { + vSwitchType: { + label: 'label.vSwitch.type', + select: function (args) { + args.response.success({ + data: [{ + id: 'nexusdvs', + description: 'Cisco Nexus 1000v Distributed Virtual Switch' + }, { + id: 'vmwaresvs', + description: 'VMware vNetwork Standard Virtual Switch' + }, { + id: 'vmwaredvs', + description: 'VMware vNetwork Distributed Virtual Switch' + }] + }); + }, + defaultValue: trafficData.vSwitchType + } + }); } } else { fields = {