Skip to content

Commit

Permalink
xenserver: Use kernel uname version for XenServer 6.5
Browse files Browse the repository at this point in the history
In XenServer 6.5, multiple kernel packages with different
rpm versions can have the same uname.  So, it is not
necessary for openvswitch kernel module to require the
exact rpm version.  Instead, the kernel module package
should check the uname version.

This commit will add a new variable %{kernel_uname} to
specify whether to use kernel uname version or kernel
rpm version as requirement.

When %{kernel_name} is used, openvswitch-module will have
"Requires: kernel-uname-r = <uname version>" set instead of
"Requires: kernel = <version>".

Reported-by: Gosen Chien <astgosen@ccu.edu.tw>
Signed-off-by: Edwin Chiu <echiu@vmware.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
  • Loading branch information
Edwin Chiu authored and yew011 committed May 2, 2015
1 parent 9b92891 commit 2c3f6a7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
18 changes: 4 additions & 14 deletions INSTALL.XenServer.md
Expand Up @@ -81,26 +81,16 @@ where:
the crashdump kernel flavor. Commonly, one would specify "xen" here.

For XenServer 6.5 or above, the kernel version naming no longer contains
KERNEL_FLAVOR. Correspondingly, the the final "rpmbuild" step changes to:
KERNEL_FLAVOR. In fact, only providing the `uname -r` output is enough.
So, the final "rpmbuild" step changes to:

```
VERSION=<Open vSwitch version>
KERNEL_NAME=<Xen Kernel name>
KERNEL_VERSION=<Xen Kernel version>
XEN_VERSION=<Xen Kernel flavor(suffix) >
KERNEL_UNAME=<`uname -r` output>
rpmbuild \
-D "openvswitch_version $VERSION" \
-D "kernel_name $KERNEL_NAME" \
-D "kernel_version $KERNEL_VERSION" \
-D "xen_version $XEN_VERSION" \
-D "kenel_uname $KERNEL_UNAME" \
-bb xenserver/openvswitch-xen.spec
```

where:

`<Xen Version>` is the output of `uname -r`. Since XenServer 6.5, the
directory name in 'lib/modules/' becomes a shortened expression of the
KERNEL_VERSION.

Installing Open vSwitch for XenServer
-------------------------------------
Expand Down
20 changes: 14 additions & 6 deletions xenserver/openvswitch-xen.spec.in
Expand Up @@ -18,14 +18,12 @@
# -D "kernel_flavor xen"
# -bb /usr/src/redhat/SPECS/openvswitch-xen.spec
#
# For XenServer version >= 6.5, replace kernel_flavor with xen_version which
# should be the `uname -r` output.
# For XenServer version >= 6.5, use kernel_uname which should be
# the `uname -r` output.
# for example:
#
# rpmbuild -D "openvswitch_version 2.3.0+build123"
# -D "kernel_name NAME-xen"
# -D "kernel_version 3.10.41-323.380416"
# -D "xen_version 3.10.0+2"
# -D "kernel_uname 3.10.0+2"
# -bb /usr/src/redhat/SPECS/openvswitch-xen.spec
#
# If tests have to be skipped while building, specify the '--without check'
Expand All @@ -36,6 +34,11 @@
%define openvswitch_version @VERSION@
%endif

%if %{?kernel_uname:1}%{!?kernel_uname:0}
%define kernel_name kernel
%define kernel_version %{kernel_uname}
%endif

%if %{?kernel_name:0}%{!?kernel_name:1}
%define kernel %(rpm -qa 'kernel*xen-devel' | head -1)
%define kernel_name %(rpm -q --queryformat "%%{Name}" %{kernel} | sed 's/-devel//' | sed 's/kernel-//')
Expand All @@ -44,7 +47,7 @@
%endif

%if %{?xen_version:0}%{!?xen_version:1}
%define xen_version %{kernel_version}%{kernel_flavor}
%define xen_version %{kernel_version}%{?kernel_flavor:%{kernel_flavor}}
%endif

# bump this when breaking compatibility with userspace
Expand Down Expand Up @@ -78,7 +81,12 @@ Summary: Open vSwitch kernel module
Group: System Environment/Kernel
License: GPLv2
Provides: %{name}-modules%{?kernel_flavor:-%{kernel_flavor}} = %{kernel_version}, openvswitch.ko.%{module_abi_version}
%if %{?kernel_uname:0}%{!?kernel_uname:1}
Requires: kernel%{?kernel_flavor:-%{kernel_flavor}} = %{kernel_version}
%endif
%if %{?kernel_uname:1}%{!?kernel_uname:0}
Requires: kernel-uname-r = %{kernel_version}
%endif

%description %{module_package}
Open vSwitch Linux kernel module compiled against kernel version
Expand Down

0 comments on commit 2c3f6a7

Please sign in to comment.