DV Switch UI Integration -Set 1
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/1b94047b Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/1b94047b Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/1b94047b Branch: refs/heads/master Commit: 1b94047bd877f12c2a0c6db6e79ac9bebaac6c72 Parents: f30da78 Author: Pranav Saxena <[email protected]> Authored: Wed Feb 27 14:53:07 2013 +0530 Committer: Pranav Saxena <[email protected]> Committed: Wed Feb 27 14:53:07 2013 +0530 ---------------------------------------------------------------------- ui/scripts/system.js | 58 +++++++++++++++++++++++++++++++++++++++++ ui/scripts/zoneWizard.js | 57 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 113 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1b94047b/ui/scripts/system.js ---------------------------------------------------------------------- diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 3d99612..4e95652 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -7347,6 +7347,7 @@ docID: 'helpClusterHypervisor', select: function(args) { var vSwitchEnabled = false; + var dvSwitchEnabled = false; $.ajax({ url: createURL("listHypervisors"), @@ -7375,6 +7376,21 @@ } } }); + + //Check whether dvSwitch is enabled or not + $.ajax({ + url: createURL('listConfigurations'), + data: { + name: 'vmware.use.dvswitch' + }, + async: false, + success: function(json) { + if (json.listconfigurationsresponse.configuration[0].value == 'true') { + dvSwitchEnabled = true; + } + } + }); + args.$select.bind("change", function(event) { var $form = $(this).closest('form'); @@ -7390,6 +7406,16 @@ if ($(this).val() == "VMware") { //$('li[input_sub_group="external"]', $dialogAddCluster).show(); + + if(dvSwitchEnabled ){ + $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'inline-block'); + $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'inline-block'); + } + else { + $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'none'); + $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'none'); + + } $form.find('.form-item[rel=vCenterHost]').css('display', 'inline-block'); $form.find('.form-item[rel=vCenterUsername]').css('display', 'inline-block'); $form.find('.form-item[rel=vCenterPassword]').css('display', 'inline-block'); @@ -7453,6 +7479,31 @@ }, //hypervisor==VMWare begins here + vSwitchPublicType:{ + label: 'Public Traffic vSwitch Type', + select: function(args) { + var items = [] + + items.push({id: "" , description:" " }); + + items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"}); + items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"}); + args.response.success({data: items}); + }, + isHidden:true + }, + vSwitchGuestType:{ + label: 'Guest Traffic vSwitch Type', + select: function(args) { + var items = [] + items.push({id: "" , description:" " }); + items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"}); + items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"}); + args.response.success({data: items}); + }, + isHidden:true + }, + vCenterHost: { label: 'label.vcenter.host', docID: 'helpClustervCenterHost', @@ -7519,6 +7570,13 @@ if(args.data.hypervisor == "VMware") { array1.push("&username=" + todb(args.data.vCenterUsername)); array1.push("&password=" + todb(args.data.vCenterPassword)); + + if(args.data.vSwitchPublicType != "") + array1.push('&vswitchtypepublic=' + args.data.vSwitchPublicType); + + if(args.data.vSwitchGuestType != "") + array1.push('&vswitchtypeguest=' + args.data.vSwitchGuestType); + if (args.data.vsmipaddress) { array1.push('&vsmipaddress=' + args.data.vsmipaddress); http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1b94047b/ui/scripts/zoneWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js index 8b5171b..a5c5209 100755 --- a/ui/scripts/zoneWizard.js +++ b/ui/scripts/zoneWizard.js @@ -732,7 +732,7 @@ }); var vSwitchEnabled = false; - + var dvSwitchEnabled = false; // Check whether vSwitch capability is enabled $.ajax({ url: createURL('listConfigurations'), @@ -747,6 +747,17 @@ } }); + //Check whether dvSwitch is enabled or not + $.ajax({ + url: createURL('listConfigurations'), + data: { + name: 'vmware.use.dvswitch' + }, + async: false, + success: function(json) { if (json.listconfigurationsresponse.configuration[0].value == 'true') { dvSwitchEnabled = true; + } + } }); + args.$select.bind("change", function(event) { var $form = $(this).closest('form'); var $vsmFields = $form.find('[rel]').filter(function() { @@ -761,6 +772,15 @@ if($(this).val() == "VMware") { //$('li[input_sub_group="external"]', $dialogAddCluster).show(); + if(dvSwitchEnabled ){ + $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'inline-block'); + $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'inline-block'); + } + else { + $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'none'); + $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'none'); + } + $form.find('[rel=vCenterHost]').css('display', 'block'); $form.find('[rel=vCenterUsername]').css('display', 'block'); $form.find('[rel=vCenterPassword]').css('display', 'block'); @@ -791,6 +811,32 @@ }, //hypervisor==VMWare begins here + + vSwitchPublicType:{ + label: 'Public Traffic vSwitch Type', + select: function(args) { + var items = [] + + items.push({id: " ", description: " "}); + + items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"}); + items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"}); + args.response.success({data: items}); + }, + isHidden:true + }, + vSwitchGuestType:{ + label: 'Guest Traffic vSwitch Type', + select: function(args) { + var items = [] + items.push({ id:" ", description:" "}); + + items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"}); + items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"}); + args.response.success({data: items}); + }, isHidden:true + }, + vCenterHost: { label: 'label.vcenter.host', validation: { required: true } @@ -2917,7 +2963,14 @@ array1.push("&username=" + todb(args.data.cluster.vCenterUsername)); array1.push("&password=" + todb(args.data.cluster.vCenterPassword)); - if (args.data.cluster.vsmipaddress) { // vSwitch is enabled + //dvswitch is enabled + if(args.data.cluster.vSwitchPublicType != "") + array1.push('&vswitchtypepublic=' + args.data.cluster.vSwitchPublicType); + + if(args.data.cluster.vSwitchGuestType != "") + array1.push('&vswitchtypeguest=' + args.data.cluster.vSwitchGuestType); + + if (args.data.cluster.vsmipaddress) { // vSwitch is enabled array1.push('&vsmipaddress=' + args.data.cluster.vsmipaddress); array1.push('&vsmusername=' + args.data.cluster.vsmusername); array1.push('&vsmpassword=' + args.data.cluster.vsmpassword);
