diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js index 9e0f9ba23d1..254fd8b2e2c 100644 --- a/ui/scripts/zoneWizard.js +++ b/ui/scripts/zoneWizard.js @@ -223,8 +223,8 @@ }).length; }, - addHost: function(args) { - return (args.groupedData.cluster.hypervisor != "VMware"); + addHost: function(args) { + return (args.groupedData.zone.hypervisor != "VMware"); }, addPrimaryStorage: function(args) { @@ -2400,7 +2400,7 @@ addCluster: function(args) { message(dictionary['message.creating.cluster']); - + // Have cluster use zone's hypervisor args.data.cluster.hypervisor = args.data.zone.hypervisor ? args.data.zone.hypervisor : args.data.cluster.hypervisor; @@ -2451,7 +2451,7 @@ }) }); } - else { //args.groupedData.cluster.hypervisor == "VMware", skip add host step + else { stepFns.addPrimaryStorage({ data: $.extend(args.data, { returnedCluster: json.addclusterresponse.cluster[0] @@ -2476,43 +2476,30 @@ array1.push("&hypervisor=" + todb(args.data.returnedCluster.hypervisortype)); var clustertype = args.data.returnedCluster.clustertype; array1.push("&clustertype=" + todb(clustertype)); - array1.push("&hosttags=" + todb(args.data.host.hosttags)); + array1.push("&hosttags=" + todb(args.data.host.hosttags)); + array1.push("&username=" + todb(args.data.host.username)); + array1.push("&password=" + todb(args.data.host.password)); - if(args.data.cluster.hypervisor == "VMware") { - array1.push("&username="); - array1.push("&password="); - var hostname = args.data.host.vcenterHost; - var url; - if(hostname.indexOf("http://")==-1) - url = "http://" + hostname; - else - url = hostname; - array1.push("&url=" + todb(url)); - } - else { - array1.push("&username=" + todb(args.data.host.username)); - array1.push("&password=" + todb(args.data.host.password)); + var hostname = args.data.host.hostname; - var hostname = args.data.host.hostname; + var url; + if(hostname.indexOf("http://")==-1) + url = "http://" + hostname; + else + url = hostname; + array1.push("&url="+todb(url)); - var url; - if(hostname.indexOf("http://")==-1) - url = "http://" + hostname; - else - url = hostname; - array1.push("&url="+todb(url)); - - if (args.data.cluster.hypervisor == "BareMetal") { - array1.push("&cpunumber=" + todb(args.data.host.baremetalCpuCores)); - array1.push("&cpuspeed=" + todb(args.data.host.baremetalCpu)); - array1.push("&memory=" + todb(args.data.host.baremetalMemory)); - array1.push("&hostmac=" + todb(args.data.host.baremetalMAC)); - } - else if(args.data.cluster.hypervisor == "Ovm") { - array1.push("&agentusername=" + todb(args.data.host.agentUsername)); - array1.push("&agentpassword=" + todb(args.data.host.agentPassword)); - } - } + if (args.data.cluster.hypervisor == "BareMetal") { + array1.push("&cpunumber=" + todb(args.data.host.baremetalCpuCores)); + array1.push("&cpuspeed=" + todb(args.data.host.baremetalCpu)); + array1.push("&memory=" + todb(args.data.host.baremetalMemory)); + array1.push("&hostmac=" + todb(args.data.host.baremetalMAC)); + } + else if(args.data.cluster.hypervisor == "Ovm") { + array1.push("&agentusername=" + todb(args.data.host.agentUsername)); + array1.push("&agentpassword=" + todb(args.data.host.agentPassword)); + } + $.ajax({ url: createURL("addHost" + array1.join("")),