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

Change subject: tune: tuned: support multiple profiles for gluster
......................................................................

tune: tuned: support multiple profiles for gluster

gluster requires different profiles, also different if virtualization is
enabled or not.

Change-Id: Ida4c6f07e6389d1de3b4ad21de07960e7fbffd0d
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M ChangeLog
M README.environment
M src/ovirt_host_deploy/constants.py
M src/plugins/ovirt-host-deploy/tune/tuned.py
4 files changed, 35 insertions(+), 11 deletions(-)


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

diff --git a/ChangeLog b/ChangeLog
index 15104da..4dc69dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,7 @@
  * vdsm: packages: cgconfig is dependency of libvirt.
  * vdsm: packages: use new method of libvirt reconfigure.
  * gluster: packages: start glusterd if no reboot.
+ * tune: tuned: support multiple profiles for gluster.
  * openstack: add neutron support.
  * build: re-introduce external gettext packaging.
 
diff --git a/README.environment b/README.environment
index df0f493..ed63ae0 100644
--- a/README.environment
+++ b/README.environment
@@ -61,8 +61,11 @@
     Set vdsm configuration option. If set vdsm configuration is
     overridden unless there is VDSM/configOverride = False.
 
-GLUSTER/enable(str) [False]
-    Instal gluster support.
+VIRT/enable(bool) [False]
+    Virtualization support.
+
+GLUSTER/enable(bool) [False]
+    Install gluster support.
 
 OPENSTACK/neutronEnable(bool) [False]
     Enable Neutron configuration.
diff --git a/src/ovirt_host_deploy/constants.py 
b/src/ovirt_host_deploy/constants.py
index d0999b9..f811ee6 100644
--- a/src/ovirt_host_deploy/constants.py
+++ b/src/ovirt_host_deploy/constants.py
@@ -109,6 +109,12 @@
 
 @util.export
 @util.codegen
+class VirtEnv(object):
+    ENABLE = 'VIRT/enable'
+
+
[email protected]
[email protected]
 class GlusterEnv(object):
     ENABLE = 'GLUSTER/enable'
 
diff --git a/src/plugins/ovirt-host-deploy/tune/tuned.py 
b/src/plugins/ovirt-host-deploy/tune/tuned.py
index 4caa267..b632670 100644
--- a/src/plugins/ovirt-host-deploy/tune/tuned.py
+++ b/src/plugins/ovirt-host-deploy/tune/tuned.py
@@ -38,33 +38,47 @@
 
     def __init__(self, context):
         super(Plugin, self).__init__(context=context)
-        self.enabled = False
+        self._enabled = False
+        self._profile = None
 
     @plugin.event(
         stage=plugin.Stages.STAGE_SETUP,
         condition=lambda self: (
             not self.environment[
                 odeploycons.VdsmEnv.OVIRT_NODE
-            ] and
-            not self.environment[
-                odeploycons.GlusterEnv.ENABLE
             ]
-        )
+        ),
     )
     def _setup(self):
         self.command.detect('tuned-adm')
-        self.enabled = True
+        self._enabled = True
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_VALIDATION,
+        condition=lambda self: self._enabled,
+    )
+    def _validation(self):
+        if self.environment[odeploycons.GlusterEnv.ENABLED]:
+            if self.environment[odeploycons.VirtEnv.ENABLED]:
+                self._profile = 'rhs-virtualization'
+            else:
+                self._profile = 'rhs-high-throughput'
+        elif self.environment[odeploycons.VirtEnv.ENABLED]:
+            self._profile = 'virtual-host'
+
+        if self._profile is None:
+            self._enabledd = False
 
     @plugin.event(
         stage=plugin.Stages.STAGE_PACKAGES,
-        condition=lambda self: self.enabled,
+        condition=lambda self: self._enabled,
     )
     def _packages(self):
         self.packager.installUpdate(('tuned',))
 
     @plugin.event(
         stage=plugin.Stages.STAGE_MISC,
-        condition=lambda self: self.enabled,
+        condition=lambda self: self._enabled,
     )
     def _misc(self):
         # tuned-adm does not work if daemon is down!
@@ -73,7 +87,7 @@
             (
                 self.command.get('tuned-adm'),
                 'profile',
-                'virtual-host',
+                self._profile,
             ),
             raiseOnError=False,
         )


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ida4c6f07e6389d1de3b4ad21de07960e7fbffd0d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-host-deploy
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to