From 5748c7e9a51748c93bfc511662462be415664a8b Mon Sep 17 00:00:00 2001 From: Edwin Chiu Date: Tue, 10 Mar 2015 11:36:43 -0700 Subject: [PATCH] xenserver: Fix build spec for XenServer 6.5. 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 Signed-off-by: Alex Wang --- AUTHORS | 2 +- INSTALL.XenServer.md | 22 ++++++++++++++++++++++ xenserver/openvswitch-xen.spec.in | 26 +++++++++++++++++++------- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/AUTHORS b/AUTHORS index 6e8b4da6e..fd3749a48 100644 --- a/AUTHORS +++ b/AUTHORS @@ -229,7 +229,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 diff --git a/INSTALL.XenServer.md b/INSTALL.XenServer.md index 62c76b9c1..072a9f2ff 100644 --- a/INSTALL.XenServer.md +++ b/INSTALL.XenServer.md @@ -80,6 +80,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= + KERNEL_NAME= + KERNEL_VERSION= + XEN_VERSION= + 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: + + `` 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 ------------------------------------- diff --git a/xenserver/openvswitch-xen.spec.in b/xenserver/openvswitch-xen.spec.in index 31ff1bff4..3bae86a51 100644 --- a/xenserver/openvswitch-xen.spec.in +++ b/xenserver/openvswitch-xen.spec.in @@ -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" @@ -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 @@ -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 @@ -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} -- 2.20.1