[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Ovirt-devel] [PATCH] Enhance vms display



Hi,

Any comments on this one ?

Regards,

Le 25/02/2010 13:28, Loiseleur Michel a écrit :
It can be quite hard to manage a pool of 40-50 VMs without informations about the OS running, the contact (which is the only one to know when the vm can really be destroyed) or an End Of Life date. This patch add those fields, and rework a little the VM list view, in order to show gracefully those new fields. It has been made at the expense of UUID, Total Run Time&  Load fields. Since those fields are often better displayed from a monitoring software, I have though it was acceptable.

Signed-off-by: Loiseleur Michel<mloiseleur linagora com>
---
  src/app/controllers/pool_controller.rb |    6 ++--
  src/app/views/vm/_form.rhtml           |   10 ++++++--
  src/app/views/vm/_grid.rhtml           |    9 ++++---
  src/db/migrate/044_add_vm_fields.rb    |   34 ++++++++++++++++++++++++++++++++
  4 files changed, 49 insertions(+), 10 deletions(-)
  create mode 100644 src/db/migrate/044_add_vm_fields.rb

diff --git a/src/app/controllers/pool_controller.rb b/src/app/controllers/pool_controller.rb
index e86b064..e6c341d 100644
--- a/src/app/controllers/pool_controller.rb
+++ b/src/app/controllers/pool_controller.rb
@@ -94,11 +94,11 @@ class PoolController<  ApplicationController
    end

    def vms_json(args)
-    attr_list = [:id, :description, :uuid,
+    attr_list = [:id, :description,
                   :num_vcpus_allocated, :memory_allocated_in_mb,
-                 :state, :calc_uptime, :id]
+                 :state, :contact, :os, :eol, :comment ]
      if (@pool.is_a? VmResourcePool) and @pool.get_hardware_pool.can_view(@user)
-      attr_list.insert(3, [:host, :hostname])
+      attr_list.insert(2, [:host, :hostname])
      end
      json_list(args[:full_items], attr_list, [:all], args[:find_opts])
    end
diff --git a/src/app/views/vm/_form.rhtml b/src/app/views/vm/_form.rhtml
index adb75d2..13e73db 100644
--- a/src/app/views/vm/_form.rhtml
+++ b/src/app/views/vm/_form.rhtml
@@ -8,10 +8,14 @@

    <div class="form_heading clickable open">General</div>
    <div class="vm_form_section">
-<%= text_field_with_label "Name:", "vm", "description", {:style=>"width:250px;"}  %>
-<%= text_field_with_label "UUID:", "vm", "uuid",  {:style=>"width:250px;"} %>
-<%= select_with_label "Operating System:", 'vm', 'provisioning_and_boot_settings', @provisioning_options, :style=>"width:250px;" %>
+<%= text_field_with_label "Name:", "vm", "description"  %>
+<%= text_field_with_label "UUID:", "vm", "uuid" %>
+<%= select_with_label "Provisioning:", 'vm', 'provisioning_and_boot_settings', @provisioning_options  %>
      <% if controller.action_name == "edit" %><b style="color: #FF0000">*Warning* Editing provision could overwrite vm</b><% end %>
+<%= text_field_with_label "Contact:", "vm", "contact" %>
+<%= text_field_with_label "Operating System:", "vm", "os" %>
+<%= text_field_with_label "End Of Life:", "vm", "eol" %>
+<%= text_field_with_label "Comment:", "vm", "comment" %>

      <div class="clear_row" style="height:15px;"></div>
    </div>
diff --git a/src/app/views/vm/_grid.rhtml b/src/app/views/vm/_grid.rhtml
index e3fa0e0..fe821e1 100644
--- a/src/app/views/vm/_grid.rhtml
+++ b/src/app/views/vm/_grid.rhtml
@@ -27,16 +27,17 @@
      <% end %>
      colModel : [
          {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'},
+        {display: 'Name', name : 'description', width : 180, sortable : true, align: 'left'},
          <% if (pool.is_a? VmResourcePool) and 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: 'State', name : 'state', width : 50, sortable : true, align: 'right'},
-        {display: 'Total Run Time', name : 'calc_uptime', width : 50, align: 'right'},
-        {display: 'Load', name : 'load', width: 180, sortable : false, align: 'left', process:<%= table_id %>_load_widget }
+        {display: 'Contact', name : 'contact', width : 100, align: 'left'},
+        {display: 'OS', name : 'os', width : 60, sortable : true, align: 'left'},
+        {display: 'EOL', name : 'eol', width : 60, sortable : true, align: 'right'},
+        {display: 'Comment', name : 'comment', width : 100, sortable : true, align: 'right'}
          ],
      sortname: "description",
      sortorder: "asc",
diff --git a/src/db/migrate/044_add_vm_fields.rb b/src/db/migrate/044_add_vm_fields.rb
new file mode 100644
index 0000000..834f0ec
--- /dev/null
+++ b/src/db/migrate/044_add_vm_fields.rb
@@ -0,0 +1,34 @@
+# Copyright (C) 2010 Linagora.
+# Written by Michel Loiseleur<mloiseleur linagora com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.  A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+
+# introduce information fields for VMs
+class AddVmFields<  ActiveRecord::Migration
+  def self.up
+    add_column :vms, :contact, :string, :null =>  false, :default =>  ''
+    add_column :vms, :comment, :string, :null =>  false, :default =>  ''
+    add_column :vms, :eol, :date, :null =>  false, :default =>  Date.new(1970,01,01).to_s
+    add_column :vms, :os, :string, :null =>  false, :default =>  ''
+  end
+
+  def self.down
+    remove_column :vms, :contact
+    remove_column :vms, :comment
+    remove_column :vms, :eol
+    remove_column :vms, :os
+  end
+end


--
Loiseleur Michel
Directeur de l'OSSA
Linagora / 80, rue Roque de Fillol / 92800 PUTEAUX
Tel/Fax : +33 1 46 96 63 63 / +33 1 46 96 63 64
http://www.08000linux.com/ | http://www.tosca-project.net
"Ce n'est pas le logiciel qui est libre, c'est vous"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]