Skip to content

Commit

Permalink
xenserver: Fix build spec for XenServer 6.5.
Browse files Browse the repository at this point in the history
The latest XenServer 6.5 uses a new way for kernel version naming.
Therein, the kernel flavor could not be found anymore.  Also, the
directory name in 'lib/modules/' becomes a shortened version of
kernel version. e.g.:

[root@localhost ~]# ls /lib/modules/
3.10.0+2

As a workaround, this commit modifies the spec file to make
%{kernel_flavor} optional and %{xen_version} definable by users.
In the long run, I'd like to spend time refining the spec file.

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 Mar 10, 2015
1 parent b953042 commit 95c6aa0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ David Palma palma@onesource.pt
Derek Cormier derek.cormier@lab.ntt.co.jp
Dhaval Badiani dbadiani@vmware.com
DK Moon dkmoon@nicira.com
Edwin Chiu echiu@nicira.com
Edwin Chiu echiu@vmware.com
Eivind Bulie Haanaes
Eric Lopez elopez@nicira.com
Frido Roose fr.roose@gmail.com
Expand Down
22 changes: 22 additions & 0 deletions INSTALL.XenServer
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,28 @@ where:
The "xen" flavor is the main running kernel flavor and the "kdump" flavor is
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:

```
VERSION=<Open vSwitch version>
KERNEL_NAME=<Xen Kernel name>
KERNEL_VERSION=<Xen Kernel version>
XEN_VERSION=<Xen Kernel flavor(suffix) >
rpmbuild \
-D "openvswitch_version $VERSION" \
-D "kernel_name $KERNEL_NAME" \
-D "kernel_version $KERNEL_VERSION" \
-D "xen_version $XEN_VERSION" \
-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
26 changes: 19 additions & 7 deletions xenserver/openvswitch-xen.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# notice and this notice are preserved. This file is offered as-is,
# without warranty of any kind.

# When building, the rpmbuild command line should define
# openvswitch_version, kernel_name, kernel_version, and kernel_flavor
# using -D arguments.
# For XenServer version < 6.5, when building, the rpmbuild command line
# should define openvswitch_version, kernel_name, kernel_version and
# kernel_flavor using -D arguments.
# for example:
#
# rpmbuild -D "openvswitch_version 1.1.0+build123"
Expand All @@ -18,6 +18,16 @@
# -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 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"
# -bb /usr/src/redhat/SPECS/openvswitch-xen.spec
#
# If tests have to be skipped while building, specify the '--without check'
# option. For example:
# rpmbuild -bb --without check xenserver/openvswitch-xen.spec
Expand All @@ -33,13 +43,15 @@
%define kernel_flavor xen
%endif

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

# bump this when breaking compatibility with userspace
%define module_abi_version 0

# build-supplemental-pack.sh requires this naming for kernel module packages
%define module_package modules-%{kernel_flavor}-%{kernel_version}
%define module_package modules%{?kernel_flavor:-%{kernel_flavor}}-%{kernel_version}

%bcond_without check

Expand All @@ -65,12 +77,12 @@ traffic.
Summary: Open vSwitch kernel module
Group: System Environment/Kernel
License: GPLv2
Provides: %{name}-modules-%{kernel_flavor} = %{kernel_version}, openvswitch.ko.%{module_abi_version}
Requires: kernel-%{kernel_name} = %{kernel_version}
Provides: %{name}-modules%{?kernel_flavor:-%{kernel_flavor}} = %{kernel_version}, openvswitch.ko.%{module_abi_version}
Requires: kernel%{?kernel_flavor:-%{kernel_flavor}} = %{kernel_version}

%description %{module_package}
Open vSwitch Linux kernel module compiled against kernel version
%{xen_version}.
%{kernel_version}%{?kernel_flavor:%{kernel_flavor}}.

%prep
%setup -q -n openvswitch-%{openvswitch_version}
Expand Down

0 comments on commit 95c6aa0

Please sign in to comment.