Alon Bar-Lev has uploaded a new change for review.

Change subject: tune/iosched: set deadline iosched using udev rules
......................................................................

tune/iosched: set deadline iosched using udev rules

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=870159
Change-Id: I96e5710729e79dd222047c03eb81b8cef1c0030d
Signed-off-by: Alon Bar-Lev <alo...@redhat.com>
---
M ChangeLog
M ovirt-host-deploy.spec.in
M po/POTFILES.in
M src/plugins/ovirt-host-deploy/tune/Makefile.am
M src/plugins/ovirt-host-deploy/tune/__init__.py
A src/plugins/ovirt-host-deploy/tune/iosched.py
A src/plugins/ovirt-host-deploy/tune/ovirt-iosched.rules
7 files changed, 108 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-host-deploy refs/changes/81/9681/1

diff --git a/ChangeLog b/ChangeLog
index d4ed786..e736942 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,8 +30,8 @@
 
  * legacy-change: logs are stored at /tmp/ovirt-host-deploy-*.log.
 
- * legacy-change: io elevator scheduler set in kernel command-line
-   use either udev rule in vdsm package or tuned.
+ * legacy-change: io elevator scheduler is using udev instead of using
+   kernel command-line.
 
  * legacy-change: vdsm libvirt reconfigure
    vdsm is reconfigured with file based trigger instead unsupported systemd
diff --git a/ovirt-host-deploy.spec.in b/ovirt-host-deploy.spec.in
index eb2e9da..9538cac 100644
--- a/ovirt-host-deploy.spec.in
+++ b/ovirt-host-deploy.spec.in
@@ -157,6 +157,7 @@
 %{python_sitelib}/ovirt_host_deploy/*.py*
 %dir %{_datadir}/%{name}
 %{_datadir}/%{name}/plugins/%{name}/*/*.py*
+%{_datadir}/%{name}/plugins/%{name}/*/*.rules
 %{_datadir}/%{name}/plugins/%{name}/*/*/.keep
 %{_datadir}/otopi/plugins/%{name}
 #%{_datadir}/locale/*/*/%{name}.mo
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 9650f91..e75969f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -10,6 +10,7 @@
 ./src/plugins/ovirt-host-deploy/node/persist.py
 ./src/plugins/ovirt-host-deploy/node/vdsm_reg.py
 ./src/plugins/ovirt-host-deploy/tune/__init__.py
+./src/plugins/ovirt-host-deploy/tune/iosched.py
 ./src/plugins/ovirt-host-deploy/tune/tuned.py
 ./src/plugins/ovirt-host-deploy/vdsm/bridge.py
 ./src/plugins/ovirt-host-deploy/vdsm/hardware.py
diff --git a/src/plugins/ovirt-host-deploy/tune/Makefile.am 
b/src/plugins/ovirt-host-deploy/tune/Makefile.am
index bbf51c5..206cb6b 100644
--- a/src/plugins/ovirt-host-deploy/tune/Makefile.am
+++ b/src/plugins/ovirt-host-deploy/tune/Makefile.am
@@ -25,8 +25,12 @@
 mydir=$(ovirthostdeployplugindir)/ovirt-host-deploy/tune
 dist_my_PYTHON = \
        __init__.py \
+       iosched.py \
        tuned.py
 
+dist_my_DATA = \
+       ovirt-iosched.rules
+
 clean-local: \
        python-clean
 
diff --git a/src/plugins/ovirt-host-deploy/tune/__init__.py 
b/src/plugins/ovirt-host-deploy/tune/__init__.py
index 8623059..4720224 100644
--- a/src/plugins/ovirt-host-deploy/tune/__init__.py
+++ b/src/plugins/ovirt-host-deploy/tune/__init__.py
@@ -24,9 +24,11 @@
 from otopi import util
 
 
+from . import iosched
 from . import tuned
 
 
 @util.export
 def createPlugins(context):
+    iosched.Plugin(context=context)
     tuned.Plugin(context=context)
diff --git a/src/plugins/ovirt-host-deploy/tune/iosched.py 
b/src/plugins/ovirt-host-deploy/tune/iosched.py
new file mode 100644
index 0000000..c000b05
--- /dev/null
+++ b/src/plugins/ovirt-host-deploy/tune/iosched.py
@@ -0,0 +1,93 @@
+#
+# ovirt-host-deploy -- ovirt host deployer
+# Copyright (C) 2012 Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+
+"""ioscehd setup plugin."""
+
+
+import gettext
+_ = lambda m: gettext.dgettext(message=m, domain='ovirt-host-deploy')
+
+
+import os
+
+from otopi import util
+from otopi import plugin
+
+
+from otopi import constants as otopicons
+from otopi import filetransaction
+
+
+from ovirt_host_deploy import constants as odeploycons
+
+
+@util.export
+class Plugin(plugin.PluginBase):
+    """iosched setup plugin."""
+
+    DEST_UDEV_RULE_FILE = '/etc/udev/rules.d/12-ovirt-iosched.rules'
+    SRC_UDEV_RULE_FILE = 'ovirt-iosched.rules'
+
+    def __init__(self, context):
+        super(Plugin, self).__init__(context=context)
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_SETUP,
+    )
+    def _setup(self):
+        self.command.detect('udevadm')
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_MISC,
+    )
+    def _misc(self):
+        with open(
+            os.path.join(
+                os.path.dirname(__file__),
+                self.SRC_UDEV_RULE_FILE,
+            ),
+            'r'
+        ) as f:
+            self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append(
+                filetransaction.FileTransaction(
+                    name=self.DEST_UDEV_RULE_FILE,
+                    content=f.read(),
+                    modifiedList=self.environment[
+                        otopicons.CoreEnv.MODIFIED_FILES
+                    ],
+                )
+            )
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_CLOSEUP,
+        priority=plugin.Stages.PRIORITY_LOW,
+        condition=lambda self: not self.environment[
+            odeploycons.CoreEnv.FORCE_REBOOT
+        ],
+    )
+    def _refresh(self):
+        self.execute(
+            [
+                self.command.get('udevadm'),
+                'trigger',
+                '--type=devices'
+            ],
+            raiseOnError=False,
+        )
diff --git a/src/plugins/ovirt-host-deploy/tune/ovirt-iosched.rules 
b/src/plugins/ovirt-host-deploy/tune/ovirt-iosched.rules
new file mode 100644
index 0000000..86ef28a
--- /dev/null
+++ b/src/plugins/ovirt-host-deploy/tune/ovirt-iosched.rules
@@ -0,0 +1,5 @@
+# Generated by ovirt-host-deploy
+# Do not modify this file.
+# Settings may be overridden by applying subsequent rules.
+#
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", RUN+="/bin/sh 
-c 'echo deadline > /sys/${DEVPATH}/queue/scheduler'"


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I96e5710729e79dd222047c03eb81b8cef1c0030d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-host-deploy
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to