[ovs-dev] [PATCH 4/4] xenserver: Don't require /etc/xensource-inventory at install.

Justin Pettit jpettit at nicira.com
Fri Feb 11 18:55:21 UTC 2011


From: Bob Ball <bob.ball at citrix.com>

There are two mechanisms of installing a supplemental pack – one is
after installation (using the xe-install-supplemental-pack command) and
one is during installation by either creating a new install ISO with the
supplemental pack bundled or creating an HTTP directory which serves the
install files and the new supplemental pack contents.

The RPM should support both methods, but currently only works if the
supplemental pack is installed post-installation.  The failure is caused
by /etc/xensource-inventory not existing during the installation; this
is created at the end of the installation, and therefore is not present
when the RPM is installed.  This cannot be used to determine the version
of the XenServer installation.

With this commit, /etc/xensource-inventory is not checked on
installation of XenServer.

Signed-off-by: Bob Ball <bob.ball at citrix.com>
---
 xenserver/openvswitch-xen.spec |   47 +++++++++++++++++++++------------------
 1 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/xenserver/openvswitch-xen.spec b/xenserver/openvswitch-xen.spec
index 1e59ac5..618d732 100644
--- a/xenserver/openvswitch-xen.spec
+++ b/xenserver/openvswitch-xen.spec
@@ -111,29 +111,32 @@ install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
 rm -rf $RPM_BUILD_ROOT
 
 %post
-if [ ! -f /etc/xensource-inventory ]; then
-    printf "XenSource inventory not present in /etc/xensource-inventory"
-    exit 1
-fi
-. /etc/xensource-inventory
-
-if test ! -e /var/xapi/network.dbcache; then
-    if test "$1" = 1; then
-        printf "Creating xapi database cache...  "
-    else
-        printf "warning: Open vSwitch is being re-installed or upgraded,\n"
-        printf "         but the xapi database cache is missing.\n"
-        printf "Re-creating xapi database cache...  "
+# Do not run the first block if we are in the XenServer installer
+if runlevel >/dev/null 2>&1; then
+    if [ ! -f /etc/xensource-inventory ]; then
+        printf "XenSource inventory not present in /etc/xensource-inventory"
+        exit 1
     fi
+    . /etc/xensource-inventory
 
-    if /usr/share/openvswitch/scripts/interface-reconfigure rewrite; then
-        printf "done.\n"
-    else
-        printf "FAILED\n"
-        printf "Open vSwitch can only be installed on a XenServer that\n"
-        printf "has connectivity to xapi on the pool master.  Please\n"
-        printf "fix connectivity to the pool master, then try again.\n"
-        exit 1
+    if test ! -e /var/xapi/network.dbcache; then
+        if test "$1" = 1; then
+            printf "Creating xapi database cache...  "
+        else
+            printf "warning: Open vSwitch is being re-installed or upgraded,\n"
+            printf "         but the xapi database cache is missing.\n"
+            printf "Re-creating xapi database cache...  "
+        fi
+
+        if /usr/share/openvswitch/scripts/interface-reconfigure rewrite; then
+            printf "done.\n"
+        else
+            printf "FAILED\n"
+            printf "Open vSwitch can only be installed on a XenServer that\n"
+            printf "has connectivity to xapi on the pool master.  Please\n"
+            printf "fix connectivity to the pool master, then try again.\n"
+            exit 1
+        fi
     fi
 fi
 
-- 
1.7.1





More information about the dev mailing list