[node-patches] Change in ovirt-node[master]: Add a diagnostic TUI page to view disk information

rbarry at redhat.com rbarry at redhat.com
Fri Feb 22 21:40:31 UTC 2013


Ryan Barry has uploaded a new change for review.

Change subject: Add a diagnostic TUI page to view disk information
......................................................................

Add a diagnostic TUI page to view disk information

rhbz#794858

Change-Id: Ia6055bca2369398e2050561fa9388f3a4dfb8535
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
A scripts/tui/src/ovirt/node/setup/diagnostic_page.py
1 file changed, 106 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/39/12339/1

diff --git a/scripts/tui/src/ovirt/node/setup/diagnostic_page.py b/scripts/tui/src/ovirt/node/setup/diagnostic_page.py
new file mode 100644
index 0000000..6fb4844
--- /dev/null
+++ b/scripts/tui/src/ovirt/node/setup/diagnostic_page.py
@@ -0,0 +1,106 @@
+# -*- coding: utf-8 *-*
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# kdump_page.py - Copyright (C) 2012 Red Hat, Inc.
+# Written by Fabian Deutsch <fabiand at redhat.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.
+"""
+Configure KDump
+"""
+
+from ovirt.node import utils, plugins, ui
+from ovirt.node.config import defaults
+from ovirt.node.plugins import Changeset
+from ovirt.node.utils import console
+
+
+class Plugin(plugins.NodePlugin):
+
+    def name(self):
+        return "Diagnostics"
+
+    def rank(self):
+        return 95
+
+    def model(self):
+        """Don't need to set up anything"""
+        return {}
+
+    def validators(self):
+        """Validators validate the input on change and give UI feedback
+        """
+        return {}
+
+    def ui_content(self):
+        """Describes the UI this plugin requires
+        This is an ordered list of (path, widget) tuples.
+        """
+        ws = [ui.Header("diagnostic._header", "Diagnostic Utilities"),
+              ui.Label("diagnostic.info", "Select one of the tools below. \n" +
+                       "Press 'q' to quit when viewing output"),
+              ui.Divider("diagnostic.divider"),
+              #ui.Label("tools.info", "Tools:"),
+              ui.Table("diagnostic.tools", "", "Available diagnostics",
+                       self.__diagnostics(), height=len(self.__diagnostics())),
+              #ui.Divider("diagnostic.divider"),
+              
+              #We don't need logfiles for now, but there just in case
+              #ui.Label("logfiles.info", "Logs:"),
+              #ui.Table("diagnostic.logfiles", "", "Available Logfiles",
+              #         self.__logfiles(), height=len(self.__logfiles())),
+              ]
+              
+        page = ui.Page("page", ws)
+        self.widgets.add(page)
+        return page
+
+    def on_change(self, changes):
+        pass
+
+    def on_merge(self, changes):
+        if changes.contains_any(["diagnostic.logfiles","diagnostic.tools"]):
+            cmds = {}
+            changed_field = changes.keys()[0]
+            if changed_field == "diagnostic.logfiles":
+                cmds = {"node": "cat /var/log/ovirt.log | less",
+                    "ui": "cat /tmp/ovirt.debug.log | less",
+                    "messages": "cat /var/log/messages | less",
+                    "dmesg": "dmesg | less"
+                    }
+                
+            elif changed_field == "diagnostic.tools":
+                cmds = {"multipath":"multipath -ll | less",
+                        "fdisk":"fdisk -l | less",
+                        "parted":"parted -l | less"}
+            cmd = cmds[changes[changed_field]] if changes[changed_field] in cmds else None
+            if cmd:
+                with self.application.ui.suspended():
+                    utils.process.call("reset")
+                    utils.process.call(cmd)
+            
+                
+    def __logfiles(self):
+        return [("node", "Node Log"),
+                ("ui", "Node UI Debug Log"),
+                ("dmesg", "dmesg"),
+                ("messages", "/var/log/messages")]
+        
+    def __diagnostics(self):
+        return [("multipath", "multipath -ll"),
+                ("fdisk", "fdisk -l"),
+                ("parted", "parted -l")]


--
To view, visit http://gerrit.ovirt.org/12339
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia6055bca2369398e2050561fa9388f3a4dfb8535
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list