From 2a3cfe4b227d43815aa1ab926e3ff1495c64a5c5 Mon Sep 17 00:00:00 2001 From: Pranav Saxena Date: Tue, 4 Jun 2013 16:58:32 +0530 Subject: [PATCH] CLOUDSTACK-2782:UI Support to add VMware DC to CloudStack zone through the zone wizard --- ui/scripts/zoneWizard.js | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js index 04ed495383b..c07ef343825 100755 --- a/ui/scripts/zoneWizard.js +++ b/ui/scripts/zoneWizard.js @@ -3366,6 +3366,49 @@ } array1.push("&clustername=" + todb(clusterName)); + if(args.data.cluster.hypervisor == "VMware"){ + + var vmwareData = { + + zoneId: args.data.returnedZone.id, + username: args.data.cluster.vCenterUsername, + password: args.data.cluster.vCenterPassword, + name: args.data.cluster.vCenterDatacenter + + }; + + $.ajax({ + url: createURL('addVmwareDc&url=' + todb(url)), + data: vmwareData, + success: function(json) { + var item = json.addvmwaredcresponse.vmwaredc; + if(item.id != null){ + $.ajax({ + url: createURL("addCluster" + array1.join("")), + dataType: "json", + async: true, + success: function(json) { + stepFns.addPrimaryStorage({ + data: $.extend(args.data, { + returnedCluster: json.addclusterresponse.cluster[0] + }) + }); + + }, + error: function(XMLHttpResponse) { + var errorMsg = parseXMLHttpResponse(XMLHttpResponse); + error('addCluster', errorMsg, { fn: 'addCluster', args: args }); + } + }); + } + + } + }); + + } + + else{ + $.ajax({ url: createURL("addCluster" + array1.join("")), dataType: "json", @@ -3391,6 +3434,8 @@ error('addCluster', errorMsg, { fn: 'addCluster', args: args }); } }); + + } }, addHost: function(args) {