|
|
楼主 |
发表于 2019-10-8 08:08:13
|
显示全部楼层
用OpenStack计算来托管和管理云计算系统。OpenStack计算是基础设施即服务(IaaS)系统的重要组成部分。主要模块是用Python实现的。 " N7 z) m* A! O% f8 P( ? z7 c
OpenStack计算与OpenStack标识进行交互,用于身份验证,用于资源目录跟踪和选择的OpenStack放置,用于磁盘和服务器映像的OpenStack映像服务,以及用于用户和管理界面的OpenStack仪表板。图像访问受到项目和用户的限制;每个项目的配额是有限的(例如,实例的数量)。OpenStack计算可以在标准硬件上水平伸缩,并下载映像来启动实例。 7 n l7 C0 Z& R# c1 H5 b7 U' [# c a
OpenStack计算包括以下组件:
, V3 d- _/ |( {. D4 ~, H! o6 s9 n1 s/ \& v" _; J1 K
nova-api service ) e( C, G) f4 w: Y7 v5 i
接受并响应最终用户compute API调用。该服务支持OpenStack计算API。它执行一些策略并启动大多数编排活动,例如运行一个实例。9 i7 S, g% f+ o1 r
nova-api-metadata service
" {+ Q0 h: t5 ?& k6 `接受来自实例的元数据请求。在使用nova-network安装以多主机模式运行时,通常使用nova-api-metadata服务。
* |# c: e. p8 J0 A# T/ Mnova-compute service
7 q+ J$ S: g9 Y* R一个工作守护进程,它通过管理程序api创建和终止虚拟机实例。例如:3 d2 u, \1 c: z. @: a+ c) ~0 G- Q
XenAPI for XenServer/XCP
! Z! M6 L( \+ {8 Q( b- @$ p* Xlibvirt for KVM or QEMU
7 X: m5 M+ h+ Y6 c0 E. hVMwareAPI for VMware . y/ @ V* M6 H# K( g4 @+ l
处理相当复杂。基本上,守护进程接受队列中的操作并执行一系列系统命令,比如启动一个KVM实例并更新它在数据库中的状态.. T* G7 a; w( L2 k7 q) {
nova-scheduler service
7 Y3 Y2 k. K1 ?) \' D从队列中获取一个虚拟机实例请求,并确定它运行在哪个计算服务器主机上。7 B! G8 H5 i1 }, K0 H7 S
nova-conductor module
8 N# z/ b5 H. _( Q协调nova-compute服务和数据库之间的交互。它消除了nova-compute服务对云数据库的直接访问。nova-conductor模块水平伸缩。但是,不要在运行nova-compute服务的节点上部署它。
( O$ T- K) A! Nnova-consoleauth daemon
! B# k, u" ? ?0 q( v为控制台代理提供的用户授权令牌。参见nova-novncproxy和nova-xvpvncproxy。要使控制台代理工作,必须运行此服务。您可以对集群配置中的单个nova-consoleauth服务运行这两种类型的代理。; y2 G, m6 N( `9 I; U; I
nova-novncproxy daemon / C3 r- U+ R2 X3 j5 U! r8 C( d% E
提供一个代理,用于通过VNC连接访问正在运行的实例。支持基于浏览器的novnc客户端。$ h/ {- J" {# x1 K) d
nova-spicehtml5proxy daemon * h5 U% g# c$ m: h+ M& Q4 A2 X' X
提供一个代理,用于通过SPICE连接访问正在运行的实例。支持基于浏览器的HTML5客户端。2 R( t" V7 t H
nova-xvpvncproxy daemon
' R2 b9 D4 L4 U3 ?提供一个代理,用于通过VNC连接访问正在运行的实例。支持特定于openstack的Java客户机。, u9 {; p7 a, F- e
The queue ) E( [# U& Q3 g: ?
用于在守护进程之间传递消息的中心集线器。通常用RabbitMQ实现,也可以用另一个AMQP消息队列实现
8 q0 }) O6 z9 F9 ^SQL database
" b3 @; m) k5 V; ^ R: }存储云基础设施的大多数构建时和运行时状态,包括:
6 ~! C8 N, z9 n% iAvailable instance types
0 `" m; _; |/ dInstances in use8 \, C$ X' z, [6 u6 u
Available networks) v+ {* \0 ^9 b- Q# L7 T
Projects
; d7 X2 {* A) A# e理论上,OpenStack计算可以支持SQLAlchemy支持的任何数据库。用于测试和开发工作的公共数据库是SQLite3、MySQL、MariaDB和PostgreSQL。1 z0 n' o: d. X/ `3 P' i) [
+ a2 r* J8 x# a& B$ E准备工作2 R, L/ m7 J& S- G7 @$ R3 O
安装之前我们需要先建库,帐号和api endpoint.
# G1 F- h; V) q
5 E( M2 \! R! y在数据库服务器上执行如下步骤:# ^9 x8 ]& _5 }1 C5 v* {9 f D- H* n
○ 使用root连接数据库服务器: k1 Q# x, @0 U
$ mysql -u root -p root123) i# R( `1 c1 Z& n5 A
○ 建立nova_api、nova和nova_cell0数据库:% a5 e+ ]; f0 l8 g1 S
MariaDB [(none)]> CREATE DATABASE nova_api;8 y0 A% j6 K: _% D9 r+ m
MariaDB [(none)]> CREATE DATABASE nova;/ L& `1 K6 n! G3 b- f" @! K/ o
MariaDB [(none)]> CREATE DATABASE nova_cell0;2 z7 Y) P9 L# M& M& a$ i" l- _
○ 赋予帐号nova对库的操作权限:& Z1 u4 A, o1 C+ P
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'nova123';
. `1 l A8 B' U! J MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'nova123';
/ u; b3 d0 Y( y3 r7 ?# t ^ MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'nova123'
% X; O. f, x+ j# Z) ]+ O加载admin的访问凭据,执行管理员命令:
" V! r) D+ J v; B$ . admin-openrc- h2 j& a( }9 p5 `
建立计算服务的凭据:9 G9 Y9 O; w) e- _& T
* n6 s! {0 @8 N1 J○ 建立nova用户:
8 s& m5 w$ R/ f( D: @" W $ openstack user create --domain default --password-prompt nova
7 {1 X0 j/ q) \" G! D1 Z, R8 V6 d# a& l0 d% v. m$ e
User Password:nova123) R6 a+ }8 U% e' f2 j& {
Repeat User Password:nova123
( J* [$ f2 K, x( h X$ a$ { +---------------------+----------------------------------+% n+ ?' }& O" C9 W; z
| Field | Value |3 P6 S( ~5 v. u! D6 X
+---------------------+----------------------------------+
- ]" D/ D; {* G0 C( a( e. j | domain_id | default |
, l; S: m5 a4 p( [; g, p9 | | enabled | True |
/ a+ c9 {8 B2 e0 B( {( ?8 C" b2 d' M | id | 8a7dbf5279404537b1c7b86c033620fe |
' J& `1 F9 T9 r, V. { | name | nova |9 \% {, n, V# i- d) U. [4 w m
| options | {} |- l/ I- J# j; p
| password_expires_at | None |% Y& R4 P, j, E' h
+---------------------+----------------------------------+, u+ x+ y9 y6 {; U, V$ T
○ 给用户nova添加admin角色:4 b- G* ^8 C7 N" @3 z# b m
$ openstack role add --project service --user nova admin
2 F7 Y: v4 m8 c9 R
3 H* k+ l7 O% N& \ 注意:这个命令没有输出# r" Y) e1 Q5 D. N% {# }1 W
○ 建立nova服务实体:3 N8 Q) b2 }. g
$ openstack service create --name nova --description "OpenStack Compute" compute7 x& F+ t8 E# _" |# u7 B' T# `+ L
! i$ I" R4 H0 v/ B0 T +-------------+----------------------------------+# W+ K* T8 i& h1 c6 ?$ H
| Field | Value |# Z+ z) c3 \$ C. H
+-------------+----------------------------------+) K1 G- @7 i1 U! u/ ]: n
| description | OpenStack Compute |. c3 o! z5 ]( E) w
| enabled | True |
6 }1 t# C5 d; K2 W2 |8 B) i5 k | id | 060d59eac51b4594815603d75a00aba2 |
" d! H1 B O+ {- R" G' P | name | nova |
1 Z$ N* {& c( M- F | type | compute |
3 e; z+ A8 e. a# h8 W, t8 b$ s7 ^* a +-------------+----------------------------------+
' ]4 W3 m* p1 S: @! jCreate the Compute API service endpoints:
% Z8 r8 m" b0 b3 i) i4 `3 v H: L7 e9 ~1 D4 F! ~( o3 Y
$ openstack endpoint create --region RegionOne compute public http://stack.flex.net:8774/v2.1
1 d/ ]4 Q t/ W/ i0 U/ y7 R, Z0 @" q2 R2 B2 A8 M* s; Y' E
+--------------+-------------------------------------------+( w7 d h; ]1 U
| Field | Value |
% m3 M# X3 b# S. P+ T+--------------+-------------------------------------------+, k; I) |2 b9 y* @2 |
| enabled | True |
% }0 p5 ~& B3 S; h| id | 3c1caa473bfe4390a11e7177894bcc7b |
% ]. `/ F( _9 I; Q* s* A2 Q| interface | public |
- v7 D) ?6 j7 @6 U6 V" ^) Z9 P| region | RegionOne |9 N0 L" i, Y) _2 V" J1 L
| region_id | RegionOne |, X+ R& N! z# r' i# f
| service_id | 060d59eac51b4594815603d75a00aba2 |! r! @1 H. _8 [: h
| service_name | nova |- P- g a1 U5 _ z0 e' L* a
| service_type | compute |$ s. R( R" [7 |; s
| url | http://stack.flex.net:8774/v2.1 |
# M1 g5 T M0 y5 e+--------------+-------------------------------------------+% T; T- v1 `5 A/ {" f
2 v( c9 E l' D7 H' {3 h6 R
$openstack endpoint create --region RegionOne compute internal http://stack.flex.net:8774/v2.1: q( ^4 E& C) R" d
" Z E& n6 I+ ^' \$ d) l( b+--------------+-------------------------------------------++ z+ Q2 C) u: q: E9 m$ w
| Field | Value |8 I4 k z2 k$ d3 F
+--------------+-------------------------------------------+1 p! q- c5 S& ]
| enabled | True |) ^6 v' o" @& t% A: F' w& F7 S
| id | e3c918de680746a586eac1f2d9bc10ab |7 |$ L6 R% C4 v( ]7 \
| interface | internal |
( |3 O4 \0 S' b& C) l| region | RegionOne |
, u& S, a4 R: \ c5 N Q9 G| region_id | RegionOne |# t5 Y7 b# T* J9 z/ y, o- p
| service_id | 060d59eac51b4594815603d75a00aba2 |
4 p9 ~! g3 Z0 a| service_name | nova |
+ s. k4 q6 k2 H- |0 x| service_type | compute |
3 F5 I) i/ h2 Z5 |# e| url | http://stack.flex.net:8774/v2.1 |! D/ E c# F$ Q
+--------------+-------------------------------------------+
% ]1 I0 X/ B6 k9 I
. x8 k+ ?5 r% J# e; \9 X+ H7 k! t$ openstack endpoint create --region RegionOne compute admin http://stack.flex.net:8774/v2.1" I: i3 K1 t( I ~; b
' d7 z8 {4 E4 }8 S$ X7 Q
+--------------+-------------------------------------------+
, N4 O. F( i6 P; M, c| Field | Value |6 [' Y3 W! O$ j3 }
+--------------+-------------------------------------------+/ [6 d2 R, ^) \$ ~
| enabled | True |
3 x- D5 g6 S8 D( E) t, N| id | 38f7af91666a47cfb97b4dc790b94424 |5 q5 x) \* ?" D) Z- l* Y9 o2 W6 O
| interface | admin |3 g: T- b0 h: G0 P$ P7 C* ^3 @; u
| region | RegionOne |, f5 J0 P, b3 G; J; w! [4 u, \
| region_id | RegionOne |) x: E9 @: D4 ]! a* p9 Q
| service_id | 060d59eac51b4594815603d75a00aba2 |
6 _% }+ S1 F# o$ J| service_name | nova |5 k- H% ]& |, B0 S1 V: G
| service_type | compute |
. k) T* S0 Y! B6 Z1 D| url | http://stack.flex.net:8774/v2.1 |
6 j- P+ }2 ?, @7 W+ n% u+--------------+-------------------------------------------+5 r8 y& h2 j+ X6 l/ _5 c0 e' H- k$ ^
安装配置组件
" |5 }( ~$ ^5 u: r' B$ j安装包:
# e7 e- x. K+ \# yum install openstack-nova-api openstack-nova-conductor \
, k+ e% W. F2 ^, y3 b. r openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler
# \: j) l& I+ B4 I. {& n4 V/ m( D9 K编辑/etc/nova/nova.conf文件完成下列需求:
" M) U0 U V2 Y: G; t, J9 Z, E9 R) f; F* h& E. F
○ 在[DEFAULT]区域, 充计compute和元数据API:
* a9 i/ h0 R7 l [DEFAULT]
7 k2 d; L# e9 v # ...9 \. R" | b6 A2 f/ `' Q
enabled_apis = osapi_compute,metadata& o% X& w6 v- }( R S$ G9 t
; a |' @8 n/ u, ^3 _/ V○ 在[api_database] 和 [database] sections,配置数据库的访问:
+ T2 q0 G1 R% h( [ [api_database]4 u8 w5 f4 U. e" x# r8 h0 G
# ...+ ^) Z$ V5 y. ?/ r% u
connection = mysql+pymysql://nova:nova123@dbs.flex.net/nova_api* u# @ M" v9 t
4 J2 A; m' N' [' _) p# N, r: Z$ r [database]
. C# C" C% ?: z/ l6 ]0 K5 Q # ... x, d$ v0 f1 q9 [6 S
connection = mysql+pymysql://nova:nova123@dbs.flex.net/nova+ \- e8 P6 Z& z/ }. R4 p
! A8 Q {9 o4 L$ B' ^% A& K○ 在[DEFAULT]区域, 配置RabbitMQ消息队列访问:
7 |/ B' ?, v: O( Y" D [DEFAULT]
- R ?. K' m& O! I' ] # ...
7 Q% K1 O& U" I8 q$ c transport_url = rabbit://openstack:openstack123@dbs.flex.net
1 Y( B+ H8 I5 h9 W& k" M4 @/ J, u6 Y+ ~
○ 在[api]和[keystone_authtoken]区域, 配置访问认证服务:' _) U: w8 v/ V3 {8 i! O: Q+ v
[api]
* \$ `: N6 U' U # ..." V6 O9 U0 e) J' p2 o# `
auth_strategy = keystone
9 }$ C$ ?8 X3 Y( t5 t! ?- m4 a5 q: |: i, u% R
[keystone_authtoken]- y9 V( F* ^* A" O3 Z7 k
# ...
4 n0 l2 }* j% n) x3 P1 J auth_url = http://stack.flex.net:5000/v3
( i6 ]9 d0 u/ H memcached_servers = dbs.flext.net:11211: u) R; ^$ t! d7 X" f. R9 f
auth_type = password
0 }4 Q- a+ m Z- e2 u project_domain_name = Default
& s* @0 T* ^; \7 ?1 |1 S4 m user_domain_name = Default, s: f6 |, I" c# Y$ a3 ~3 {/ t
project_name = service
4 J: O6 I5 Q5 g6 Q0 r9 X7 [ username = nova# t$ X u5 o% N9 i* \ [2 f. p3 N1 P
password = nova123
- x. b9 W& S. h" D' \ ; T9 `) G# Z$ ~4 u. j. ?
注意: 注释或移除在掉在[keystone_authtoken]区域中的其它的选项.
. d+ D" e9 `/ Z, y5 K/ h6 w0 a9 g' P+ N0 V [( T$ O6 t
○ 在[DEFAULT]区域, 配置管理接口的IP:2 |6 {# W6 k9 W/ b! q" U2 x, X% s
[DEFAULT]" n: I& J1 F% }1 j" ~/ W4 U$ t
# ...& n1 ]+ |, E; a6 B
my_ip = 192.168.207.2 #此处为控制节点的管理IP地址
/ j9 x6 {7 C& ?# y+ v+ K) A○ 在[DEFAULT]区域, 充许支持的网络:6 c" x" u! ^6 z# y/ U
[DEFAULT]
: g5 i* }8 L- `+ ?% S j # ...$ q9 T$ d: i; }& V1 H3 S: f5 n3 Z
use_neutron = true& t5 K" U b8 y, o% H: T2 t" D3 L
firewall_driver = nova.virt.firewall.NoopFirewallDriver2 o% q5 _3 `% G. I) c
% Q9 w" L% s p. f8 N; x5 J: q7 a 缺省的,计算节点使用一内部的防火墙驱动,因为网络服务包含了一个防火墙驱动,你必须禁用防火墙驱动并使用nova.virt.firewall.NoopFirewallDriver firewall driver/ z+ y& A* V& i7 z3 {
○ 在[vnc]区域, 使用管理接口的IP做为vnc代理使用:/ H& E7 {4 @! F F* G' O. m/ b
[vnc]
5 M9 ~1 {; H; S/ c& X# { enabled = true
; L% R1 ~2 Y# u9 b # ...0 ?1 \+ }. [/ y. r4 H7 K: j
server_listen = $my_ip
3 A+ o' [6 p* P. ~: z server_proxyclient_address = $my_ip
# \$ N5 Q8 T( z, i2 D H$ c* E5 O4 Q. g, ]6 z# d& T
○ 在[glance]区域, 配置镜像服务api的位置:
6 R) D/ F: o- \+ p [glance]) n/ t3 I+ H2 S& M i8 Q2 `
# ...
5 Z; W; P( v) |6 D4 p7 y* c7 u api_servers=http://stack.flex.net:9292
7 i2 K$ t( p4 H7 S! A* L6 Z
8 @/ f; l( A: @: _7 O; O4 K○ 在[oslo_concurrency]区域, 配置锁定的路径:
+ K% D6 \& y1 q# U [oslo_concurrency]3 A$ s! \4 i4 J( Q7 H, ~- Z
# .../ f4 l2 T& s: q/ p& Y% Q5 V
lock_path = /var/lib/nova/tmp J$ m, i1 j c
4 H+ u/ Y6 G8 f$ k0 Y○ 在[placement]区域, 配置访问placement服务:
3 w$ B, q3 U# r: F2 y& s2 M3 f6 B [placement]
1 [5 H, W7 n; a1 @8 w; Y # ...
& T' j1 ]) r/ z2 Y region_name = RegionOne
_5 ?0 B7 L* U$ x8 K0 m project_domain_name = Default- ~, j+ |4 u0 v! d4 @0 l3 r% T
project_name = service
' e( O# Q9 o$ U' @ auth_type = password; f, X d$ \$ m. W4 l- o3 O
user_domain_name = Default
, y0 m- l; q: H: m% L! V- R, @ auth_url = http://stack.flex.net:5000/v3
5 m/ x) w# Y! u% _1 J+ Y/ |( B username = placement! u% ?! M2 w, u0 h: J
password = placement123
7 j& @' Q7 `4 v1 \; d f1 F% A6 L
- v: {1 z" L0 b) ?! x7 l 注意: 注释或移除在掉在[placement]区域中的其它的选项4 B; b# N( m7 m5 K
~- G1 A- a' l7 N! l" a
○ 由于一个bug, 你必须充许访问placement API, 添加下列的配置到/etc/httpd/conf.d/00-nova-placement-api.conf:$ V* s& o+ C2 v, S8 c
<Directory /usr/bin>
% Z" }8 c- F; I# \4 V! S9 z9 M <IfVersion >= 2.4>4 Z. Z, W2 m. Y0 n/ o: l) j/ I
Require all granted
3 E% u6 k. r# K H' E </IfVersion>
; O v7 E1 d. x, \" p- P6 m <IfVersion < 2.4>
/ [3 F0 P. \& U; w. p8 N9 w Order allow,deny
0 C$ T. u' r1 I0 G- I; m Allow from all
/ }3 Y; |. M' {5 q& ~ </IfVersion>
: c1 B4 N: ~/ V' Z5 S O4 M </Directory>
1 i4 M# m" H) [" M5 O, F$ T( g: j, ^- i: @! L z/ }% x3 N% {
○ Restart the httpd service:/ G* A/ C& i9 s" Q$ ~* h
# systemctl restart httpd
* a3 M: f, Q: P3 n6 ^: oPopulate the nova-api database:
& N$ G) B; V5 m2 O1 @# su -s /bin/sh -c "nova-manage api_db sync" nova
* b- ?$ P! n" I7 F$ c! uRegister the cell0 database:
( k$ t0 j2 }0 g, L+ R# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
3 F# C: c4 K) O# _8 RCreate the cell1 cell:
# D# w6 W2 |$ I$ ^0 u* \# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova* g5 p8 O+ D, y9 F" b3 q2 K8 B
109e1d4b-536a-40d0-83c6-5f121b82b650/ g9 s& y" k5 N, m
Populate the nova database:0 n1 d5 N) I2 J. @$ r2 E
# su -s /bin/sh -c "nova-manage db sync" nova
/ k( N1 P/ Q4 hVerify nova cell0 and cell1 are registered correctly:6 l1 o! `" j% n! u2 K$ C7 a1 M
# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
( ]2 l$ T$ U" H% X9 p9 z+-------+--------------------------------------+* s8 F3 N4 K0 j$ t( n
| Name | UUID |$ }7 B0 {: w" k& F/ ]$ |& x
+-------+--------------------------------------+. Q6 H. z ]: Y V
| cell1 | 109e1d4b-536a-40d0-83c6-5f121b82b650 |
; g6 w2 C' Z9 s| cell0 | 00000000-0000-0000-0000-000000000000 |% v( M& U3 C* |0 [! Y
+-------+--------------------------------------+( f8 T% q3 L! y& ]+ L+ ^
安成安装 \2 o4 I: w) M) R$ P: T
○ 允许系统引导时自动启动服务并启动服务:' p1 n1 f3 M& x, i$ X% }! w: L
# systemctl enable openstack-nova-api.service \4 [ N) e8 P8 y7 [ A
openstack-nova-scheduler.service \! {& B8 s& ^; e8 {
openstack-nova-conductor.service \) Y: o/ Z0 g& k$ V# t5 X
openstack-nova-novncproxy.service
! V4 s/ _1 n( x) L0 s& Z6 g% E) c M- U # systemctl start openstack-nova-api.service \4 c$ ? W; E' t
openstack-nova-scheduler.service \
" s$ U0 v$ \2 I+ L( T$ D/ D# \$ y% f openstack-nova-conductor.service \
$ n6 B( x8 F* X/ d) [ openstack-nova-novncproxy.service8 S3 [" z" P l* V7 G
; B3 j4 c' l9 Q* W* y. q+ w
Install and configure components
K" d p0 j9 h6 d& }+ UInstall the packages:# n& A* z& C' @. C. P) b9 m7 O" ?
# yum install openstack-nova-compute! K `3 ]( \ s0 h% X e: N1 M& Y
Edit the /etc/nova/nova.conf file and complete the following actions:
- M) Q! j, l5 P. y
( s! w9 a4 E( R4 }8 `○ In the [DEFAULT] section, enable only the compute and metadata APIs:/ B- Y) |: P# i0 t
[DEFAULT]
& @* n: ?% ?5 ~$ v5 X # ...
6 O. L6 I J+ I2 X. d0 F/ Z enabled_apis = osapi_compute,metadata
3 |, w: J3 w0 E/ F" v4 k2 M& e- a! c1 T/ O! G
○ In the [DEFAULT] section, configure RabbitMQ message queue access:
4 M Z ?% T2 j3 y# j [DEFAULT]. }6 W8 a0 g7 H L
# …
4 Z0 j5 [" l' b. j transport_url=rabbit://openstack:openstack123@dbs.flex.net
! M' S" I0 \* R M3 @
. P# L5 Q5 A- r0 ?" D( q- Y" ?○ In the [api] and [keystone_authtoken] sections, configure Identity service access::$ S- S; W) B& K2 j" K2 _
[api]
F- e- i; q( k+ P* j # ...
2 ?' n+ A: s1 z$ I7 ~& ]2 [4 T auth_strategy = keystone
" t. F( T' j: N/ k
) u+ U* E1 k4 B: o! ]" a& [ [keystone_authtoken]$ p/ N1 o2 P1 K$ C
# ...
$ G) l* p O" W2 W4 H auth_url = http://stack.flex.net:5000/v37 r' X% v8 J5 Z* ~
memcached_servers = dbs.flex.net:11211: u: D2 o( _9 l9 i
auth_type = password
/ ?1 m& E0 ^5 _. G1 P project_domain_name = Default
8 F9 H9 G& m. N( w- P6 \ user_domain_name = Default4 x" `) e* n# ^+ \
project_name = service
! ~7 c; j9 w& Y( [3 Q username = nova
# W, K2 E5 b, W password = nova123
! ` `& U: O* T$ K1 O6 S 注意: 注释或移除在掉在[keystone_authtoken]区域中的其它的选项
& J- d! K i; W1 U, C: U- U6 P8 U8 P9 s' u+ V t2 ]
○ In the [DEFAULT] section, configure the my_ip option:$ U3 Y9 ~' D; A
[DEFAULT]1 Y4 I% d) G* _' P
# ...- [+ m7 ~) o1 I) B
my_ip = 192.168.205.187
- s, |% \2 P# q) X注意:使用管理接口的IP在你的计算节点上.
d: T$ }) S5 e. Q# j0 o
" Q, T6 ?' [1 {4 o" }% y○ In the [DEFAULT] section, enable support for the Networking service:
) T- \8 T; U7 j8 p( P( w" b. l [DEFAULT]5 M6 `$ R# T& p! p" }, S
# ...
3 s N0 [: I$ _9 y+ N use_neutron = true
6 S4 o$ S# u( r$ T9 h- k8 u firewall_driver = nova.virt.firewall.NoopFirewallDriver
9 G4 t) j' Z6 L# T- n3 o/ h注意:缺省的,计算节点使用一内部的防火墙驱动,因为网络服务包含了一个防火墙驱动,你必须禁用防火墙驱动并使用nova.virt.firewall.NoopFirewallDriver firewall driver
; p1 E. M% k5 D8 b9 n. k
4 a i$ u9 E7 j+ ~5 l7 \" |○ In the [vnc] section, enable and configure remote console access:
. H y1 @, n8 V6 i$ B( B% y2 h7 m' E [vnc]
# x! U6 i- J Y# l% g+ v1 Q- B3 x& Z # ...- K+ S) X: c+ Z( J* p+ C" C$ B
enabled = true2 h5 S! k7 I$ e$ Y7 C! c
server_listen = 0.0.0.0' ^' A& V2 N0 E" |+ A
server_proxyclient_address = $my_ip
4 x; _& P1 A9 \, V2 d5 V+ W novncproxy_base_url = http://stack.flex.net:6080/vnc_auto.html6 I/ U4 V9 c' a* a* P3 ~% X! H! L f
1 n5 \( T$ b z! l. I: g' Z 服务器组件监听所有IP地址,代理组件只监听计算节点的管理接口IP地址。基本URL指示可以使用web浏览器访问此计算节点上实例的远程控制台的位置。6 c$ l( J" J/ n1 A
注意:如果要访问远程控制台的web浏览器驻留在无法解析控制器主机名的主机上,则必须使用控制器节点的管理接口IP地址替换控制器。5 r, z' E: P% E6 f# h! i
* w( J- ~1 A; {4 z" w: Z) Z
○ In the [glance] section, configure the location of the Image service API:
, C; F$ `0 u7 c3 R5 u [glance]
% ]$ h) Y" M5 Q. b% O. x1 B # ...
! b- X7 y* x% y, m# G: j api_servers = http://stack.flex.net:9292
9 m$ H5 e$ |1 S; I% L) _0 C# j" [" m! o& v D$ X! G
○ In the [oslo_concurrency] section, configure the lock path:$ c2 M0 i- {* b C& h5 y4 B* w1 h4 S
[oslo_concurrency]
6 i% m7 Y+ `! h9 }+ |) R # ...
$ c. d3 M* H+ _ lock_path = /var/lib/nova/tmp
7 }, a% H+ n! \% S+ Q- L+ v8 \% ?- Q+ T0 n3 N7 _6 S- A. J
○ In the [placement] section, configure the Placement API:1 V3 t, _4 u; Z! {/ {. M
[placement]5 w' O ~6 S! L
# ...
/ U3 u" A2 U% J5 D6 X region_name = RegionOne
# X6 k! I% r2 s- }6 I project_domain_name = Default
* Z5 ~) |. X4 j, c/ X2 O$ J project_name = service
. T" q2 ]: ?. W* ]) u auth_type = password
& K6 c; y( ^& Z$ j% T! } user_domain_name = Default' y0 A- h8 i& U+ A& Y
auth_url = http://stack.flex.net:5000/v31 g d- d. @% n5 R6 Y6 f
username = placement' J! n# ] X- ~
password = placement123
9 f* G W3 }3 d* gFinalize installation
* ]4 f3 E6 g& J0 v1 u1 `4 eDetermine whether your compute node supports hardware acceleration for virtual machines:; `) v3 q# ^4 M8 [
8 y# b" s7 K# B
$ egrep -c '(vmx|svm)' /proc/cpuinfo
' P- {2 `6 i3 l1 X5 Z( \+ f& X$ ]; n3 K8 N) W$ E
如果这个命令返回1或大于1的值,你的计算节点支持硬件加速,通常不需要额外的配置,通常如果你的计算节点使用的是Vmware Workstation虚拟机,你可以充许virtuallze Intel VT-x/EPT or AMD-V/RVI这样打开虚拟化设置' [0 O- C' X6 T1 ?1 V
$ Q, M) R* @$ U9 E X9 R8 S. z
如果这个命令返回一个0值,你的计算节点不支持硬件加速,并且你必须配置libvirt使用QEMU取代KVM, 编辑文件/etc/nova/nova.conf文件如下:
. j+ O3 B# R2 n# w/ j[libvirt]# |2 y2 q5 g+ `% ]
# ...9 {+ i' q9 |7 g' a1 u
virt_type = qemu
( u! W7 A: R8 F5 fStart the Compute service including its dependencies and configure them to start automatically when the system boots:. ?. B z: j. s
2 j# l# k& \1 r# systemctl enable libvirtd.service openstack-nova-compute.service3 \7 b) O4 m# B( Q$ ]* M% I! l
# systemctl start libvirtd.service openstack-nova-compute.service1 k; S$ {- s1 Y5 s4 r% P" _
0 x9 {& Z7 B+ L
注意:如果nova-compute服务无法启动,请检查/var/log/nova/nova- computer .log。controller:5672上的错误消息AMQP服务器不可访问,这可能表明控制器节点上的防火墙正在阻止对端口5672的访问。将防火墙配置为打开控制器节点上的端口5672并在计算节点上重新启动nova-compute服务。! Z0 _) {# z( q9 S; p0 [' p2 {
Add the compute node to the cell database$ q; b; H! n. e) i3 Q2 c
Source the admin credentials to enable admin-only CLI commands, then confirm there are compute hosts in the database:( W. e" E P5 O
% g( |$ S' s4 X
$ . admin-openrc4 k3 G9 P1 I! A: S. f; |; I; }) Q# T3 Z
3 Z/ [" D) `* m
$ openstack compute service list --service nova-compute0 k2 P- |/ H- [ Q* u
+----+-------+--------------+------+-------+---------+----------------------------+
1 c& i5 Q6 \8 T| ID | Host | Binary | Zone | State | Status | Updated At |
4 X: ?6 V& p/ G' S5 }+ t+----+-------+--------------+------+-------+---------+----------------------------+3 z9 f- ^4 A$ \( ^; L
| 1 | node1 | nova-compute | nova | up | enabled | 2017-04-14T15:30:44.000000 |/ b; u4 e% m, W R! A# V* i4 @2 W
+----+-------+--------------+------+-------+---------+----------------------------+ u0 B; G* H# y2 g" u8 ?3 z5 P% R4 J
Discover compute hosts:: T# A( s. z3 d. s4 k& ~% s
P( }, B" E/ b0 f6 N/ S. q* e
# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova( w4 b' I0 Q& g
. I3 X+ N7 K& P1 m5 l
Found 2 cell mappings.
) N) ~: g: J8 s4 t8 _! r7 cSkipping cell0 since it does not contain hosts.: |9 n) U" p, i6 [
Getting compute nodes from cell 'cell1': ad5a5985-a719-4567-98d8-8d148aaae4bc' H0 X5 e/ N! r/ M8 ?! T0 @
Found 1 computes in cell: ad5a5985-a719-4567-98d8-8d148aaae4bc8 N6 H1 A8 j4 z0 H" v
Checking host mapping for compute host 'compute': fe58ddc1-1d65-4f87-9456-bc040dc106b3( F2 |1 i! P' R# }9 p |
Creating host mapping for compute host 'compute': fe58ddc1-1d65-4f87-9456-bc040dc106b35 ?, [% y" R7 H" J& E+ X6 c5 X1 Z
注意:当你添加新的计算节点,你必须运行nova-manage cell_v2 discover_hosts在控制器上注册新的计算节点,替代方法为你可以在/etc/nova/nova.conf中设置一个适当的间间隔自动发现计算节点:
- K2 q, A0 f( n" ?5 I: N; _/ @[scheduler]
$ c! v2 l0 [/ v; c3 \* [' ]( e- e3 Zdiscover_hosts_in_cells_interval = 3006 E h2 l; ?1 o! i1 P3 O
Verify operation
5 g* J3 p* p. C3 `, h8 @: pVerify operation of the Compute service.
! u# P7 c. o# d, L: PNote: Perform these commands on the controller node.5 S' Y& h0 j9 a) Q1 T
) y# t$ c7 N6 J9 I' fSource the admin credentials to gain access to admin-only CLI commands:( m+ b% v: K7 X9 m% P; B
$ . admin-openrc
& z! W S0 R3 b* z0 u7 CList service components to verify successful launch and registration of each process:& h8 `1 q" b# E2 S
1 l7 C1 [( \- C0 v0 y! D6 U' N Q$ openstack compute service list
9 j, ~' F( T2 N$ y
- Z- j" z- U0 w. H+ h) ~" b+----+--------------------+------------+----------+---------+-------+----------------------------+
, o5 x) ^9 d8 E5 k& p| Id | Binary | Host | Zone | Status | State | Updated At |1 w+ F( o' o7 l4 s$ F
+----+--------------------+------------+----------+---------+-------+----------------------------++ g% g3 ?& h! w# w5 P
| 1 | nova-scheduler | controller | internal | enabled | up | 2016-02-09T23:11:15.000000 |
8 M8 u+ x! C j- Z$ X| 2 | nova-conductor | controller | internal | enabled | up | 2016-02-09T23:11:16.000000 |
# f, z5 y* f% L4 b| 3 | nova-compute | compute1 | nova | enabled | up | 2016-02-09T23:11:20.000000 |
- z: i. w* l0 h1 F& }$ @+----+--------------------+------------+----------+---------+-------+----------------------------+( K8 x5 h' O% m R, s2 p
/ Q9 ?+ ^- q0 I. I. {Note: This output should indicate two service components enabled on the controller node and one service component enabled on the compute node.
1 o3 q1 V% k+ G8 i4 P+ e; `List API endpoints in the Identity service to verify connectivity with the Identity service:' j! k# `* Q/ H0 t: f# L
$ openstack catalog list
, V2 `9 r$ V3 T+ h( e( p8 F6 i( r+-----------+-----------+---------------------------------------------+
" j' x+ U9 F. Z" e* ?" x| Name | Type | Endpoints |) n w& h2 X9 J8 K" L$ e2 U
+-----------+-----------+---------------------------------------------+
9 V5 O" Q6 p7 n; I/ R| placement | placement | RegionOne |
( k% n$ s z3 F' e9 V1 ~| | | admin: http://stack.flex.net:8778 |
. q( P! C _# U7 V. s| | | RegionOne |) S7 D$ u, O6 T
| | | internal: http://stack.flex.net:8778 |
D. w# \5 o9 m1 B| | | RegionOne |
6 ]9 ~$ B! _. F( J| | | public: http://stack.flex.net:8778 |
8 C- j5 X) t d) G9 W' G| | | |
W2 a2 D% W) E. k2 Q| glance | image | RegionOne |4 p# @% r' b) y, g* O
| | | admin: http://stack.flex.net:9292 |
: V5 q/ J1 a# H: D| | | RegionOne |
+ w$ \" ^, W! H' j* H$ ]| | | public: http://stack.flex.net:9292 |
: l- n8 \$ R- |0 ^9 K6 g| | | RegionOne |
' q. I" @; k! j2 h d( F| | | internal: http://stack.flex.net:9292 |; ] Q3 S) n/ X4 j' K6 a
| | | |, _! U0 S, N, J, F. B. ]: m
| nova | compute | RegionOne |% `& E! E2 p% P5 g1 s0 H
| | | public: http://stack.flex.net:8774/v2.1 |
# a* ` g2 a/ _8 V# p% B0 Q9 S' p| | | RegionOne |' L! B; D% s* I8 r4 p
| | | internal: http://stack.flex.net:8774/v2.1 |& F3 U" _/ O/ y' X
| | | RegionOne |( ~$ [0 C5 x A) a, G" k/ _- K
| | | admin: http://stack.flex.net:8774/v2.1 |
3 W0 W6 @. w4 c| | | |
% L# {, W7 C J. o! x| keystone | identity | RegionOne |
0 j1 b, d5 F" U8 }( a# x| | | public: http://stack.flex.net:5000/v3/ |0 q7 }6 {% o z) {
| | | RegionOne |5 Q- Y4 r8 t8 B- s: G
| | | admin: http://stack.flex.net:5000/v3/ |( b* k$ m; B7 m/ \; \) X2 s0 \
| | | RegionOne |, F5 z2 f7 F7 p$ \; Z
| | | internal: http://stack.flex.net:5000/v3/ |: |! [5 a* U+ Y" B4 m$ [; Z
| | | |
: ^3 d. Q) x; O+-----------+-----------+---------------------------------------------+% r, ~* p+ w$ J; ^# b8 x
List images in the Image service to verify connectivity with the Image service:& v/ a) h, _& @! N
" R7 ^/ M* ]( G+ U
$ openstack image list+ H1 C2 \" \5 U7 V( q
4 O+ v7 K% s9 s& s7 R. Y
+--------------------------------------+-------------+-------------+" t9 z, X; F( ^/ q q4 y' |! m
| ID | Name | Status |
' _+ K2 X- d* z/ S6 W Y$ ]+--------------------------------------+-------------+-------------+% ]; [1 C( r) u1 r
| 9a76d9f9-9620-4f2e-8c69-6c5691fae163 | cirros | active |
9 }( D! ]8 I1 D3 a t1 j+--------------------------------------+-------------+-------------+0 \! J& j) c; c( _- s- F
Check the cells and placement API are working successfully and that other necessary prerequisites are in place:" I6 U, s! g I( |3 H/ x3 }5 h' B5 J
" R3 t5 G( g: E# Y
# nova-status upgrade check+ X- z% ?' c( E `5 M# _
9 a# {1 c5 Z- J5 S: C E
+--------------------------------------------------------------------+# Q5 h) H, [2 }4 b
| Upgrade Check Results |. |5 ]9 Q3 I. }7 T( I0 q
+--------------------------------------------------------------------+# h. a7 W1 A0 E5 A1 A
| Check: Cells v2 |' ]6 U; [* O7 T
| Result: Success |
% F9 k* o5 _- E$ R) p( I y4 A6 b| Details: None |3 D {6 K2 f }+ n0 d+ G9 ]; C
+--------------------------------------------------------------------+( P: D! C" g' C0 }
| Check: Placement API |7 @7 O' i+ ]. _0 } I; Z# V# ^
| Result: Success |
, d# X. h2 s. Y9 Q4 _6 G| Details: None |8 S; i& [/ x9 q# m
+--------------------------------------------------------------------+
o" }4 a) w4 [# Y| Check: Ironic Flavor Migration |
u( G" i6 {! p| Result: Success |
# {; N" h) W4 f' {) U4 j: d5 s5 H| Details: None |
7 y& w! L1 G4 E3 u" }+--------------------------------------------------------------------+! j- Q% ] D! j0 h& t3 c
| Check: Request Spec Migration |) @' _' [( } Y
| Result: Success |
0 \& `1 p3 i9 q- F| Details: None |
3 U- B: n% ~3 @/ T: E6 ^( ^* q+--------------------------------------------------------------------+
2 v f" J2 B: X8 n| Check: Console Auths |- u0 V9 e. `) \: |) R
| Result: Success |
" C p; c! m& U& M/ \| Details: None |1 W& K1 W' z% n9 I* l
+--------------------------------------------------------------------+0 k7 f2 z8 f( ^4 @0 F4 }8 E
. u! l( g0 }7 R& i9 [; ]8 K: z8 G7 H4 U2 F9 z8 z
OpenStack网络(neutron)允许您创建并将其他OpenStack服务管理的接口设备附加到网络上。可以实现插件来适应不同的网络设备和软件,从而为OpenStack体系结构和部署提供灵活性。
0 |8 Z2 C. P$ B1 G* v 它包括以下组成部分:, x! C4 Y- I3 p1 w: R3 S$ u
0 j; Q$ d. g; S& @neutron-server
& e% x: C0 k/ |5 ^接受API请求并将其路由到适当的OpenStack网络插件以执行操作。: a- Z$ L: r% ^, g: C+ w; z3 Q
OpenStack Networking plug-ins and agents ! _# G m6 s! N! l$ Q, `
插件式的网络端口,创建网络或子网,并提供IP地址。这些插件和代理的差异取决于特定云中使用的供应商和技术。OpenStack网络附带了用于Cisco虚拟和物理交换机、NEC OpenFlow产品、Open vSwitch、Linux桥接和VMware NSX产品的插件和代理。, D$ x; n0 }! y$ R2 _3 e* x
常见的代理包括L3 (layer 3)、DHCP(动态主机IP寻址)和插件代理。
' A7 p; S% Q7 X( U& Y# vMessaging queue
% b( O5 k7 D5 U0 Q1 y大多数OpenStack网络安装都使用它在neutron-server和各种代理之间路由信息。还充当数据库,存储特定插件的网络状态。
- r/ s$ ^ \* g7 v! d- A) |
9 a* R. x) @. c7 }$ r. b2 y" @7 xPrerequisites+ H# f/ C- \1 O9 L7 O$ [7 a6 S
Before you configure the OpenStack Networking (neutron) service, you must create a database, service credentials, and API endpoints.
D* W% }" ]1 e T9 {: p$ F8 P/ k" X% N. i4 i* M: e* O' C; w
To create the database, complete these steps:
7 _" c7 k/ W, I7 \3 e F. G○ Use the database access client to connect to the database server as the root user:0 n# {9 t( ?4 a6 N ^! u: |
$ mysql -u root -p root1234 l0 {2 A1 n- I" U& l
○ Create the neutron database:9 h" Z+ i; o0 H; E
MariaDB [keystone]> CREATE DATABASE neutron;% Z, Y0 G) u4 T) w
○ Grant proper access to the neutron database, replacing NEUTRON_DBPASS with a suitable password:; @0 c2 _) b) ]8 F8 g% }3 \
MariaDB [keystone]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'neutron123';
' { r H# c( m; U0 zSource the admin credentials to gain access to admin-only CLI commands:1 F' L- ^0 E+ U( t
$ . admin-openrc8 y _0 [. T; I; j1 f' l
To create the service credentials, complete these steps:! V+ P5 b% B) R5 @7 ]2 |% s3 ^' I
$ Q# F" t& r6 {2 T
○ Create the neutron user:, j2 r1 N4 @. b3 U& K- C
$ openstack user create --domain default --password-prompt neutron' S+ I z5 k! B n- v3 V
User Password:neutron123
# Y4 {; ^% F; R* FRepeat User Password:neutron123
8 ]5 r! n3 W" a" F- ]+---------------------+----------------------------------+
; x. M( B% k( R, _| Field | Value |
3 b4 O$ g2 r3 o& A! @% t7 g+---------------------+----------------------------------+
7 W D% T9 ~) D| domain_id | default |
. T; e8 K0 @/ r" h| enabled | True |
7 j: u7 M: E4 z| id | fdb0f541e28141719b6a43c8944bf1fb |9 L% z$ e) B$ I% e j
| name | neutron |8 r8 Q: x7 G: X
| options | {} |' x+ \2 W3 J% C: Y) ~) A
| password_expires_at | None |
: E: f+ x, o) ^' W: ^2 @, |0 b6 L, q+---------------------+----------------------------------+
' F8 i" _6 H5 u7 p○ Add the admin role to the neutron user:
5 c( K4 d, T4 p' i4 q$ openstack role add --project service --user neutron admin
& e" T7 j, @2 j) _' M4 p' h
1 B, H& i9 T" N2 NNote: This command provides no output.
; C$ n! T6 V6 q1 L○ Create the neutron service entity:
8 b1 X" c& v3 ^/ r7 o$ openstack service create --name neutron --description "OpenStack Networking" network
2 f$ E6 ]% l/ f3 I8 R
- n9 Y) i0 s* H. G+-------------+----------------------------------+6 S2 \/ m, i, Y: {
| Field | Value |5 J1 k& L0 U: y& n# q7 e2 a
+-------------+----------------------------------+
: U/ t& z7 s, Q6 ^- i| description | OpenStack Networking |! o0 O, {3 r5 g! ]! d
| enabled | True |
) Z( F8 Y6 a7 u* S! {' ~# F| id | f71529314dab4a4d8eca427e701d209e |' x8 J( f, c/ |% ]% J
| name | neutron |6 t% ^, o3 z. A8 i( u* k
| type | network |) q. `: \/ O7 Y8 X% Z! [
+-------------+----------------------------------+$ ]( V) |& Z: i ^2 s
Create the Networking service API endpoints:3 h, r! B% J# q; X) O; @- e
1 \" U# I6 ~6 l0 g5 L6 r! H; a#openstack endpoint create --region RegionOne network public http://stack.flex.net:9696
) w4 ]8 ]/ a/ f; q# ~; c0 A) Y% T+--------------+----------------------------------+2 R" L7 l, n7 N# X/ b5 @$ A
| Field | Value |
: Q. G' z% K; _) f; S+--------------+----------------------------------+# h, o4 w+ D* b- O! q, F9 x
| enabled | True |/ n" }, W8 W* B! ?
| id | 85d80a6d02fc4b7683f611d7fc1493a3 |
7 h4 ?- w( @0 J2 {| interface | public |7 k2 W: B8 l& o6 x7 _& u4 t0 X
| region | RegionOne |
- t& x6 Z. z0 R* e| region_id | RegionOne |
6 O9 U5 y' J, w! G| service_id | f71529314dab4a4d8eca427e701d209e |
, \; z1 q, y, v9 N2 ~| service_name | neutron |2 U! K5 ]- K: G) g( E
| service_type | network |
) g: N e0 f1 y5 `# ]$ a| url | http://stack.flex.net:9696 |+ w5 ^3 f7 | ]! y* c6 a5 H: s
+--------------+----------------------------------+
3 |, M6 g3 B( ]( M" G) P#openstack endpoint create --region RegionOne network internal http://stack.flex.net:9696
1 ?5 m9 W6 g/ O4 ^3 v
! d. F# K- c/ S3 q+ O& ?+--------------+----------------------------------+
' D6 l' O) B8 G0 N) n| Field | Value |4 Z3 r1 Q# m- @: L, y W3 Z* x
+--------------+----------------------------------+3 _, {0 B9 C! v
| enabled | True |9 F0 \: W( D) m ]6 q; B& u) V
| id | 09753b537ac74422a68d2d791cf3714f |& n& R/ s9 B& R
| interface | internal |
% T* X* X6 {: @" R$ E| region | RegionOne |7 Y# |1 y# _9 t' R/ y
| region_id | RegionOne |
, E/ `$ ~" D- T: N2 G; |: V| service_id | f71529314dab4a4d8eca427e701d209e |3 M3 S+ a- t4 N$ E- }; x: ?
| service_name | neutron |1 K$ k9 i& B8 |: O3 Y* }) y
| service_type | network |( g8 z$ ?$ z4 k, z8 c
| url | http://stack.flex.net:9696 |" F3 g- f3 f9 a% y" d V/ P3 i
+--------------+----------------------------------+
+ n: j; Y) e% x- W/ F! `
E# \' f' Z4 u* X#openstack endpoint create --region RegionOne network admin http://stack.flex.net:9696& A* Z" |5 ]1 X9 h& L
! x# W6 Y$ I2 n X [+--------------+----------------------------------+
9 s% q j% T* X1 s( j- a$ F$ \| Field | Value |( {2 \/ `" K' p$ m2 d2 r }
+--------------+----------------------------------+
+ j! A# i9 y' Q# n| enabled | True |( _7 d6 O( B6 U1 _2 n
| id | 1ee14289c9374dffb5db92a5c112fc4e |9 n V( _) q" A9 N7 u) e. S
| interface | admin |
3 `3 X" W/ _' z| region | RegionOne |
- w9 |9 y5 g3 L; O| region_id | RegionOne |* K& ~5 [' N8 ?5 G5 G
| service_id | f71529314dab4a4d8eca427e701d209e |$ @2 ] D/ l, j3 ?2 j: b: o* _& K% L
| service_name | neutron |* b4 f$ ]. b! k+ l! S
| service_type | network |
+ T" y) m1 \' S) v# c) b5 F( B6 N# Z3 z| url | http://stack.flex.net:9696 |$ {. t) L5 ~8 w' {, ]2 h0 b) K
+--------------+----------------------------------+
8 b9 R" n- {/ R" ~8 p+ J5 N- R! H1 t a6 F
#### Configure networking options
7 x9 t2 I1 @; S3 z/ s1 y可以使用选项1和选项2表示的两种体系结构中的一种部署网络服务。
: C2 ]0 \3 f0 P, Y. T, {% V
: m1 N9 V& E4 ]( p" I7 x6 g. K9 @4 s( m选项1部署了最简单的体系结构,它只支持将实例附加到provider(external)网络。没有self-service(private)网络、路由器或浮动IP地址。只有管理员或其他特权用户才能管理provider网络。
* ?" w+ j$ a8 S u
6 O4 B3 S; q; x选项2支持将实例附加到自助服务网络的3层服务来增强选项1。demo或其他无特权用户可以管理自助服务网络,包括在自助服务网络和提供者网络之间提供连接的路由器。此外,浮动IP地址使用来自外部网络(如Internet)的自助服务网络提供到实例的连接。' E g% d, e: a" b" A% R
" s' R0 O; ^1 u! N' i自服务网络通常使用overlay网络。overlay网络协议如vxlan包括额外的头部信息,这些头文件增加了开销,减少了有效负载或用户数据可用的空间。在不了解虚拟网络基础设施的情况下,实例尝试使用默认的1500字节以太网最大传输单元(MTU)发送数据包。网络服务通过DHCP自动向实例提供正确的MTU值。但是,有些云镜像不使用DHCP或忽略DHCP MTU选项,需要使用元数据或脚本进行配置。) k& r b( \; z. g' f9 _
8 G( L, {4 B( X! a+ ?选择下列网络选项中的一个,或两个全选,参看下面的两个章节。并返回这里再向下继续配置
6 X+ U6 q* A: d' V) L: E- p- q8 I7 _○ Networking Option 1: Provider networks% C1 D3 u6 e; U$ V/ V, P7 l" v8 }0 G
○ Networking Option 2: Self-service networks
/ {' d+ f0 ~ \) G3 K3 |* p$ U2 p0 f, }- t3 V
Configure the metadata agent
8 ?& t; y( Z0 ]The metadata agent provides configuration information such as credentials to instances.
7 J: A5 \: Y) e$ y- O1 S" X3 m5 VEdit the /etc/neutron/metadata_agent.ini file and complete the following actions:
) l$ f9 ]: ~+ E1 U) |( y
& Y( Z! d! T$ @' ]: c ○ In the [DEFAULT] section, configure the metadata host and shared secret:
( B; K# @( q; v2 {9 ^ [DEFAULT]9 k. a5 S6 O7 C! q" B
# ...& ?! I- K, k% r9 l, c' A
nova_metadata_host = stack.flex.net
) y% d* B" X& m: S# T metadata_proxy_shared_secret = 1234 6 L. f/ P7 c9 q2 ~4 _& g; g
. z' I- ]) `8 U! e6 B: @: x( `
Replace METADATA_SECRET with a suitable secret for the metadata proxy.
" o% {! [' ]5 {- @Configure the Compute service to use the Networking service
$ F% ]7 w8 W5 V% e; `# Y3 Q1 VNote: The Nova compute service must be installed to complete this step. 2 F# ^6 l; I \, h9 K% N
Edit the /etc/nova/nova.conf file and perform the following actions:
7 s* N$ D7 w: ~$ z3 w4 A. t# O
+ e( i: i* N4 h$ `" u' T- S, c2 s ○ In the [neutron] section, configure access parameters, enable the metadata proxy, and configure the secret:) s- O% N# B1 _, ~1 R
[neutron]* m2 h) \8 y, d0 i
# ...
w! Z6 U1 `6 ]/ O6 g; \! ?8 W url = http://stack.flex.net:96963 A9 [5 W6 X! O& Z) a3 R" T k
auth_url = http://stack.flex.net:5000
/ X) h6 x2 h7 \% P/ x auth_type = password
! T% e) }" V, b1 h* O project_domain_name = default! A% _2 s6 e& h8 ^
user_domain_name = default
$ s( P; }8 K5 q/ {+ D$ k region_name = RegionOne& q: O$ e7 _- r# V9 U4 Z+ x. Y
project_name = service/ u7 }% o; y& o5 T$ r
username = neutron, ~* }* ?3 }( \) d8 `
password = neutron123
+ C$ e0 t' z3 J- O2 s E) f service_metadata_proxy = true
* M" I# {4 ` m/ w+ X3 I9 w metadata_proxy_shared_secret = 12346 a" f X- f2 r: D" o) w$ _, j
Finalize installation
/ U9 [/ a8 T1 U- d2 z1 w0 zThe Networking service initialization scripts expect a symbolic link /etc/neutron/plugin.ini pointing to the ML2 plug-in configuration file, /etc/neutron/plugins/ml2/ml2_conf.ini. If this symbolic link does not exist, create it using the following command:9 A1 q0 R6 q; I) ?+ G
# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
% X6 I+ Z! ~" Y% ZPopulate the database:
9 D4 ~8 z: ~( y7 ?" z4 n: F0 Y# su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf \
, D5 Q0 R( m8 c4 Q& K% d --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron: t* a$ e- g! |! H1 h2 ]) W, L
注意:由于脚本需要完整的服务器和插件配置文件,数据库填充将在稍后用于网络。
* I; ~' c; P8 j: A8 P+ M4 L6 }Restart the Compute API service:' {, f) @# r+ C/ P3 R9 T# O0 u
# systemctl restart openstack-nova-api.service
3 G( T0 u" k6 YStart the Networking services and configure them to start when the system boots.
% P* p% ?% J! q2 k8 w [" @For both networking options:) v6 Y' s# l/ \! n
# systemctl enable neutron-server.service \
6 X% }( E- U& ^; P0 m8 f/ C! m8 u neutron-linuxbridge-agent.service neutron-dhcp-agent.service \ [0 }, `* k3 L1 k
neutron-metadata-agent.service! I0 f6 H! o9 a9 A
# systemctl start neutron-server.service \
% H+ ]: a B! J N" |5 P& z neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
' B4 E3 c3 A' w$ @# I neutron-metadata-agent.service# C0 X% s( c$ @; s% x7 h* }# U
/ v) }0 l: r# A5 J
For networking option 2, also enable and start the layer-3 service:) j" T. }( X/ ~) N
# systemctl enable neutron-l3-agent.service
! U3 F9 D3 i& T # systemctl start neutron-l3-agent.service
$ g y0 p. y# c1 E1 M$ a, w4 V3 u+ M$ t6 h2 w1 a5 M- T& j
2019-09-04 16:46:13; I' r% j) c% U4 K1 c1 X$ S8 Z: A
最近测试esxi6.7的vmotion功能,为了熟悉kvm决定在kvm上实现, 系统是ubuntu16.04, 启动一个kvm,发现esxi在迁移时会崩溃,无法进行迁移,查找相关次料,解决方案如下:5 o; d4 _- H. _' T( n/ S5 y4 A
4 Z1 _; \( O1 a7 S7 X
KVM的安装和使用/ y& p! } _; i& N1 }6 Q
首先安装kvm% e4 @+ p! b2 v* I/ R
# apt install qemu-system-x86 qemu-kvm qemu libvirt-bin virt-manager virtinst bridge-utils cpu-checker virt-viewer
# [* Q7 @) \5 h2 ^ Q$ p6 Z) X6 c2 x5 o校验kvm是否安装,并检测cpu的VT-x虚拟化有没有开,出现以下信息说明正常) }# X5 h3 i+ [6 w1 D+ L
# kvm-ok
0 H$ [4 g& c3 k! X* W: l+ E7 q9 E: LINFO: /dev/kvm exists5 J b( ?1 n! t2 h) N' d$ `5 _
KVM acceleration can be used
* Y: s& r- y5 S7 e" x运行virt-host-validate查看你的环境对kvm的技持,如果全部为pass,说明可以
( A* l$ I }4 ]; `# virt-host-validate $ V& [, Y- |, j6 Z9 D
QEMU: Checking for hardware virtualization : PASS
. ?! _" i. L* eQEMU: Checking if device /dev/kvm exists : PASS2 f* N4 M9 D* Y1 f; d
如果你想使普通用户能够使用kvm,可以添加当前用户到libvirt组中
! c% n2 T1 m, a$ M8 n3 M! pcat /etc/group | grep libvirt | awk -F':' {'print $1'} | xargs -n1 sudo adduser $USER
9 T3 g+ t7 T5 A
+ b$ W, ^: t. R' G% L7 q# add user to kvm group also5 Y, R+ Y* w; a2 n- s
sudo adduser $USER kvm# `' N% D6 H- R7 i# o8 a
2 N. ~! [0 O7 e9 H& R* V* R9 x% h# relogin, then show group membership# d. O9 z+ Q' h; D
exec su -l $USER
: D& b2 ]- T% Hid | grep libvirt
0 }% ~. i+ u& f! r$ P, b缺省的,kvm会建立一个虚拟的交换机名字为virbr0, 使用192.168.122.0/248 C& t$ m3 Y! p, I" @/ e% M
# ip addr show virbr04 P: M$ w* Y# T" b5 p; F/ Q
17: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000( b: o2 A4 v2 P: @
link/ether 52:54:00:d2:52:b5 brd ff:ff:ff:ff:ff:ff' W) G* c3 d$ H; h' U
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0: i+ t3 k8 k4 n1 Z; v& }# T
valid_lft forever preferred_lft forever! t- a4 p; U6 s
virbr0实际上是一个nat模式,我们可以通过iptables看到实际的情况8 L9 a7 N8 ?8 y
# iptable -t nat -vnL( ]4 N/ N$ A2 }* P3 C1 o
Chain POSTROUTING (policy ACCEPT 146 packets, 11359 bytes)
& C; s: p. |6 l* p4 ?& c3 J# cpkts bytes target prot opt in out source destination ! w# X" k3 h8 u0 A- r' s. F |
0 0 RETURN all -- * * 192.168.122.0/24 224.0.0.0/24
4 t( x& S. j3 u* `$ ~0 0 RETURN all -- * * 192.168.122.0/24 255.255.255.255
8 Z3 [/ x9 S) u3 F+ c6 t0 0 MASQUERADE tcp -- * * 192.168.122.0/24 !192.168.122.0/24 masq ports: 1024-65535; B. Q. [( I$ P, X
0 0 MASQUERADE udp -- * * 192.168.122.0/24 !192.168.122.0/24 masq ports: 1024-65535
9 k- ~5 {9 C/ U% K+ m) ^3 r9 r0 0 MASQUERADE all -- * * 192.168.122.0/24 !192.168.122.0/24
1 a' w3 p( h7 {1 |+ J3 {; J- U定义存储池,缺省的存储池是/var/lib/libvirt/images, 但你可以另外mount你想要的os磁盘
3 z% X$ o$ P9 v4 I4 b+ N. i$ n# virsh pool-list --all
2 |, j# N( x; u8 r; m" E4 O Name State Autostart
' t; ?# r7 k8 n: E3 i' t-------------------------------------------
2 F- N( M3 [8 \" E! P0 [ t default active yes
& d! Q) x; D1 v- D
0 t8 K. P( R: H/ x* `" n$ virsh pool-define-as kvmpool --type dir --target /data/kvm/pool
* R& _, E! i, KPool kvmpool defined
9 g, k2 G$ K+ ~( w. |$ virsh pool-list --all
7 e& P7 H8 p6 f1 Z3 N% B$ virsh pool-start kvmpool
# \5 Q2 X( l+ }# n$ l8 A- {$ virsh pool-autostart kvmpool
: p1 B9 z: V. U, s
4 O# T; `# o J% A5 l+ @$ virsh pool-list --all
v* @5 k% n6 B2 }+ b. V6 h1 l Name State Autostart + B; \- Y+ y9 w6 w: [3 m
-------------------------------------------5 e, N3 e2 c) P
default active yes
! @1 v( [+ F5 w; g: C# J; v kvmpool active yes
; v3 z* G, M+ p7 B3 {8 v布署一个vm在你的kvm上,建立一个1vcpu/1G RAM使用缺省的virbr0 NAT网络和缺省的pool storage
0 ~* R4 g+ |0 `# c% X3 Fvirt-install --virt-type=kvm --name=ukvm1404 --ram 1024 --vcpus=1 --virt-type=kvm --hvm --cdrom ~/Downloads/mini.iso --network network=default --graphics vnc --disk pool=default,size=20,bus=virtio,format=qcow2 --noautoconsole
5 @1 B. |- P+ a6 o+ z# E l. I& n$ m
# open console to VM
! p& w6 q/ n* q$ a6 Qvirt-viewer ukvm1404
5 H( G5 `' ?* r7 t如果你想删除这个vm,可以使用如下命令:
2 F/ j2 z) b/ o* A `- q4 c7 Kvirsh destroy ukvm1404, e5 L' r3 I. ?" Z
virsh undefine ukvm1404
4 ~" j5 y% N5 X7 b如你想要一个全部图形化的软件管理kvm,可以使用virt-manager,当你没安装图形介面时你可以使用x协议的ssh客户端,如xshell, 或xming+ssh客户端软件% j7 {6 P `4 {+ {3 `$ {/ l
布署esxi在KVM中2 G7 i1 _. |) U ~( ~, c
配置VT-x,你同样需要在ubuntu中配置VT
' [- s# W7 D, j7 E- D4 ` |4 p# vi /etc/modprobe.d/qemu-system-x86.conf 9 |4 s8 R( V; \( u; Q5 ^
) O7 ]8 x' M6 d, h# }! @ [options kvm_intel nested=1 enable_apicv=n2 ]- I; d, H1 s, p) q5 z
options kvm ignore_msrs=1
7 N# R! _( h) F1 k重启系统,执行下列命令,必须返回如下值
7 y9 M: C! W% f" B+ f# want Y to be returned! D) u/ n9 Y; }2 {" N/ D
$ cat /sys/module/kvm/parameters/ignore_msrs$ r: L) v: C# ?( n) H+ G
! S& G, G& j7 E# want N to be returned# K3 |# r% |$ |0 i( ~
$ cat /sys/module/kvm_intel/parameters/enable_apicv0 F F! i/ \6 K& q
) G+ O( n3 h) _+ y
# want Y to be returned
. C1 f# E5 v. u' j# q$ cat /sys/module/kvm_intel/parameters/nested
& v/ C2 [" b& ?+ {2 B建立kvm虚拟机
4 ^2 H) h( ~1 c# M+ p# virt-install --virt-type=kvm --name=esxi4 \: i6 ~& @/ f% H% @/ W' f; G* P' `) `9 S
--ram 4096 --vcpus=4 \
' S; S8 \6 r; ^( Q--virt-type=kvm --hvm \, Q9 t; p" Q1 @0 \
--cdrom /data/iso/VMware-VMvisor-Installer-6.7.0.update03-14320388.x86_64.iso \
5 m3 Q4 o6 w, Z/ s--network network:default,model=e1000 \" ~2 j- y4 m8 j" j" ~4 g& M( ~/ G+ ~
--graphics vnc --video qxl \
+ _7 m9 V3 X0 B+ r--disk pool=default,size=80,sparse=true,bus=ide,format=qcow2 \
9 [) L4 s" v" F9 x+ a( ^$ R4 o--boot cdrom,hd --noautoconsole --force \
6 p* ?& S7 d" [/ p--cpu host-model-only) j0 C% e$ S" T1 t* C& K7 X
当然你也可以使用virt-manager来建立虚拟机。
/ l+ s$ N( ?- B: i3 E0 a在kvm中部署嵌套esxi6.7
. W3 v5 ]+ h8 O6 B9 {7 S6 L
5 ~9 V. H8 @9 N- Q. ^# a" K3 G重复建立两个虚拟机,建立两个esxi实现动态vmotion迁移,测试和建立步骤省略,经测试vmotion可以正常工作,不会出现崩溃现象。; H. z7 F- ?- r) Y. m
% S1 s& k" a: F$ m* B安装和配置网络组件在controller节点上3 ?, p& v4 I) ]( g" o, ^& u
1 o, R4 @3 y- `6 k" `安装包/ I# K( I8 f: z
# yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables0 P( f8 B. R. m: D& }; D; s
配置服务器组件
/ [- {( p9 c1 K0 j+ o( k, J网络服务组件配置包括数据,验证机制,消息队列,拓扑改变通知和插件.
& }6 I$ m/ ^7 p/ {Edit the /etc/neutron/neutron.conf file and complete the following actions:4 `5 J1 l" o9 }0 i. D
○ In the [database] section, configure database access:8 D8 T% ]9 D, \- R! ~+ |1 }4 j
[database]
$ w3 g& s' T4 s' o # ...
$ [! o& M5 y" p1 m connection = mysql+pymysql://neutron:neutron123@dbs.flex.net/neutron
7 j2 E1 K) R) _9 Y/ R 注意:注释或移除其它连接选项在[database]区域中- P; e! R; V. U" ]0 Z! T3 @
7 P" E1 R+ J5 E) @( H, K○ In the [DEFAULT] section, enable the Modular Layer 2 (ML2) plug-in and disable additional plug-ins:) j: V9 N" H5 A3 A9 |* E
[DEFAULT]
$ O# e' B/ l- A8 v" M, P. \) i( B2 B # .../ Q7 e1 p& o+ e# O
core_plugin = ml2
2 O# {! w* R5 P ^: H service_plugins =# C* t3 ^0 d5 F
5 }7 R. w& p4 J) ~2 G○ In the [DEFAULT] section, configure RabbitMQ message queue access:
, T2 Z! F5 U" P$ C. \5 ]) e [DEFAULT]
$ ~: z E1 p: [) l2 J # ...6 A3 W5 w6 u# Q. Z. p
transport_url = rabbit://openstack:openstack123@dbs.flex.net$ Y7 v/ ~* e- n! J# A/ y
+ u' N6 d& d2 s A: W X
○ In the [DEFAULT] and [keystone_authtoken] sections, configure Identity service access:( l+ Q4 ?% S$ ~6 V
[DEFAULT]: p9 z% P' k S6 l w
# ...& |2 U$ m. N9 Y: J
auth_strategy = keystone
; x: G- M. V9 E6 |* C, I* n' J# ] c' D \/ R# ^1 q0 q$ i8 o
[keystone_authtoken] w3 P% w7 w" s4 g7 B; S3 I
# ...5 q; R( W4 N1 j% k5 A9 s2 b/ G! R; I
www_authenticate_uri = http://stack.flex.net:5000% h* G% M5 o. {7 ?, O2 v8 E% |
auth_url = http://stack.flex.net:5000( ~9 t* K, W! C0 I
memcached_servers = dbs.flex.net:11211" N5 y. D5 } w( W6 F, Z
auth_type = password
) R( t. |% V9 |, A7 J project_domain_name = default' K! D3 W# k8 h6 f" F. I
user_domain_name = default
9 |( y: j8 s% z% Y& f project_name = service
3 b/ A, n: G6 F+ F) q- e* D username = neutron
5 q* {; T9 h" u* g$ I password = neutron123
( d3 }4 N* s' U H' J( A' z1 x: O/ R 注意:注释或移除其它连接选项在[keystone_authtoken]区域中& h' y: N" L. P; V
( h/ A$ N+ [( s5 W- V( D
○ In the [DEFAULT] and [nova] sections, configure Networking to notify Compute of network topology changes:
7 k) f* o( y- B5 u j X5 f [DEFAULT]
; }! m- [+ P6 B% W! F c/ N5 a # ...# @" E. V9 I9 @8 e3 @
notify_nova_on_port_status_changes = true$ Q" D4 S l* ]( ~9 n
notify_nova_on_port_data_changes = true
1 t9 D$ g5 r, h1 `: x$ |+ j
" k2 [0 Z- U. b3 t [nova]# a" A9 J. [ Y( g# _ x8 ]+ N6 d
auth_url = http://stack.flex.net:5000( \8 A6 y$ \; k/ x g
auth_type = password
7 l: d6 l7 C2 r" F* I; B project_domain_name = default
+ M6 V! K$ e; R' T8 K user_domain_name = default$ @' \( B$ ~* x' q* a }
region_name = RegionOne
( a& E( {! P9 D9 m( e4 m project_name = service
7 H* B0 l, ?2 F* J username = nova
) @' z0 E+ f8 \% N' J password = nova123* K3 @# j, Q1 c) U: [8 J% J
9 p/ x% j, R* h/ y8 J
○ In the [oslo_concurrency] section, configure the lock path:
! N9 e( W0 _! j' x) j: y4 m [oslo_concurrency]
& f2 O$ u3 u Q6 L% E1 d5 t # ...
% O; D4 ]! O) R/ ]; M$ X lock_path = /var/lib/neutron/tmp1 d( k8 W W5 d9 K& J) j w
配置模块Layer 2 (ML2)插件
" B$ E5 _) o0 \0 D9 @ 实列中使用ML2插件,ML2使用Linux bridge机制建立layer-2(桥接和交换)虚拟网络架构。
# b$ H1 ?( o6 F/ V' q; O Edit the /etc/neutron/plugins/ml2/ml2_conf.ini file and complete the following actions:5 j& s( J* X' G0 V
○ In the [ml2] section, enable flat and VLAN networks:4 R0 @: E6 {: q) E
[ml2]
, b$ I7 ^+ P7 k* ]- Q # ...0 Y( t- `, ]7 L" P
type_drivers = flat,vlan: z: c$ ]1 y6 K0 s9 r
& K" ]7 ]) S& @
○ In the [ml2] section, disable self-service networks:
b" y8 M) I6 @9 z [ml2]- \! Y/ \: T- }
# ...
8 S4 h& x x& p) X tenant_network_types =8 F( m5 t( x+ @
1 v. o7 t8 {& R! k2 i: E7 g
○ In the [ml2] section, enable the Linux bridge mechanism:0 ~! Y5 T. H% Q# {7 N
[ml2]; ~" @( b% X$ d
# ...0 c& @$ @4 G$ @& K3 Z( h& V; O( ^
mechanism_drivers = linuxbridge
/ c2 q# h5 E+ D% D, S L- M5 f" t5 z 警告:配置ML2插件后, 从type_drivers移除这个选项会导致数据库不一致.
1 V6 M- _) B$ r& ?# o- e$ Z4 t% o: H- ?* a% L2 Q! E
○ In the [ml2] section, enable the port security extension driver:
! ]* a5 z, l6 D$ Y$ m$ s, j6 ]- R1 J [ml2]0 I' @ {# g8 k( X
# ...1 `) M2 G( l" N
extension_drivers = port_security. t' F, ]3 g9 B& E) m
! |+ x: C3 A. f O( m! G$ x○ In the [ml2_type_flat] section, configure the provider virtual network as a flat network:
! r. z9 o( D- H+ f% N [ml2_type_flat]
" |% d9 ?3 l& v+ l # ...
7 k2 a0 {, a7 |: X7 } flat_networks = provider
+ R& d! |* C4 H6 z( i
. X* t/ J- j* e7 H# O; I( U○ In the [securitygroup] section, enable ipset to increase efficiency of security group rules:
) Y5 g( H+ h! Y [securitygroup]
; A% s. u4 f+ @% {' C8 a% o # ...
: ~8 e2 w* ]& r; Y5 {0 t7 m enable_ipset = true) D/ O* j( C) k
Configure the Linux bridge agent: e! f! \0 U" w1 v# |
The Linux bridge agent builds layer-2 (bridging and switching) virtual networking infrastructure for instances and handles security groups./ e, e, ~( K& y% b* t/ J
Edit the /etc/neutron/plugins/ml2/linuxbridge_agent.ini file and complete the following actions:
+ g" c3 V- Z. ]7 d○ In the [linux_bridge] section, map the provider virtual network to the provider physical network interface:. L4 ~, J% K6 B) z" Y+ W" a; Z
[linux_bridge]4 q& q2 W$ b# A9 C! T& z, E
physical_interface_mappings = provider:eht1
x# N7 K/ i8 t& u+ m 使用eth1物理网络接口做为租户的网络连接.
9 J( I0 G# E& l1 `8 s% ~4 j+ B8 ^1 N0 \6 w7 H
○ In the [vxlan] section, disable VXLAN overlay networks:; q) m. \: k2 X
[vxlan]- @) n- O) @$ `+ D- J
enable_vxlan = false
8 b2 b6 W' R: _○ In the [securitygroup] section, enable security groups and configure the Linux bridge iptables firewall driver:! y2 s# ]8 V5 }: u" `% y4 O3 N
[securitygroup]
3 v9 G7 T2 [' Z) y* e3 `5 Y. ] # ...( Q0 _/ }) W' w. P* w) T% I# M4 _0 C
enable_security_group = true3 S2 {9 ]7 `$ `) V% G o
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
+ w6 d1 ~' d) t
) z& p4 ~. B8 ?○ Ensure your Linux operating system kernel supports network bridge filters by verifying all the following sysctl values are set to 1:
4 V& ?9 Y; m- S* y* ~, N net.bridge.bridge-nf-call-iptables' d: F7 b: ]' Q' I# b6 L9 @& p& u
net.bridge.bridge-nf-call-ip6tables' D. C8 C! Z6 J( {8 a8 l' T
$ g G1 l6 e- g/ N+ a
# modprobe br_netfilter
" g0 E1 W/ D" C; P8 \! J # vi /etc/sysctl.conf- ` A' s2 y2 { S$ @, q8 f
net.bridge.bridge-nf-call-ip6tables = 11 j; V9 V0 E/ r1 r* o/ M9 q4 v
net.bridge.bridge-nf-call-iptables = 1 : R7 u& }0 C# C0 m0 Y# F( r5 R
# sysctl -p$ N$ H* P2 n0 O+ u, A
net.bridge.bridge-nf-call-ip6tables = 1# Z# V) w# L9 @, {7 _( G
net.bridge.bridge-nf-call-iptables = 19 b! @4 l- e( B% W6 G2 Y% J& _5 h
# X/ r5 _( x- d" j4 y& K
为了网络支持桥接, 通常的需要加载br_netfilter内核模块. 但这里可以忽略错误,当你重启neutron时会自动加载.- u' g$ v6 T1 O4 f, B
Configure the DHCP agent2 i' p1 |; s }8 |
* \( t) C# }8 u& yThe DHCP agent provides DHCP services for virtual networks.* x/ N& [* L0 y2 c6 d: g
Edit the /etc/neutron/dhcp_agent.ini file and complete the following actions:
+ f, C% W% c8 O6 |# k6 z○ In the [DEFAULT] section, configure the Linux bridge interface driver, Dnsmasq DHCP driver, and enable isolated metadata so instances on provider networks can access metadata over the network:
. g3 Z5 C6 N( Z3 m% D[DEFAULT]+ x2 p2 W4 y- u" z+ p1 [) z
# ...% n& l1 l- {9 k* n: e: e% Y0 a5 y
interface_driver = linuxbridge) {+ k8 m- y; G% W! K0 u! I. A
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq' o% \9 z1 ~( y( B/ Y" a6 M
enable_isolated_metadata = true# a3 C" `% B. H
3 |; [8 ?, r$ e" Y5 z/ Y3 ?完成后返回网络配置或继续网络选项22 j5 S% b: ~( _% z- m6 i
* U1 y1 [" D2 e. h! G8 `
2019-09-04 21:02:50
+ `. u; L4 M, c, QInstall and configure the Networking components on the controller node.
; N( ]& E5 E0 K! G) ]
$ [+ L ^0 m/ c) H7 mInstall the components- a" h$ i1 C8 `
# yum install openstack-neutron openstack-neutron-ml2 \
+ d, v7 U+ ~. F4 K$ L# w2 O# Z openstack-neutron-linuxbridge ebtables4 ^4 T1 x" k- q6 o1 [
Configure the server component6 Y4 o2 Y' P9 x( {7 H; j
! a% o+ _' q$ a0 F0 c7 fEdit the /etc/neutron/neutron.conf file and complete the following actions:; q# x9 }/ e4 l5 T# E% v$ K1 P+ _/ W
○ In the [database] section, configure database access:# }; ~; j% l7 l5 B, n
[database]. C8 A; F% N5 F/ G: {9 ^' B
# ... t' ^# M2 ~8 ?1 N; C) L+ W, Y) t
connection = mysql+pymysql://neutron:neutron123@stack.flex.net/neutron
! u$ r, G+ I/ d- y2 F) R注意:注释或移除其它连接选项在[database]区域中( a; a+ h' _2 C6 m; X+ K) e$ ?
○ In the [DEFAULT] section, enable the Modular Layer 2 (ML2) plug-in, router service, and overlapping IP addresses:( b2 L3 E! m) K7 R/ U( o" I4 q
[DEFAULT]1 G+ C6 ]- ?" M! ^) S* r
+ o4 X+ u! I8 a$ T' q! Z. P...( P+ K3 B# S$ m8 o, m2 P5 ~
core_plugin = ml21 n5 h) T$ y: e3 u( W2 A
service_plugins = router8 m3 Q% M/ y* ^ X- C6 w( y
allow_overlapping_ips = true
, l) I( b) X. h4 Q; `7 q, T○ In the [DEFAULT] section, configure RabbitMQ message queue access:; j8 J+ x" q. n
[DEFAULT]7 m. e- {0 Y' F
) W- @ m4 W' B/ M6 U! B8 L' k6 R
...8 J. m/ V; ^0 o9 ]
transport_url = rabbit://openstack:openstack123@dbs.flex.net+ a5 J, n4 S7 u7 [& S
○ In the [DEFAULT] and [keystone_authtoken] sections, configure Identity service access:. x! K4 R" T- t+ ?/ B
[DEFAULT]
) r) Z* ~- a. t: X
: h5 H$ N7 J# ?1 B...
# t# }+ Z3 d3 ~6 \( Uauth_strategy = keystone( b* y' N% ]& \; E
% c+ y2 q' S3 [2 z& t2 M4 q
[keystone_authtoken]1 R- m( l1 V' J; [
# ...5 p. v( a. {9 h# |
www_authenticate_uri = http://stack.flex.net:5000. Z& l2 \1 j" f v: `" N; Y' U
auth_url = http://stack.flex.net:5000* k) G n, a: D# {* m4 E
memcached_servers = controller:11211
7 W) C& k ?. j/ f: Z6 eauth_type = password- H8 q9 d' C/ K: R' V2 U/ |
project_domain_name = default, E' c: R/ @$ h" @
user_domain_name = default5 F" e7 F% I& V' V/ m; M
project_name = service
0 q% K4 k; D# f7 y" f8 w* y, fusername = neutron+ b; P2 I- x1 @4 \0 q
password = neutron123
i* \$ ?: _4 k! K h x% X5 w注意:注释或移除在[keystone_authtoken]区域中其它选项./ y+ W8 j- A1 o, V0 c' ^7 g
○ In the [DEFAULT] and [nova] sections, configure Networking to notify Compute of network topology changes:6 J) l# n# w6 u8 g; d# J" q7 v) b
[DEFAULT]' ]/ s% N- K4 z6 ^& `& Y$ W, S# J
9 @5 U- I5 n. P. R, m
...
R' R4 ]7 l/ r4 H4 l# h9 n4 ~3 }" }notify_nova_on_port_status_changes = true/ f8 y3 N; i: [
notify_nova_on_port_data_changes = true
: t0 W3 z* o1 z+ w3 v) Q" a1 W) [# M6 Z
[nova]# R2 D1 V+ T! j2 O
# ...
8 W7 [# P" m3 Q/ X/ }( s; o5 eauth_url = http://stack.flex.net:5000& v8 \- `! @! ~" j5 ?
auth_type = password* c$ \" w( {+ j1 B% C7 n- F
project_domain_name = default+ e0 C) u7 j( F5 q( f0 S' P/ \* c! n7 K
user_domain_name = default
X3 s: d& Z5 d# a7 Lregion_name = RegionOne$ d! ~4 u( ~7 S. J
project_name = service
; f# p. K8 v3 S% H" Eusername = nova
" Q& Q3 L" d7 F; x' b" opassword = nova123: {0 T' r1 B& A: u
○ In the [oslo_concurrency] section, configure the lock path:- z7 {& Y: H* U+ ?' [& f; b9 R6 O
[oslo_concurrency]
5 Q, _) z1 G6 Y! C& M" f( k" ~. S. T: V7 J& T. O+ \
...: _; }7 f& ^& _4 |
lock_path = /var/lib/neutron/tmp
, W+ q6 G4 j& F* K$ r3. Configure the Modular Layer 2 (ML2) plug-in0 ]; z& S9 K4 }
The ML2 plug-in uses the Linux bridge mechanism to build layer-2 (bridging and switching) virtual networking infrastructure for instances.3 x1 ]1 Y- _5 Z' c5 n3 u* C, M
Edit the /etc/neutron/plugins/ml2/ml2_conf.ini file and complete the following actions:
$ A- P2 w/ F1 g; G0 E, h○ In the [ml2] section, enable flat, VLAN, and VXLAN networks:. k0 b z8 ^+ s
[ml2]
& r$ B! D6 P0 J `5 o. h; U7 K. K) S9 n
...
1 z" O9 M$ n9 o2 r. i/ f5 qtype_drivers = flat,vlan,vxlan }4 O( w) G3 [
○ In the [ml2] section, enable VXLAN self-service networks:
* Z' w& ^( a& E. U9 m( @2 t4 O[ml2]' s4 t) M( T4 ?
( N5 k! }* B1 @7 P3 P
...
* F6 D1 |4 G# L2 }: j# R* X7 ~5 Wtenant_network_types = vxlan, [6 `5 w2 N- l
○ In the [ml2] section, enable the Linux bridge and layer-2 population mechanisms:
5 x+ U' N$ q4 m! i7 P+ B[ml2]( j$ s. E& u& I8 S: I- Y8 [
) y- V3 L5 q, {4 t. _
...
9 D& ~# {+ t" ^7 Smechanism_drivers = linuxbridge,l2population
1 e1 K7 R# x8 ?3 N) ?2 E. g8 p8 [注意:配置ML2插件后, 从type_drivers移除这个选项会导致数据库不一致并且Linux bridge只支持VXLAN overlay network.
0 @* K$ o, \; i3 H. F○ In the [ml2] section, enable the port security extension driver:$ H9 z/ r! y, `) i+ w/ z
[ml2]
. ^+ I& c% ]! j" Z9 m4 e" T) H" C z3 B. b8 I* A' j A) L" y5 R
...9 I+ D; l) e: P3 S ^; X# ~7 S
extension_drivers = port_security
O/ N2 T7 ]# t U$ f+ V○ In the [ml2_type_flat] section, configure the provider virtual network as a flat network:
) ^; K0 S5 S0 v8 o( B8 e5 p- p[ml2_type_flat]
& d" H! K4 r% d3 F7 Q& V$ Y( T! q ^
9 e2 w2 H8 i: _6 ?- Q. a$ e! p$ l# N...
% ]2 a3 B: ?8 v" Z9 e9 kflat_networks = provider+ q; X, q# p3 o+ z7 ]& p4 Z
○ In the [ml2_type_vxlan] section, configure the VXLAN network identifier range for self-service networks:, A6 p" c j- m* ?; e
[ml2_type_vxlan]% f* i1 u q' P4 F7 R
4 L; z- k% ]- r5 c3 v' k...; I% r/ b) D- j1 W# o& v
vni_ranges = 1:10005 g$ K0 O6 q T" S0 ]
○ In the [securitygroup] section, enable ipset to increase efficiency of security group rules:5 w" x5 U7 q' V% u5 ^9 H
[securitygroup]0 o7 Q' j! C9 ^5 r$ |$ L
( }3 i E5 s, h! T! W0 }1 `' m
...9 u4 W1 f( @+ d8 y6 j
enable_ipset = true* ?0 z# ?/ r8 c% j1 f y* z" g
4. Configure the Linux bridge agent
+ ^% D* X0 n0 sThe Linux bridge agent builds layer-2 (bridging and switching) virtual networking infrastructure for instances and handles security groups.
, x* Y( h5 |2 P2 x V- T2 bEdit the /etc/neutron/plugins/ml2/linuxbridge_agent.ini file and complete the following actions:0 H3 d5 _1 H2 c5 O- l# A
○ In the [linux_bridge] section, map the provider virtual network to the provider physical network interface:& }7 n6 }7 h! g. H
[linux_bridge]
5 P$ D6 v; w6 Y: Jphysical_interface_mappings = provider:external:eth1
2 p) A2 I- o3 ~ I( r' W( ]
7 k+ s o0 B; }& R& C$ m5 D3 VReplace PROVIDER_INTERFACE_NAME with the name of the underlying provider physical network interface.$ ]0 X V }8 }5 {0 V, L
○ In the [vxlan] section, enable VXLAN overlay networks, configure the IP address of the physical network interface that handles overlay networks, and enable layer-2 population:
2 h/ s) ]( H# x3 ?. V8 b- S[vxlan]
5 N3 n" z5 W6 T3 c( jenable_vxlan = true
) P- Z" n4 Z: H- olocal_ip = OVERLAY_INTERFACE_IP_ADDRESS9 k7 f" k. l& K0 g% M5 ?3 c' M
l2_population = true
' R) \5 h! j/ J: i/ S) M5 F% w2 N; ~. J# R( i: o
Replace OVERLAY_INTERFACE_IP_ADDRESS with the IP address of the underlying physical network interface that handles overlay networks. The example architecture uses the management interface to tunnel traffic to the other nodes. Therefore, replace OVERLAY_INTERFACE_IP_ADDRESS with the management IP address of the controller node. See Host networking for more information.# K# @* Z8 E- R0 F) }' B3 X4 t7 L
○ In the [securitygroup] section, enable security groups and configure the Linux bridge iptables firewall driver:
; M+ j$ h% k& r- `( p[securitygroup]
6 h' H- v: c0 v/ V' n4 H0 L2 E! G9 Q- i0 k1 Q P
...
: O) Z3 o; @9 \9 Xenable_security_group = true0 X( D l$ l% c! {& L
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver2 w1 \: U$ _! s0 r+ U& q
○ Ensure your Linux operating system kernel supports network bridge filters by verifying all the following sysctl values are set to 1:
8 s# q/ I& Y1 W$ ]) h0 inet.bridge.bridge-nf-call-iptables! F3 {- w7 u6 P7 |: t
net.bridge.bridge-nf-call-ip6tables/ t6 ^) s( k: h8 C
3 ?+ E1 }% ]) G( xTo enable networking bridge support, typically the br_netfilter kernel module needs to be loaded. Check your operating system’s documentation for additional details on enabling this module./ d5 i/ c4 b: B' d, A8 Q
5. Configure the layer-3 agent
1 V3 F2 p) ~0 O% yThe Layer-3 (L3) agent provides routing and NAT services for self-service virtual networks.3 k, A) O+ Z: [+ \( j
Edit the /etc/neutron/l3_agent.ini file and complete the following actions:
7 R. N- O; T* _$ F- ?7 \○ In the [DEFAULT] section, configure the Linux bridge interface driver and external network bridge:( M. E6 R { p9 r
[DEFAULT]. E; {: h4 N! N0 p" q8 a" W. @# [
# |) `+ M% N2 D* [2 y1 |, a...
, b& K8 w# z8 m$ S' l! Ninterface_driver = linuxbridge
) M: t+ P, e( y: j6. Configure the DHCP agent/ r( l4 u1 X m" g( |2 |2 W7 ^/ R8 o
The DHCP agent provides DHCP services for virtual networks.
7 R' [: O: v! R3 {Edit the /etc/neutron/dhcp_agent.ini file and complete the following actions:7 G* ?4 E: u3 p8 C2 W9 j$ a
○ In the [DEFAULT] section, configure the Linux bridge interface driver, Dnsmasq DHCP driver, and enable isolated metadata so instances on provider networks can access metadata over the network:
" j$ ~" n) X, R, s* \[DEFAULT]
! K r% G/ _0 A, c& x; t- S
) {6 G. I! J1 ~# Y...8 s7 L* E: \& a
interface_driver = linuxbridge
2 a, m. y* J& h4 ?2 x0 Rdhcp_driver = neutron.agent.linux.dhcp.Dnsmasq9 g* M0 t2 q" i c5 C n/ \ ~
enable_isolated_metadata = true
+ a# G& z7 a5 ?完成后返回网络配置
3 w, U/ c q3 c' b. u0 X2 n$ q! z" U3 y
4 y. N6 _" j9 e/ S m* y2 ]9 ^4 ^$ A |
|