cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject git commit: updated refs/heads/internallb to 0a2d493
Date Tue, 07 May 2013 22:53:13 GMT
Updated Branches:
  refs/heads/internallb 43e1667f9 -> 0a2d49301


Internal LB - UI - zone wizard - advanced zone - enable internal LB element, enable internal
LB provider.


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

Branch: refs/heads/internallb
Commit: 0a2d49301b170171ebe8d6646236854f488d06ba
Parents: 43e1667
Author: Jessica Wang <jessicawang@apache.org>
Authored: Tue May 7 15:50:41 2013 -0700
Committer: Jessica Wang <jessicawang@apache.org>
Committed: Tue May 7 15:53:03 2013 -0700

----------------------------------------------------------------------
 ui/scripts/zoneWizard.js |  104 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 104 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a2d4930/ui/scripts/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js
index b282585..9b28c32 100755
--- a/ui/scripts/zoneWizard.js
+++ b/ui/scripts/zoneWizard.js
@@ -2376,6 +2376,110 @@
                             });
 														// ***** Virtual Router ***** (end) *****
 														
+							// ***** Internal LB ***** (begin) *****
+							var internalLbProviderId;
+							$.ajax({
+								url: createURL("listNetworkServiceProviders&name=Internallbvm&physicalNetworkId="
+ thisPhysicalNetwork.id),
+								dataType: "json",
+								async: false,
+								success: function(json) {
+									var items = json.listnetworkserviceprovidersresponse.networkserviceprovider;
+									if(items != null && items.length > 0) {
+										internalLbProviderId = items[0].id;
+									}
+								}
+							});
+							if(internalLbProviderId == null) {
+								alert("error: listNetworkServiceProviders API doesn't return internalLb provider
ID");
+								return;
+							}
+
+							var internalLbElementId;
+							$.ajax({
+								url: createURL("listInternalLoadBalancerElements&nspid=" + internalLbProviderId),
+								dataType: "json",
+								async: false,
+								success: function(json) {
+									var items = json.listinternalloadbalancerelementsresponse.internalloadbalancerelement;
+									if(items != null && items.length > 0) {
+										internalLbElementId = items[0].id;
+									}
+								}
+							});
+							if(internalLbElementId == null) {
+								alert("error: listInternalLoadBalancerElements API doesn't return Internal LB Element
Id");
+								return;
+							}
+
+							$.ajax({
+								url: createURL("configureInternalLoadBalancerElement&enabled=true&id=" +
internalLbElementId),
+								dataType: "json",
+								async: false,
+								success: function(json) {
+									var jobId = json.configureinternalloadbalancerelementresponse.jobid;           
                    
+									var enableInternalLbElementIntervalID = 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(enableInternalLbElementIntervalID); 
+													
+													if (result.jobstatus == 1) { //configureVirtualRouterElement succeeded
+														$.ajax({
+															url: createURL("updateNetworkServiceProvider&state=Enabled&id=" +
internalLbProviderId),
+															dataType: "json",
+															async: false,
+															success: function(json) {
+																var jobId = json.updatenetworkserviceproviderresponse.jobid;            
                                
+																var enableInternalLbProviderIntervalID = 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(enableInternalLbProviderIntervalID); 
+																				
+																				if (result.jobstatus == 1) { //Internal LB has been enabled successfully
+																					//don't need to do anything here
+																				}
+																				else if (result.jobstatus == 2) {
+																					alert("failed to enable Internal LB Provider. Error: " + _s(result.jobresult.errortext));
+																				}
+																			}
+																		},
+																		error: function(XMLHttpResponse) {
+																			var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
+																			alert("failed to enable Internal LB Provider. Error: " + errorMsg);
+																		}
+																	});                                              
+																}, g_queryAsyncJobResultInterval); 	
+															}
+														});
+													}
+													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);
+											}
+										});                                
+									}, g_queryAsyncJobResultInterval); 	
+								}
+							});
+							// ***** Internal LB ***** (end) *****
+                            
 														if(args.data.zone.sgEnabled != true) { //Advanced SG-disabled zone
 															// ***** VPC Virtual Router ***** (begin) *****
 															var vpcVirtualRouterProviderId;


Mime
View raw message