incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject git commit: cloudstack 3.0 UI - VPC - add zone wizard - enable VpcVirtualRouter element, enable VpcVirtualRouter provider for advanced zone.
Date Fri, 20 Jul 2012 22:49:47 GMT
Updated Branches:
  refs/heads/vpc dc847ed83 -> 254c05813


cloudstack 3.0 UI - VPC - add zone wizard - enable VpcVirtualRouter element, enable VpcVirtualRouter
provider for advanced zone.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/254c0581
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/254c0581
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/254c0581

Branch: refs/heads/vpc
Commit: 254c05813c1972266a656ad610004248a0cf4fb3
Parents: dc847ed
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Fri Jul 20 15:49:13 2012 -0700
Committer: Jessica Wang <jessica.wang@citrix.com>
Committed: Fri Jul 20 15:49:13 2012 -0700

----------------------------------------------------------------------
 ui/scripts/zoneWizard.js |  119 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 115 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/254c0581/ui/scripts/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js
index 92015bb..e4ca36d 100644
--- a/ui/scripts/zoneWizard.js
+++ b/ui/scripts/zoneWizard.js
@@ -14,6 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
+
 (function(cloudStack, $) {
   var selectedNetworkOfferingHavingSG = false;
   var selectedNetworkOfferingHavingEIP = false;
@@ -1230,7 +1231,7 @@
     },
 
     action: function(args) {
-      var advZoneConfiguredPhysicalNetworkCount = 0; //for multiple physical networks in
advanced zone
+      var advZoneConfiguredVirtualRouterCount = 0; //for multiple physical networks in advanced
zone. Each physical network has 2 virtual routers: regular one and VPC one.
 
       var success = args.response.success;
       var error = args.response.error;
@@ -1878,7 +1879,7 @@
                           if (result.jobstatus == 1) {
                             //alert("updatePhysicalNetwork succeeded.");
 
-                            // get network service provider ID of Virtual Router
+                            // ***** Virtual Router ***** (begin) *****
                             var virtualRouterProviderId;
                             $.ajax({
                               url: createURL("listNetworkServiceProviders&name=VirtualRouter&physicalNetworkId="
+ thisPhysicalNetwork.id),
@@ -1951,8 +1952,8 @@
 																											clearInterval(enableVirtualRouterProviderIntervalID); 
 																											
                                                       if (result.jobstatus == 1) { //Virtual
Router Provider has been enabled successfully
-                                                        advZoneConfiguredPhysicalNetworkCount++;
-                                                        if(advZoneConfiguredPhysicalNetworkCount
== args.data.returnedPhysicalNetworks.length) { //not call addPod() until all physical networks
get configured
+                                                        advZoneConfiguredVirtualRouterCount++;
+                                                        if(advZoneConfiguredVirtualRouterCount
== (args.data.returnedPhysicalNetworks.length * 2)) { //not call addPod() until virtualRouter
and vpcVirtualRouter of all physical networks get configured
                                                           stepFns.addPod({
                                                             data: args.data
                                                           });
@@ -1985,6 +1986,116 @@
 																}, 3000); 	
                               }
                             });
+														// ***** Virtual Router ***** (end) *****
+														
+														// ***** VPC Virtual Router ***** (begin) *****
+                            var vpcVirtualRouterProviderId;
+                            $.ajax({
+                              url: createURL("listNetworkServiceProviders&name=VpcVirtualRouter&physicalNetworkId="
+ thisPhysicalNetwork.id),
+                              dataType: "json",
+                              async: false,
+                              success: function(json) {
+                                var items = json.listnetworkserviceprovidersresponse.networkserviceprovider;
+                                if(items != null && items.length > 0) {
+                                  vpcVirtualRouterProviderId = items[0].id;
+                                }
+                              }
+                            });
+                            if(vpcVirtualRouterProviderId == null) {
+                              alert("error: listNetworkServiceProviders API doesn't return
VpcVirtualRouter provider ID");
+                              return;
+                            }
+
+                            var vpcVirtualRouterElementId;
+                            $.ajax({
+                              url: createURL("listVirtualRouterElements&nspid=" + vpcVirtualRouterProviderId),
+                              dataType: "json",
+                              async: false,
+                              success: function(json) {
+                                var items = json.listvirtualrouterelementsresponse.virtualrouterelement;
+                                if(items != null && items.length > 0) {
+                                  vpcVirtualRouterElementId = items[0].id;
+                                }
+                              }
+                            });
+                            if(vpcVirtualRouterElementId == null) {
+                              alert("error: listVirtualRouterElements API doesn't return
VPC Virtual Router Element Id");
+                              return;
+                            }
+
+                            $.ajax({
+                              url: createURL("configureVirtualRouterElement&enabled=true&id="
+ vpcVirtualRouterElementId),
+                              dataType: "json",
+                              async: false,
+                              success: function(json) {
+                                var jobId = json.configurevirtualrouterelementresponse.jobid;
                               
+																var enableVpcVirtualRouterElementIntervalID = setInterval(function() { 	
+                                  $.ajax({
+                                    url: createURL("queryAsyncJobResult&jobId="+jobId),
+                                    dataType: "json",
+                                    success: function(json) {
+                                      var result = json.queryasyncjobresultresponse;
+                                      if (result.jobstatus == 0) {
+                                        return; //Job has not completed
+                                      }
+                                      else {                                        
+																				clearInterval(enableVpcVirtualRouterElementIntervalID); 
+																				
+                                        if (result.jobstatus == 1) { //configureVirtualRouterElement
succeeded
+                                          $.ajax({
+                                            url: createURL("updateNetworkServiceProvider&state=Enabled&id="
+ vpcVirtualRouterProviderId),
+                                            dataType: "json",
+                                            async: false,
+                                            success: function(json) {
+                                              var jobId = json.updatenetworkserviceproviderresponse.jobid;
                                            
+																							var enableVpcVirtualRouterProviderIntervalID = setInterval(function()
{ 	
+                                                $.ajax({
+                                                  url: createURL("queryAsyncJobResult&jobId="+jobId),
+                                                  dataType: "json",
+                                                  success: function(json) {
+                                                    var result = json.queryasyncjobresultresponse;
+                                                    if (result.jobstatus == 0) {
+                                                      return; //Job has not completed
+                                                    }
+                                                    else {                              
                       
+																											clearInterval(enableVpcVirtualRouterProviderIntervalID); 
+																											
+                                                      if (result.jobstatus == 1) { //Virtual
Router Provider has been enabled successfully
+                                                        advZoneConfiguredVirtualRouterCount++;
+                                                        if(advZoneConfiguredVirtualRouterCount
== (args.data.returnedPhysicalNetworks.length * 2)) { //not call addPod() until virtualRouter
and vpcVirtualRouter of all physical networks get configured
+                                                          stepFns.addPod({
+                                                            data: args.data
+                                                          });
+                                                        }
+                                                      }
+                                                      else if (result.jobstatus == 2) {
+                                                        alert("failed to enable VPC Virtual
Router Provider. Error: " + _s(result.jobresult.errortext));
+                                                      }
+                                                    }
+                                                  },
+                                                  error: function(XMLHttpResponse) {
+                                                    var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
+                                                    alert("updateNetworkServiceProvider failed.
Error: " + errorMsg);
+                                                  }
+                                                });                                     
        
+																							}, 3000); 	
+                                            }
+                                          });
+                                        }
+                                        else if (result.jobstatus == 2) {
+                                          alert("configureVirtualRouterElement failed. Error:
" + _s(result.jobresult.errortext));
+                                        }
+                                      }
+                                    },
+                                    error: function(XMLHttpResponse) {
+                                      var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
+                                      alert("configureVirtualRouterElement failed. Error:
" + errorMsg);
+                                    }
+                                  });                                
+																}, 3000); 	
+                              }
+                            });
+														// ***** VPC Virtual Router ***** (end) *****
                           }
                           else if (result.jobstatus == 2) {
                             alert("updatePhysicalNetwork failed. Error: " + _s(result.jobresult.errortext));


Mime
View raw message