Hello hadong,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/32799

to review the following change.

Change subject: hooks: Add 02-sanlock-check into on-boot
......................................................................

hooks: Add 02-sanlock-check into on-boot

Add 02-sanlock-check into on-boot to create sanlock user/group ifmissing
during upgrade.

Change-Id: I63101a8811978afe33b4152335e62bf5c3b54e00
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1127122
Signed-off-by: hadong <had...@redhat.com>
---
M hooks/Makefile.am
A hooks/on-boot/02-sanlock-check
M ovirt-node-plugin-vdsm.spec.in
3 files changed, 29 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node-plugin-vdsm 
refs/changes/99/32799/1

diff --git a/hooks/Makefile.am b/hooks/Makefile.am
index 2e1020e..d88b771 100644
--- a/hooks/Makefile.am
+++ b/hooks/Makefile.am
@@ -24,4 +24,5 @@
 
 dist_onboot_SCRIPTS = \
        on-boot/01-vdsm-configure \
+       on-boot/02-sanlock-check \
        $(NULL)
diff --git a/hooks/on-boot/02-sanlock-check b/hooks/on-boot/02-sanlock-check
new file mode 100644
index 0000000..7c328b5
--- /dev/null
+++ b/hooks/on-boot/02-sanlock-check
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# 01-sanlock-check - Copyright (C) 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, version 2 of the License.
+#
+# This program 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 General Public License for more details.
+
+. /usr/libexec/ovirt-functions
+# 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
diff --git a/ovirt-node-plugin-vdsm.spec.in b/ovirt-node-plugin-vdsm.spec.in
index 2028cd1..db94b22 100644
--- a/ovirt-node-plugin-vdsm.spec.in
+++ b/ovirt-node-plugin-vdsm.spec.in
@@ -75,6 +75,7 @@
 %{python_sitelib}/ovirt/node/setup/vdsm
 %{_libexecdir}/ovirt-node/hooks/pre-upgrade/01-vdsm
 %{_libexecdir}/ovirt-node/hooks/on-boot/01-vdsm-configure
+%{_libexecdir}/ovirt-node/hooks/on-boot/02-sanlock-check
 %{_sysconfdir}/ovirt-plugins.d
 %{_sysconfdir}/default/version.ovirt-node-plugin-vdsm
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63101a8811978afe33b4152335e62bf5c3b54e00
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node-plugin-vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Douglas Schilling Landgraf <dougsl...@redhat.com>
Gerrit-Reviewer: hadong <hadong0...@gmail.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to