[node-patches] Change in ovirt-node[master]: tuned: Use the proper name when setting a new tune

dougsland at redhat.com dougsland at redhat.com
Thu Sep 29 15:47:26 UTC 2016


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: tuned: Use the proper name when setting a new tune
......................................................................

tuned: Use the proper name when setting a new tune

Previously, we were using the output of tuned.get_available_profiles()
to grab the name of tune that will to be used. However, this output shows
the name and description which wrong. This patch make sure we only
use the profile name in set_active_profile().

Change-Id: I33e7925631e9b16108ea6282d4a6ea155efdb291
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1379577
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M src/ovirt/node/config/tuned.py
M src/ovirt/node/utils/tuned.py
2 files changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/71/64971/1

diff --git a/src/ovirt/node/config/tuned.py b/src/ovirt/node/config/tuned.py
index a812f4e..1b67084 100644
--- a/src/ovirt/node/config/tuned.py
+++ b/src/ovirt/node/config/tuned.py
@@ -34,7 +34,7 @@
         all_profiles = tuned.get_available_profiles()
         if profile not in all_profiles:
             raise InvalidData("Unknown tuned profile: %s" % profile)
-        return {"OVIRT_TUNED_PROFILE": profile}
+        return {"OVIRT_TUNED_PROFILE": profile.split()[0]}
 
     def transaction(self):
         # This method builds a transaction to modify the system
@@ -49,7 +49,7 @@
             title = "Requesting profile change"
 
             def commit(self):
-                tuned.set_active_profile(profile)
+                tuned.set_active_profile(profile.split()[0])
 
         tx = utils.Transaction("Applying tuned configuration")
         if profile:
diff --git a/src/ovirt/node/utils/tuned.py b/src/ovirt/node/utils/tuned.py
index 8c9d36c..6189c62 100644
--- a/src/ovirt/node/utils/tuned.py
+++ b/src/ovirt/node/utils/tuned.py
@@ -63,7 +63,7 @@
     try:
         if (profile == "None" or profile == "off"):
             process.check_output(["/usr/sbin/tuned-adm", "off"])
-        elif profile not in get_available_profiles():
+        elif not any(profile in s for s in get_available_profiles()):
             raise RuntimeError("%s is not a known profile" % profile)
         else:
             process.check_output(["/usr/sbin/tuned-adm", "profile",


-- 
To view, visit https://gerrit.ovirt.org/64971
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I33e7925631e9b16108ea6282d4a6ea155efdb291
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>



More information about the node-patches mailing list