Change in vdsm[master]: configurator: move usermod to spec

dougsland at redhat.com dougsland at redhat.com
Tue Mar 25 04:22:37 UTC 2014


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: configurator: move usermod to spec
......................................................................

configurator: move usermod to spec

vdsm-tool configure --force adds to /etc/group (qemu/kvm) sanlock
but doesn't persist the file in ovirt node distro which will
affect vdsm start on next reboot. This patch moves the usermod to
spec file.

Change-Id: I668552fa037414e9a6aee5b049d61749268f85d0
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M lib/vdsm/tool/configurator.py
M vdsm.spec.in
2 files changed, 5 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/55/26055/1

diff --git a/lib/vdsm/tool/configurator.py b/lib/vdsm/tool/configurator.py
index d1c876c..516a7bc 100644
--- a/lib/vdsm/tool/configurator.py
+++ b/lib/vdsm/tool/configurator.py
@@ -24,7 +24,7 @@
 
 from .. import utils
 from . import service, expose
-from ..constants import P_VDSM_EXEC, QEMU_PROCESS_GROUP, VDSM_GROUP
+from ..constants import P_VDSM_EXEC
 
 
 class _ModuleConfigure(object):
@@ -108,8 +108,6 @@
 
 class SanlockModuleConfigure(_ModuleConfigure):
 
-    SANLOCK_GROUPS = (QEMU_PROCESS_GROUP, VDSM_GROUP)
-
     def __init__(self):
         super(SanlockModuleConfigure, self).__init__()
 
@@ -118,28 +116,6 @@
 
     def getServices(self):
         return ['sanlock']
-
-    def configure(self):
-        """
-        Configure sanlock process groups
-        """
-        if os.getuid() != 0:
-            raise UserWarning("Must run as root")
-
-        rc, out, err = utils.execCmd(
-            (
-                '/usr/sbin/usermod',
-                '-a',
-                '-G',
-                ','.join(self.SANLOCK_GROUPS),
-                'sanlock'
-            ),
-            raw=True,
-        )
-        sys.stdout.write(out)
-        sys.stderr.write(err)
-        if rc != 0:
-            raise RuntimeError("Failed to perform sanlock config.")
 
     def isconfigured(self):
         """
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 361a9c1..b149568 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -690,6 +690,7 @@
     /usr/sbin/useradd -r -u 36 -g %{vdsm_group} -d /var/lib/vdsm \
         -s /sbin/nologin -c "Node Virtualization Manager" %{vdsm_user}
 /usr/sbin/usermod -a -G %{qemu_group},%{snlk_group} %{vdsm_user}
+/usr/sbin/usermod -a -G %{qemu_group},%{vdsm_group} %{snlk_user}
 
 %post
 %{_bindir}/vdsm-tool sebool-config || :
@@ -734,6 +735,9 @@
 %endif
 
 %preun
+/usr/bin/gpasswd -d %{snlk_user} %{qemu_group}
+/usr/bin/gpasswd -d %{snlk_user} %{vdsm_group}
+
 if [ "$1" -eq 0 ]; then
         start_conf_section="## beginning of configuration section by vdsm"
         end_conf_section="## end of configuration section by vdsm"


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

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


More information about the vdsm-patches mailing list