[node-patches] Change in ovirt-node[master]: create sanlock user/group if missing during upgrade

hadong0720 at gmail.com hadong0720 at gmail.com
Wed Sep 3 13:05:07 UTC 2014


hadong has uploaded a new change for review.

Change subject: create sanlock user/group if missing during upgrade
......................................................................

create sanlock user/group if missing during upgrade

Also fix it so that we detect if sanlock is missing on boot
in ovirt-post and create it.

Change-Id: Ie284bc870bc331432e6fbe079872b3a28871c877
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1127122
Signed-off-by: hadong <hadong at redhat.com>
---
M scripts/ovirt-init-functions.sh.in
1 file changed, 25 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/93/32393/1

diff --git a/scripts/ovirt-init-functions.sh.in b/scripts/ovirt-init-functions.sh.in
index 64fde10..7b87d28 100644
--- a/scripts/ovirt-init-functions.sh.in
+++ b/scripts/ovirt-init-functions.sh.in
@@ -598,6 +598,17 @@
                 /usr/sbin/usermod -p $(grep ^root /etc/shadow | sed 's/:/ /g' | awk '{print $2}') admin
                 persist /etc/shadow /etc/passwd
             fi
+            # group problem only happens if /etc/group is persisted
+            if ! grep -q ^sanlock /etc/group; then
+                unmount_config /etc/group
+                groupadd -g 179 sanlock
+                persist /etc/group
+            fi
+            if ! grep -q ^sanlock /etc/passwd; then
+                unmount_config /etc/passwd /etc/shadow
+                useradd -u 179 -g sanlock -s /sbin/nologin -d /var/run/sanlock sanlock
+                persist /etc/shadow /etc/passwd
+            fi
             ;;
             standalone=no | standalone=0 | ovirt_standalone=no | ovirt_standalone=0)
             standalone=0
@@ -1380,6 +1391,20 @@
         # Create a minimalistic /etc/hosts if it's empty, rhbz#829753
         create_minimal_etc_hosts_file
 
+        # Handle sanlock user creation on in place upgrade
+        service sanlock stop
+        if ! grep -q ^sanlock /etc/group; then
+            unmount_config /etc/group
+            groupadd -g 179 sanlock
+            persist /etc/group
+        fi
+        if ! grep -q ^sanlock /etc/passwd; then
+            unmount_config /etc/passwd /etc/shadow
+            useradd -u 179 -g sanlock -s /sbin/nologin -d /var/run/sanlock sanlock
+            persist /etc/shadow /etc/passwd
+        fi
+        service sanlock start
+
         # Restart jorunald to pick up /var/log/journal
         service systemd-journald restart
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie284bc870bc331432e6fbe079872b3a28871c877
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: hadong <hadong0720 at gmail.com>



More information about the node-patches mailing list