[node-patches] Change in ovirt-node[master]: Create a basic plugin for IPMI enablement

rbarry at redhat.com rbarry at redhat.com
Mon Aug 12 20:23:56 UTC 2013


Ryan Barry has uploaded a new change for review.

Change subject: Create a basic plugin for IPMI enablement
......................................................................

Create a basic plugin for IPMI enablement

Create a plugin which pulls in OpenIPMI and presents a basic
status screen which shows fan speeds as a cursory proof of IPMI
working. No other functionality is presented at this time, though
dropping to a console and using ipmitool yields full functionality.

Change-Id: I74c53ffec3f9eb11312ccffec7c5b7083325d94a
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=821000
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M ovirt-node.spec.in
M src/Makefile.am
A src/ovirt/node/setup/ipmi/__init__.py
A src/ovirt/node/setup/ipmi/ipmi_page.py
4 files changed, 136 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/85/17985/1

diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index d583f2e..e9feb25 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -150,6 +150,20 @@
      logdir = /var/log/puppet
 EOF
 
+%package plugin-ipmi
+Summary:        IPMI plugin for %{product_family} image
+Group:          Applications/System
+Requires:       OpenIPMI
+
+%description plugin-ipmi
+This package provides IPMI for use with %{product_family} image.
+
+%post plugin-ipmi
+%if %{is_systemd}
+systemctl enable ipmi.service
+%else
+chkconfig ipmi on
+%endif
 
 %package plugin-snmp
 Summary:        SNMP plugin for %{product_family} image
@@ -517,6 +531,9 @@
 %{_initrddir}/ovirt-cim
 %endif
 
+%files plugin-ipmi
+%{python_sitelib}/ovirt/node/setup/ipmi/__init__.py*
+%{python_sitelib}/ovirt/node/setup/ipmi/ipmi_page.py*
 
 %files plugin-igor-slave
 %{_libexecdir}/ovirt-node-igor-slave
diff --git a/src/Makefile.am b/src/Makefile.am
index 194de0c..ae761a6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -68,6 +68,7 @@
 pyovirt_node_setup_cimdir = $(pyovirt_node_setupdir)/cim
 pyovirt_node_setup_snmpdir = $(pyovirt_node_setupdir)/snmp
 pyovirt_node_setup_puppetdir = $(pyovirt_node_setupdir)/puppet
+pyovirt_node_setup_ipmidir = $(pyovirt_node_setupdir)/ipmi
 
 
 pyovirt_PYTHON = \
@@ -177,3 +178,8 @@
 pyovirt_node_setup_puppet_PYTHON = \
   ovirt/node/setup/puppet/__init__.py \
   ovirt/node/setup/puppet/puppet_page.py
+
+# Setup IPMI Plugin
+pyovirt_node_setup_ipmi_PYTHON = \
+  ovirt/node/setup/ipmi/__init__.py \
+  ovirt/node/setup/ipmi/ipmi_page.py
diff --git a/src/ovirt/node/setup/ipmi/__init__.py b/src/ovirt/node/setup/ipmi/__init__.py
new file mode 100644
index 0000000..6a68089
--- /dev/null
+++ b/src/ovirt/node/setup/ipmi/__init__.py
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# __init__.py - Copyright (C) 2013 Red Hat, Inc.
+# Written by Ryan Barry <rbarry 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.
+
+"""
+IPMI Plugin
+"""
+import ipmi_page
+
+
+#
+# Magic function to register all plugins to be used
+#
+def createPlugins(application):
+    ipmi_page.Plugin(application)
diff --git a/src/ovirt/node/setup/ipmi/ipmi_page.py b/src/ovirt/node/setup/ipmi/ipmi_page.py
new file mode 100644
index 0000000..18f7d8a
--- /dev/null
+++ b/src/ovirt/node/setup/ipmi/ipmi_page.py
@@ -0,0 +1,81 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# cim_page.py - Copyright (C) 2012 Red Hat, Inc.
+# Written by Ryan Barry <rbarry 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.
+from ovirt.node import plugins, valid, ui, utils
+from ovirt.node.utils import process
+from subprocess import CalledProcessError
+"""
+IPMI Status
+"""
+
+
+class Plugin(plugins.NodePlugin):
+    _model = None
+
+    def __init__(self, app):
+        super(Plugin, self).__init__(app)
+        self._model = {}
+
+    def has_ui(self):
+        return True
+
+    def name(self):
+        return "IPMI"
+
+    def rank(self):
+        return 50
+
+    def model(self):
+        model = {"ipmi.enabled": "%s" % self._check_ipmi()
+                 }
+        return model
+
+    def validators(self):
+        return {}
+
+    def ui_content(self):
+        ws = [ui.Header("header[0]", "IPMI"),
+              ui.KeywordLabel("ipmi.enabled", "IPMI Enabled: ")]
+        if self._check_ipmi():
+            ws.extend([
+                ui.Divider("divider[0]"),
+                ui.Header("header[1]", "Fan Status:"),
+                ui.Table("ipmi_output", "", "Fan status",
+                         process.check_output(
+                         "ipmitool -I open sdr elist full",
+                         shell=True))
+            ])
+
+        page = ui.Page("page", ws)
+        self.widgets.add(ws)
+        return page
+
+    def on_change(self, changes):
+        pass
+
+    def on_merge(self, effective_changes):
+        pass
+
+    def _check_ipmi(self):
+        try:
+            process.check_call("ipmitool -I open chassis status", shell=True)
+            return True
+        except CalledProcessError:
+            return False


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I74c53ffec3f9eb11312ccffec7c5b7083325d94a
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