Hi,

I think I remember someone asking on this list if it was possible to add the IP addresses used by a VM to the list of VMs in sunstone.

We got the same request from our users, so we slightly changed the vm tab in /usr/lib/one/sunstone/public/js/plugins to make this happen. (Please remember, we use ONE-3.2.1)

We also removed the CPU and MEMORY columns because those values were very confusing for our users. They asked for 20 cpu cores and in the list it sais '1'. It was unclear that this was "usage".

Anyway, since we bill by resource allocation and not usage (we do not over-commit), that info was not very useful anyway.

I did try to put the requested amount of CPU in there instead, however the vm object in that function does not have that value in the TEMPLATE array, which I found strange... (MEMORY is present btw.)

Anyway, if anyone can use this, feel free.

Wkr,

Jhon

--
Jhon Masschelein
Senior Systeemprogrammeur
SARA - HPCV

Science Park 140
1098 XG Amsterdam
T +31 (0)20 592 8099
F +31 (0)20 668 3167
M +31 (0)6 4748 9328
E [email protected]
http://www.sara.nl
Index: vms-tab.js
===================================================================
--- vms-tab.js	(revision 30)
+++ vms-tab.js	(revision 31)
@@ -60,8 +60,7 @@
       <th>'+tr("Group")+'</th>\
       <th>'+tr("Name")+'</th>\
       <th>'+tr("Status")+'</th>\
-      <th>'+tr("CPU")+'</th>\
-      <th>'+tr("Memory")+'</th>\
+      <th>'+tr("Network")+'</th>\
       <th>'+tr("Hostname")+'</th>\
       <th>'+tr("Start Time")+'</th>\
       <th>'+tr("VNC Access")+'</th>\
@@ -630,6 +629,19 @@
         state = OpenNebula.Helper.resource_state("vm_lcm",vm.LCM_STATE);
     };
 
+    var ips = "No Networks defined";
+    if (vm.TEMPLATE.NIC != undefined) {
+        if (vm.TEMPLATE.NIC.constructor == Array) {
+	    ips = "IP = [ ";
+            for (field = 0; field < vm.TEMPLATE.NIC.length; ++field){
+                ips += vm.TEMPLATE.NIC[field].IP + ", ";
+            }	
+    	    ips = ips.slice(0, -2) + " ]";
+        } else {
+    	    ips = "IP = " + vm.TEMPLATE.NIC.IP;
+        }
+    }
+
     return [
         '<input class="check_item" type="checkbox" id="vm_'+vm.ID+'" name="selected_items" value="'+vm.ID+'"/>',
         vm.ID,
@@ -637,8 +649,7 @@
         vm.GNAME,
         vm.NAME,
         state,
-        vm.CPU,
-        humanize_size(vm.MEMORY),
+        ips,
         hostname,
         str_start_time(vm),
         vncIcon(vm)
@@ -1267,9 +1278,9 @@
         "bAutoWidth":false,
         "aoColumnDefs": [
             { "bSortable": false, "aTargets": ["check"] },
-            { "sWidth": "60px", "aTargets": [0,6,7] },
-            { "sWidth": "35px", "aTargets": [1,10] },
-            { "sWidth": "150px", "aTargets": [5,9] },
+            { "sWidth": "60px", "aTargets": [0] },
+            { "sWidth": "35px", "aTargets": [1,9] },
+            { "sWidth": "150px", "aTargets": [5,8] },
             { "sWidth": "100px", "aTargets": [2,3] }
         ],
         "oLanguage": (datatable_lang != "") ?
_______________________________________________
Users mailing list
[email protected]
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org

Reply via email to