Change in vdsm[master]: spec: move reconfigure logic from %postun to %post

dougsland at redhat.com dougsland at redhat.com
Fri Jun 27 20:15:43 UTC 2014


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: spec: move reconfigure logic from %postun to %post
......................................................................

spec: move reconfigure logic from %postun to %post

During the upgrade process, the %postun session from spec
is executed from the old package which might contain a version
of vdsm without the reconfigure code. This patch moves the logic
to %post session which is executed during the upgrade process.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1111935

Change-Id: I190ac484937ea794d69d9e14ff6ffd5d5d69cc00
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M vdsm.spec.in
1 file changed, 38 insertions(+), 39 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/64/29364/1

diff --git a/vdsm.spec.in b/vdsm.spec.in
index 008fd39..7723816 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -715,6 +715,44 @@
 # set the vdsm "secret" password for libvirt
 %{_bindir}/vdsm-tool set-saslpasswd
 
+if [ "$1" -ge 1 ]; then
+    supervdsmd_start_required='no'
+    vdsmd_start_required='no'
+
+    # Both vdsm and supervdsm should be managed here and must be restarted if
+    # ran before (code might changed)
+    if %{_bindir}/vdsm-tool service-status vdsmd >/dev/null 2>&1; then
+        %{_bindir}/vdsm-tool service-stop vdsmd >/dev/null 2>&1 || :
+        vdsmd_start_required='yes'
+    fi
+    if %{_bindir}/vdsm-tool service-status supervdsmd >/dev/null 2>&1; then
+        %{_bindir}/vdsm-tool service-stop supervdsmd >/dev/null 2>&1 || :
+        supervdsmd_start_required='yes'
+    fi
+
+    if ! %{_bindir}/vdsm-tool is-configured --module libvirt >/dev/null 2>&1;
+    then
+        if ! %{_bindir}/vdsm-tool configure --module libvirt --force \
+                >/dev/null 2>&1; then
+            # fallback to vdsmd reconfigure api - This change may be removed
+            # when vdsm won't support any downgrade\upgrade to versions that
+            # don't include vdsm-tool configure api (vdsm <= 3.3)
+            for f in '/lib/systemd/systemd-vdsmd' '/etc/init.d/vdsmd'; do
+                if [ -f "${f}" ]; then
+                    "${f}" reconfigure >/dev/null 2>&1 || :
+                fi
+            done
+        fi
+    fi
+
+    if [ "${supervdsmd_start_required}" = 'yes' ]; then
+        %{_bindir}/vdsm-tool service-start supervdsmd >/dev/null 2>&1 || :
+    fi
+    if [ "${vdsmd_start_required}" = 'yes' ]; then
+        %{_bindir}/vdsm-tool service-start vdsmd >/dev/null 2>&1 || :
+    fi
+fi
+
 # After vdsm install we should create the logs files.
 # In the install session we create it but since we use
 # the ghost macro (in files session) the files are not included
@@ -796,45 +834,6 @@
 %endif
 
 %postun
-if [ "$1" -ge 1 ]; then
-    supervdsmd_start_required='no'
-    vdsmd_start_required='no'
-
-    # Both vdsm and supervdsm should be managed here and must be restarted if
-    # ran before (code might changed)
-    if %{_bindir}/vdsm-tool service-status vdsmd >/dev/null 2>&1; then
-        %{_bindir}/vdsm-tool service-stop vdsmd >/dev/null 2>&1 || :
-        vdsmd_start_required='yes'
-    fi
-    if %{_bindir}/vdsm-tool service-status supervdsmd >/dev/null 2>&1; then
-        %{_bindir}/vdsm-tool service-stop supervdsmd >/dev/null 2>&1 || :
-        supervdsmd_start_required='yes'
-    fi
-
-    if ! %{_bindir}/vdsm-tool is-configured --module libvirt >/dev/null 2>&1;
-    then
-        if ! %{_bindir}/vdsm-tool configure --module libvirt --force \
-                >/dev/null 2>&1; then
-            # fallback to vdsmd reconfigure api - This change may be removed
-            # when vdsm won't support any downgrade\upgrade to versions that
-            # don't include vdsm-tool configure api (vdsm <= 3.3)
-            for f in '/lib/systemd/systemd-vdsmd' '/etc/init.d/vdsmd'; do
-                if [ -f "${f}" ]; then
-                    "${f}" reconfigure >/dev/null 2>&1 || :
-                fi
-            done
-        fi
-    fi
-
-    if [ "${supervdsmd_start_required}" = 'yes' ]; then
-        %{_bindir}/vdsm-tool service-start supervdsmd >/dev/null 2>&1 || :
-    fi
-    if [ "${vdsmd_start_required}" = 'yes' ]; then
-        %{_bindir}/vdsm-tool service-start vdsmd >/dev/null 2>&1 || :
-    fi
-fi
-exit 0
-
 %if 0%{?rhel} == 6
 # In el6, We configure libvirt to use upstart without the libvirt.rpm's
 # awareness. Thus, we must stop/restart libvirt ourselves when the


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I190ac484937ea794d69d9e14ff6ffd5d5d69cc00
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