[Ovirt-devel] [PATCH] integrate "which vm is running on which node" in ui

Mohammed Morsi mmorsi at redhat.com
Mon Oct 6 17:17:23 UTC 2008


---
 src/app/controllers/application.rb     |    2 +-
 src/app/controllers/pool_controller.rb |    1 +
 src/app/views/host/show.rhtml          |    2 ++
 src/app/views/vm/_grid.rhtml           |    3 +++
 4 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/app/controllers/application.rb b/src/app/controllers/application.rb
index 6dcf6f8..593210e 100644
--- a/src/app/controllers/application.rb
+++ b/src/app/controllers/application.rb
@@ -105,7 +105,7 @@ class ApplicationController < ActionController::Base
       item_hash[:cell] = attributes.collect do |attr| 
         if attr.is_a? Array
           value = item
-          attr.each { |attr_item| value = value.send(attr_item)}
+          attr.each { |attr_item| value = (value.nil? ? nil : value.send(attr_item))}
           value
         else
           item.send(attr)
diff --git a/src/app/controllers/pool_controller.rb b/src/app/controllers/pool_controller.rb
index 02ef290..efdcf91 100644
--- a/src/app/controllers/pool_controller.rb
+++ b/src/app/controllers/pool_controller.rb
@@ -110,6 +110,7 @@ class PoolController < ApplicationController
     attr_list = [:id, :description, :uuid,
                  :num_vcpus_allocated, :memory_allocated_in_mb,
                  :vnic_mac_addr, :state, :id]
+    attr_list.insert(3, [:host, :hostname]) if @pool.get_hardware_pool.can_view(@user)
     json_list(args[:full_items], attr_list, [:all], args[:find_opts])
   end
 
diff --git a/src/app/views/host/show.rhtml b/src/app/views/host/show.rhtml
index b5582f6..b8267ea 100644
--- a/src/app/views/host/show.rhtml
+++ b/src/app/views/host/show.rhtml
@@ -46,6 +46,7 @@
 	Architecture:<br/>    
 	Hypervisor Type:<br/> 
         Status:<br/>
+        VMs:<br/>
     </div>
     <div class="selection_value">
     	<%=h @host.uuid %><br/>
@@ -55,6 +56,7 @@
         <%=h @host.arch %><br/>
 	<%=h @host.hypervisor_type %><br/>
 	<%=h @host.status_str %><br/>
+        <%= @host.vms.collect{|x| x.uuid }.join(" <br/> ") %><br/>
 
 <!-- FIXME: need styling
 <h3>Network Interfaces</h3>
diff --git a/src/app/views/vm/_grid.rhtml b/src/app/views/vm/_grid.rhtml
index a322ea3..8e92934 100644
--- a/src/app/views/vm/_grid.rhtml
+++ b/src/app/views/vm/_grid.rhtml
@@ -29,6 +29,9 @@
         {display: '', name : 'id', width : 20, sortable : false, align: 'left', process: <%= table_id %>checkbox},
         {display: 'Description', name : 'description', width : 180, sortable : true, align: 'left'},
         {display: 'UUID', name : 'uuid', width : 180, sortable : true, align: 'left'},
+        <% if @pool.get_hardware_pool.can_view(@user) %>
+          {display: 'Host', name : 'host', width: 180, sortable : true, align: 'left' },
+        <% end %>
         {display: 'CPUs', name : 'num_vcpus_allocated', width : 40, sortable : true, align: 'left'},
         {display: 'Memory (MB)', name : 'memory_allocated', width : 60, sortable : true, align: 'right'},
         {display: 'vNIC Mac Addr', name : 'vnic_mac_addr', width : 60, sortable : true, align: 'right'},
-- 
1.5.4.1




More information about the ovirt-devel mailing list