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/master to cb8cf1e
Date Sat, 25 Jan 2014 02:32:49 GMT
Updated Branches:
  refs/heads/master 069bc3686 -> cb8cf1eb1


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.


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

Branch: refs/heads/master
Commit: cb8cf1eb18778e8cdd1bd3b870e1a2422a3d04e5
Parents: 069bc36
Author: Jessica Wang <jessicawang@apache.org>
Authored: Fri Jan 24 18:23:42 2014 -0800
Committer: Jessica Wang <jessicawang@apache.org>
Committed: Fri Jan 24 18:32:38 2014 -0800

----------------------------------------------------------------------
 ui/scripts/system.js | 113 +++++++++++++++++++++++++++++++++++++---------
 1 file changed, 91 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb8cf1eb/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 64e4f5c..870b433 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -404,7 +404,7 @@
                                         var returnedHostCount = 0;
                                         var returnedHostCpusocketsSum = 0;
                                         
-                                        var callListHostsWithPage = function (setTotalHostCount)
{
+                                    	var callListHostsWithPage = function() {           
                                    		
                                             $.ajax({
                                                 url: createURL('listHosts'),
                                                 async: false,
@@ -419,9 +419,7 @@
                                                         return;
                                                     }
                                                     
-                                                    if (setTotalHostCount) {
                                                         totalHostCount = json.listhostsresponse.count;
-                                                    }
                                                     returnedHostCount += json.listhostsresponse.host.length;
                                                     
                                                     var items = json.listhostsresponse.host;
@@ -433,13 +431,13 @@
                                                     
                                                     if (returnedHostCount < totalHostCount)
{
                                                         currentPage++;
-                                                        callListHostsWithPage(false);
+                                        				callListHostsWithPage();
                                                     }
                                                 }
                                             });
                                         }
                                         
-                                        callListHostsWithPage(true);
+                                    	callListHostsWithPage();
                                         
                                         socketCount += returnedHostCpusocketsSum;
                                     })
@@ -8419,30 +8417,30 @@
                                     }
                                 },
                                 dataProvider: function (args) {
-                                    $.ajax({
-                                        url: createURL('listHypervisors'),
-                                        success: function (json) {
+                                	var array1 = [];
+                                	
+                                	// ***** non XenServer (begin) *****
+                                	var hypervisors = ["Hyperv", "KVM", "VMware", "BareMetal",
"Ovm", "LXC"];
+                                	
                                         	var supportSocketHypervisors = {
                                         		"Hyperv": 1, 
                                         		"KVM": 1, 
-                                        		"XenServer": 1, 
                                         		"VMware": 1
                                         	};                                        	
                                         	
-                                            args.response.success({
-                                                data: $(json.listhypervisorsresponse.hypervisor).map(function
(index, hypervisor) {
+                                	for (var h = 0; h < hypervisors.length; h++) {
                                                     var totalHostCount = 0;
                                                     var currentPage = 1;
                                                     var returnedHostCount = 0;
                                                     var returnedHostCpusocketsSum = 0;
                                                     
-                                                    var callListHostsWithPage = function
(setTotalHostCount) {
+                                    	var callListHostsWithPage = function() {           
                                    		
                                                         $.ajax({
                                                             url: createURL('listHosts'),
                                                             async: false,
                                                             data: {
                                                                 type: 'routing',
-                                                                hypervisor: hypervisor.name,
+                                        			hypervisor: hypervisors[h],
                                                                 page: currentPage,
                                                                 pagesize: pageSize //global
variable
                                                             },
@@ -8451,9 +8449,7 @@
                                                                     return;
                                                                 }
                                                                 
-                                                                if (setTotalHostCount) {
                                                                     totalHostCount = json.listhostsresponse.count;
-                                                                }
                                                                 returnedHostCount += json.listhostsresponse.host.length;
                                                                 
                                                                 var items = json.listhostsresponse.host;
@@ -8465,27 +8461,100 @@
                                                                 
                                                                 if (returnedHostCount <
totalHostCount) {
                                                                     currentPage++;
-                                                                    callListHostsWithPage(false);
+                                        				callListHostsWithPage();
                                                                 }
                                                             }
                                                         });
                                                     }
                                                     
-                                                    callListHostsWithPage(true);
+                                    	callListHostsWithPage();
                                                     
-                                                	if ((hypervisor.name in supportSocketHypervisors)
== false) {                                                		
+                                    	if ((hypervisors[h] in supportSocketHypervisors) ==
false) {                                                		
                                                 		returnedHostCpusocketsSum = 'N/A';    
                                           		                                            
 		
                                                 	}
                                                 	                                       
        	
-                                                    return {
-                                                        hypervisor: hypervisor.name,
+                                    	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