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