cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anim...@apache.org
Subject [1/4] git commit: updated refs/heads/4.3 to ce1b393
Date Tue, 28 Jan 2014 04:09:09 GMT
Updated Branches:
  refs/heads/4.3 43d485c92 -> ce1b393f7


CLOUDSTACK-5614: UI - Infrastructure > Sockets > listView > (1) split "XenServer"
into "XenServer 6.2.0" and "XenServer"(prior to 6.2.0).
(2) change label of Hyperv to Hyper-V.
(cherry picked from commit 81a83b5b31f0a237ae56449c60350160915f28f8)

Signed-off-by: Animesh Chaturvedi <animesh@apache.org>


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

Branch: refs/heads/4.3
Commit: 35d0c87f9d479dc4807bd012b2892049df03f049
Parents: 43d485c
Author: Jessica Wang <jessicawang@apache.org>
Authored: Fri Jan 24 18:23:42 2014 -0800
Committer: Animesh Chaturvedi <animesh@apache.org>
Committed: Mon Jan 27 19:41:50 2014 -0800

----------------------------------------------------------------------
 ui/scripts/system.js | 215 ++++++++++++++++++++++++++++++----------------
 1 file changed, 142 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35d0c87f/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 0c4f45d..960f1aa 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -397,7 +397,7 @@
                                     	var returnedHostCount = 0;
                                     	var returnedHostCpusocketsSum = 0;
                                     	                                              	
-                                    	var callListHostsWithPage = function(setTotalHostCount)
{                                                		
+                                    	var callListHostsWithPage = function() {           
                                    		
                                     		$.ajax({
                             					url: createURL('listHosts'),
                                         		async: false,
@@ -411,10 +411,8 @@
                                         			if (json.listhostsresponse.count == undefined)
{                                        				
                                         				return;
                                         			}
-                                        			                                        			
-                                        			if (setTotalHostCount) {
-                                        				totalHostCount = json.listhostsresponse.count;
-                                        			}                                            
       			
+                                        			            
+                                        			totalHostCount = json.listhostsresponse.count;
                                       			                                               
  			
                                         			returnedHostCount += json.listhostsresponse.host.length;
                                         			                                             
      			
                                         			var items = json.listhostsresponse.host;
@@ -426,13 +424,13 @@
                                         			
                                         			if (returnedHostCount < totalHostCount) {
                                         				currentPage++;
-                                        				callListHostsWithPage(false);
+                                        				callListHostsWithPage();
                                         			}                                            
       			
                                         		}
                             				});                                                		
                                     	}
                                     	
-                                    	callListHostsWithPage(true);
+                                    	callListHostsWithPage();
                                     	                                    	
                                     	socketCount += returnedHostCpusocketsSum;          
                         	                                    	
                                     })
@@ -7468,73 +7466,144 @@
                                     sockets: { label: 'label.sockets' }
                                 },
                                 dataProvider: function(args) {
-                                    $.ajax({
-                                        url: createURL('listHypervisors'),
-                                        success: function(json) {
-                                        	var supportSocketHypervisors = {
-                                        		"Hyperv": 1, 
-                                        		"KVM": 1, 
-                                        		"XenServer": 1, 
-                                        		"VMware": 1
-                                        	};                                        	
-                                        	
-                                            args.response.success({
-                                                data: $(json.listhypervisorsresponse.hypervisor).map(function(index,
hypervisor) {                                                	
-                                                	var totalHostCount = 0;                
                               	
-                                                	var currentPage = 1;
-                                                	var returnedHostCount = 0;
-                                                	var returnedHostCpusocketsSum = 0;
-                                                	                                       
        	                                                	
-                                                	var callListHostsWithPage = function(setTotalHostCount)
{                                                		
-                                                		$.ajax({
-                                        					url: createURL('listHosts'),
-                                                    		async: false,
-                                                    		data: {
-                                                    			type: 'routing',
-                                                    			hypervisor: hypervisor.name,
-                                                    			page: currentPage,
-                                                    	        pagesize: pageSize //global
variable
-                                                    		},
-                                                    		success: function(json) {   
-                                                    			if (json.listhostsresponse.count ==
undefined) {   
-                                                    				return;
-                                                    			}                                
                   			
-                                                    			
-                                                    			if (setTotalHostCount) {
-                                                    				totalHostCount = json.listhostsresponse.count;
-                                                    			}                                
                   			
-                                                    			returnedHostCount += json.listhostsresponse.host.length;
-                                                    			                                 
                  			
-                                                    			var items = json.listhostsresponse.host;
-                                                    			for (var i = 0; i < items.length;
i++) {
-                                                    				if (items[i].cpusockets != undefined
&& isNaN(items[i].cpusockets) == false) {
-                                                    					returnedHostCpusocketsSum += items[i].cpusockets;
-                                                    				} 
-                                                    			}  
-                                                    			
-                                                    			if (returnedHostCount < totalHostCount)
{
-                                                    				currentPage++;
-                                                    				callListHostsWithPage(false);
-                                                    			}                                
                   			
-                                                    		}
-                                        				});                                         
      		
-                                                	}
-                                                	
-                                                	callListHostsWithPage(true);
-                                                	                                       
          	
-                                                	if ((hypervisor.name in supportSocketHypervisors)
== false) {                                                		
-                                                		returnedHostCpusocketsSum = 'N/A';    
                                           		                                            
 		
-                                                	}
-                                                	                                       
        	
-                                                    return {
-                                                        hypervisor: hypervisor.name,
-                                                        hosts: totalHostCount,
-                                                        sockets: returnedHostCpusocketsSum
                                                   
-                                                    };
-                                                })
-                                            });
-                                        }
+                                	var array1 = [];
+                                	
+                                	// ***** non XenServer (begin) *****
+                                	var hypervisors = ["Hyperv", "KVM", "VMware", "BareMetal",
"Ovm", "LXC"];
+                                	
+                                	var supportSocketHypervisors = {
+                                		"Hyperv": 1, 
+                                		"KVM": 1, 
+                                		"VMware": 1                              		
+                                	};      
+                                	
+                                	for (var h = 0; h < hypervisors.length; h++) {
+                                		var totalHostCount = 0;                               
                	
+                                    	var currentPage = 1;
+                                    	var returnedHostCount = 0;
+                                    	var returnedHostCpusocketsSum = 0;
+                                    	                                                	  
                                             	
+                                    	var callListHostsWithPage = function() {           
                                    		
+                                    		$.ajax({
+                            					url: createURL('listHosts'),
+                                        		async: false,
+                                        		data: {
+                                        			type: 'routing',
+                                        			hypervisor: hypervisors[h],
+                                        			page: currentPage,
+                                        	        pagesize: pageSize //global variable
+                                        		},
+                                        		success: function(json) {   
+                                        			if (json.listhostsresponse.count == undefined)
{   
+                                        				return;
+                                        			}           
+                                        			
+                                        			totalHostCount = json.listhostsresponse.count;
                                       			                                               
    			
+                                        			returnedHostCount += json.listhostsresponse.host.length;
+                                        			                                             
      			
+                                        			var items = json.listhostsresponse.host;
+                                        			for (var i = 0; i < items.length; i++) {
+                                        				if (items[i].cpusockets != undefined &&
isNaN(items[i].cpusockets) == false) {
+                                        					returnedHostCpusocketsSum += items[i].cpusockets;
+                                        				} 
+                                        			}  
+                                        			
+                                        			if (returnedHostCount < totalHostCount) {
+                                        				currentPage++;
+                                        				callListHostsWithPage();
+                                        			}                                            
       			
+                                        		}
+                            				});                                                		
+                                    	}
+                                    	
+                                    	callListHostsWithPage();
+                                    	                                                  	
+                                    	if ((hypervisors[h] in supportSocketHypervisors) ==
false) {                                                		
+                                    		returnedHostCpusocketsSum = 'N/A';                
                               		                                              		
+                                    	}
+                                    	
+                                    	var hypervisorName = hypervisors[h];
+                                    	if (hypervisorName == "Hyperv") {
+                                    		hypervisorName = "Hyper-V";
+                                    	}
+                                    	
+                                    	array1.push({
+                                            hypervisor: hypervisorName,
+                                            hosts: totalHostCount,
+                                            sockets: returnedHostCpusocketsSum          
                                         
+                                        });               		
+                                	}
+                                	// ***** non XenServer (end) *****
+                                	
+                                	
+                                	// ***** XenServer (begin) *****
+                                	var totalHostCount = 0;                                
               	
+                                	var currentPage = 1;
+                                	var returnedHostCount = 0;
+                                	
+                                	var returnedHostCountForXenServer = 0;
+                                	var returnedHostCountForXenServer620 = 0;              
                  	
+                                	var returnedHostCpusocketsSumForXenServer620 = 0;    
+                                	
+                                	var callListHostsWithPage = function() {               
                                		
+                                		$.ajax({
+                        					url: createURL('listHosts'),
+                                    		async: false,
+                                    		data: {
+                                    			type: 'routing',
+                                    			hypervisor: 'XenServer',
+                                    			page: currentPage,
+                                    	        pagesize: pageSize //global variable
+                                    		},
+                                    		success: function(json) {   
+                                    			if (json.listhostsresponse.count == undefined) { 
 
+                                    				return;
+                                    			}           
+                                    			
+                                    			totalHostCount = json.listhostsresponse.count;   
                                    			                                                  
 			
+                                    			returnedHostCount += json.listhostsresponse.host.length;
+                                    			                                                 
  			
+                                    			var items = json.listhostsresponse.host;
+                                    			for (var i = 0; i < items.length; i++) {
+                                    				//"hypervisorversion" == "6.2.0"
+                                    				if (items[i].hypervisorversion == "6.2.0") {
+                                    					returnedHostCountForXenServer620 ++;
+                                    					if (items[i].cpusockets != undefined &&
isNaN(items[i].cpusockets) == false) {
+                                        					returnedHostCpusocketsSumForXenServer620 +=
items[i].cpusockets;
+                                        				} 
+                                    				} else {
+                                    					returnedHostCountForXenServer++;
+                                    				}
+                                    			}  
+                                    			
+                                    			if (returnedHostCount < totalHostCount) {
+                                    				currentPage++;
+                                    				callListHostsWithPage();
+                                    			}                                                
   			
+                                    		}
+                        				});                                                		
+                                	}
+                                	
+                                	callListHostsWithPage();                               
	                                                  	
+                                	
+                                	array1.push({
+                                        hypervisor: 'XenServer',
+                                        hosts: returnedHostCountForXenServer,
+                                        sockets: 'N/A'                                  
                
+                                    });
+                                	
+                                	array1.push({
+                                        hypervisor: 'XenServer 6.2.0',
+                                        hosts: returnedHostCountForXenServer620,
+                                        sockets: returnedHostCpusocketsSumForXenServer620
                                                   
                                     });
+                                	// ***** XenServer (end) *****
+                                	
+                                	
+                                	args.response.success({
+                                        data: array1
+                                    });
+                                	
                                 }
                             };
 


Mime
View raw message