Open vSwitch 1.7.3のインストール

Pocket

開発用のヘッダー類はすでに入っているものと仮定します。

  • CentOS 6.3
  • Open vSwitch 1.7.3

openssl-devel を入れないとビルドするときにエラーになります。

yum -y install openssl-devel

rpm構築ベースディレクトリは ~/rpm/ とします。

ソースのダウンロード

cd ~
wget http://openvswitch.org/releases/openvswitch-1.7.3.tar.gz
tar xvzf openvswitch-1.7.3.tar.gz
cd openvswitch-1.7.3

CentOS6.3用にパッチを当てる

そのままカーネルモジュールをビルドしようとすると以下の様なエラーが発生して失敗してしまいます。

In file included from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/netlink.h:4,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/net/genetlink.h:5,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/genetlink.inc:3,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/genetlink-brcompat.c:10:
/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/skbuff.h:242: error: redefinition of 'skb_frag_page'
include/linux/skbuff.h:1612: note: previous definition of 'skb_frag_page' was here
In file included from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/actions.c:21:
/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/skbuff.h:242: error: redefinition of 'skb_frag_page'
include/linux/skbuff.h:1612: note: previous definition of 'skb_frag_page' was here
In file included from include/linux/if_ether.h:126,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/if_ether.h:4,
                 from include/linux/etherdevice.h:27,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/etherdevice.h:5,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/brcompat_main.c:25:
/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/skbuff.h:242: error: redefinition of 'skb_frag_page'
include/linux/skbuff.h:1612: note: previous definition of 'skb_frag_page' was here
In file included from include/linux/ip.h:108,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/ip.h:4,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/checksum.c:22:
/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/skbuff.h:242: error: redefinition of 'skb_frag_page'
include/linux/skbuff.h:1612: note: previous definition of 'skb_frag_page' was here
In file included from include/linux/if_ether.h:126,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/if_ether.h:4,
                 from include/linux/netdevice.h:29,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/netdevice.h:4,
                 from include/linux/if_arp.h:26,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/if_arp.h:4,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/datapath.c:23:
/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/skbuff.h:242: error: redefinition of 'skb_frag_page'
include/linux/skbuff.h:1612: note: previous definition of 'skb_frag_page' was here
make[2]: *** [/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/genetlink-brcompat.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from include/linux/if_ether.h:126,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/if_ether.h:4,
                 from include/linux/netdevice.h:29,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/netdevice.h:4,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/dp_notify.c:19:
/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/skbuff.h:242: error: redefinition of 'skb_frag_page'
include/linux/skbuff.h:1612: note: previous definition of 'skb_frag_page' was here
In file included from include/linux/if_ether.h:126,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/if_ether.h:4,
                 from include/linux/netdevice.h:29,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/netdevice.h:4,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/dp_sysfs_dp.c:32:
/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/skbuff.h:242: error: redefinition of 'skb_frag_page'
include/linux/skbuff.h:1612: note: previous definition of 'skb_frag_page' was here
In file included from include/linux/if_ether.h:126,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/if_ether.h:4,
                 from include/linux/netdevice.h:29,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/netdevice.h:4,
                 from /home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/dp_sysfs_if.c:23:
/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/../datapath/linux/compat/include/linux/skbuff.h:242: error: redefinition of 'skb_frag_page'
include/linux/skbuff.h:1612: note: previous definition of 'skb_frag_page' was here
make[2]: *** [/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/brcompat_main.o] Error 1
make[2]: *** [/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/actions.o] Error 1
make[2]: *** [/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/dp_notify.o] Error 1
make[2]: *** [/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/checksum.o] Error 1
make[2]: *** [/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/datapath.o] Error 1
make[2]: *** [/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/dp_sysfs_dp.o] Error 1
make[2]: *** [/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux/dp_sysfs_if.o] Error 1
make[1]: *** [_module_/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.32-279.22.1.el6.x86_64'
make: *** [default] Error 2
make: Leaving directory `/home/wnoguchi/rpm/BUILD/openvswitch-1.7.3/_default/datapath/linux'
エラー: /var/tmp/rpm-tmp.he0OEq の不正な終了ステータス (%build)


RPM ビルドエラー:
    マクロ %2 は不正な名前です (%define)
    マクロ %2 は不正な名前です (%define)
    マクロ %2 は不正な名前です (%define)
    /var/tmp/rpm-tmp.he0OEq の不正な終了ステータス (%build)

パッチをダウンロードして当てます。

$ wget -O ovs.patch 'http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=patch;h=6c4ea27c48b30eaec8e37e642d5072f53c5b2670'
$ patch -p1 < ovs.patch 
patching file acinclude.m4
patching file datapath/linux/compat/include/linux/skbuff.h
$ ./boot.sh
$ ./configure
$ make dist

パッチを当てたソースがtar.gzでできていることを確認

$ ls | grep tar.gz
openvswitch-1.7.3.tar.gz

rpmビルド用のソースディレクトリにtar ballをもっていきます。

cp openvswitch-1.7.3.tar.gz ~/rpm/SOURCES/

rpmのビルド

# Open vSwitchのビルド
rpmbuild -bb rhel/openvswitch.spec
# カーネルモジュールのビルド
rpmbuild -bb rhel/openvswitch-kmod-rhel6.spec

できたrpmを確認します。

$ pwd
/home/wnoguchi/rpm/RPMS/x86_64
$ ls
kmod-openvswitch-1.7.3-1.el6.x86_64.rpm
openvswitch-debuginfo-1.7.3-1.x86_64.rpm
openvswitch-1.7.3-1.x86_64.rpm

インストール

# cd /home/wnoguchi/rpm/RPMS/x86_64/
# rpm -ivh openvswitch-1.7.3-1.x86_64.rpm \
> openvswitch-debuginfo-1.7.3-1.x86_64.rpm \
> kmod-openvswitch-1.7.3-1.el6.x86_64.rpm
準備中...                ########################################### [100%]
   1:kmod-openvswitch       ########################################### [ 33%]
WARNING: /lib/modules/2.6.32-279.el6.x86_64/weak-updates/openvswitch/brcompat.ko needs unknown symbol ovs_dp_ioctl_hook
   2:openvswitch            ########################################### [ 67%]
   3:openvswitch-debuginfo  ########################################### [100%]

needs unknown symbol ovs_dp_ioctl_hook

妙なエラーメッセージが表示されます。

# chkconfig --list openvswitch
openvswitch    	0:off	1:off	2:on	3:on	4:on	5:on	6:off

# service openvswitch status
ovsdb-server is not running
ovs-vswitchd is not running

# service openvswitch start
Inserting openvswitch module FATAL: Module openvswitch not found.
                                                           [FAILED]
iptables already has a rule for gre, not explicitly enabling.

なぜか失敗しました。
資料をあさっていると、どうもbridgeモジュールがロードされているのがいけないらしいです。

lsmod | grep bridge

bridgeモジュール検索してみたけどヒットしないんですよね・・・。

必殺再起動したらちゃんとロードされてました・・・。

# service openvswitch status
ovsdb-server is running with pid 2172
ovs-vswitchd is running with pid 2181

# which ovs-vsctl
/usr/bin/ovs-vsctl

# ovs-vsctl show
09308413-d439-47c1-b18c-864d848714e6
    ovs_version: "1.7.3"

# service openvswitch restart
ovs-brcompatd is not running.
Killing ovs-vswitchd (2181)                                [  OK  ]
Killing ovsdb-server (2172)                                [  OK  ]
Starting ovsdb-server                                      [  OK  ]
Configuring Open vSwitch system IDs                        [  OK  ]
Starting ovs-vswitchd                                      [  OK  ]
iptables already has a rule for gre, not explicitly enabling.

参考

投稿者紹介

株式会社ユニキャスト
私たちは、テクノロジに魅せられた個性あふれるメンバーによって構成された茨城県日立市に本社を構えるベンチャー企業です。
”テクノロジを通して「驚き」と「感動」を創造し、人々の「夢」と「笑顔」を支えます。” の経営理念をモットーに明るい未来を描き、ワクワクする企画提案を続けて参ります。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください