|
|
|
创建cinder并设置权限 [root@controller ceph]# ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children,allow rwx pool=volumes,allow rwx pool=vms'设置密钥 [root@controller ceph]# ceph auth get-or-create client.cinder | tee /etc/ceph/ceph.client.cinder.keyring
" }0 |' I) h; |/ s( P6 s$ f8 R
' a0 W6 M0 B( M" a2 \+ _! w#传送密钥到computer/ [1 n3 J$ t7 \% B6 t
0 y: I0 y, N8 p6 z! j
[root@controller ~]# ceph auth get-key client.cinder > client.cinder.key
1 ? D, C7 P' s) ^3 U; ?
! h4 p" |+ k f* A6 p& v$ K* B( Y[root@controller ~]# scp client.cinder.key computer:/root/! w ?; O% h# I$ d" P: \
, ]7 ]' {) Z6 h" `" c8 q6 h( m
#修改权限; V7 O1 h# P" X3 K5 Z
1 Z' ?# O6 ~3 i[root@controller ceph]# chown cinder.cinder /etc/ceph/ceph.client.cinder.keyring
0 ^- b2 @. U; |' p; I6 j) a0 f设置密钥 #computer生成uuid
* ~" `$ F; i7 Z. E) `" Q3 W. j4 a1 w, \
[root@computer ~]#uuidgen
- J7 g; y2 O" y# H) p: k, {5 n9 G- Y% \5 Q
1fad1f90-63fb-4c15-bfc3-366c6559c1fe #创建密钥文件: W2 y( M5 l1 s
- N% K4 M' ^4 J7 ^: A[root@computer ~]# vi secret.xml
, G" Z2 p+ f0 \$ X- u 1fad1f90-63fb-4c15-bfc3-366c6559c1fe client.cinder secret
& \( B0 E( L$ N" W7 I2 k* b g* M- t1 ~3 Q2 C8 D5 f" q
2 p+ m# e2 d5 k: {3 I
#定义密钥
0 a0 Z7 Q9 E6 }virsh secret-define --file secret.xml {1 d2 w1 V. R+ K% d: A
6 a, [: R9 s/ ^0 J5 ?! C/ G$ c8 \
, ?. |8 _5 S. a5 ^8 }#设置密钥
- n8 P# I9 c" H- E7 n0 M- o2 v5 f+ ?0 Z& w! z
' z! L! P* o! ?: I$ ~: r& q
virsh secret-set-value --secret 1fad1f90-63fb-4c15-bfc3-366c6559c1fe --base64 $(cat client.cinder.key) && rm -rf client.cinder.key secret.xml
1 N/ x& u. a. D4 A- b- O
) U, R2 g) p6 n
j6 z8 V! U/ e7 K# c设置对接cinder模块, Z4 Q1 K W) A$ U
修改配置文件 [root@controller ~]# vi /etc/cinder/cinder.conf1 ^ @0 ?; T! R. Q9 |) T
& M$ _2 A. S F7 ?# @
[default]! t* X* e2 l$ `5 S
7 b7 {' K7 F7 \- }7 W: P6 nrpc_backend = rabbit4 N5 P( N& M7 Y/ K! H
1 I7 K3 f! r% `, ~$ H
auth_strategy = keystone
9 F( ^, r8 z: m/ V) u# w: G7 \3 h; S% S: g3 G
my_ip = 192.168.8.651 V8 w. X" c9 I; p
, }7 e! W- e8 I; s" [2 henabled_backends = ceph-1
& v1 Z- v- a% R8 v- s7 v4 e* z/ |
! `2 z8 q# p- y% d+ A[ceph-1]
3 @3 ?" {+ n- ]! _
: D, [3 {/ |- V \- G4 T9 j5 h6 S$ Ldefault_volume_type= ceph-18 V* S. z2 G$ e# R
( L" F6 h' J! x6 I; m: D
glance_api_version = 2 - N. f- Q; f6 V0 ], b
4 b4 v8 F7 f. f: x! s7 {+ o2 Qvolume_driver = cinder.volume.drivers.rbd.RBDDriver- _1 n$ e" N" {# ^+ [9 o
6 }3 F$ u4 X; |7 B, r' n/ _; x4 X. dvolume_backend_name = ceph-13 T: r8 h4 p: R
, z& w4 f7 w& s, K! R, ]rbd_pool = volumes9 y" c) |- W8 j, s" |8 C. Z G+ p
4 j8 x6 X* L; C. u
rbd_ceph_conf = /etc/ceph/ceph.conf
8 U( ^/ n+ A, t W' z1 x8 ^& @$ d) l7 l' I+ Y
rbd_flatten_volume_from_snapshot = false
4 J Y: y4 b3 t# g
; w4 a' y& f& s. A+ Erbd_max_clone_depth = 5* e# t/ U( `) J# R% L, T; a
m% Z1 \* o# L
rbd_store_chunk_size = 4
% l; H9 d- F4 @6 F3 s- G `- `* ?- k6 {9 K/ q1 J- ?
rados_connect_timeout = -14 F, B0 [/ t% M. ^" P" }8 D, U1 \
; M9 |5 v- r. R1 u
rbd_user = cinder
F6 t1 G! \: X' Z6 C* A
& E. H& W1 d& a( [9 t#对应computer创建的uuid. M. P( B; q9 H. J9 k' H
F+ z4 ^* C' x$ z8 H: t1 x
rbd_secret_uuid = 1fad1f90-63fb-4c15-bfc3-366c6559c1fe
" l* q" A6 j) H. B同步数据库 #若已经有数据库,对数据库进行删除并重新创建和同步# I8 Q, s- r% C2 V8 R1 B& u$ N4 g
; p9 K/ A, D1 S' e U& v) T
[root@controller ~]# su -s /bin/sh -c "cinder-manage db sync" cinder( z% a1 `" h" e E
重启服务 [root@controller ~]# systemctl restart openstack-cinder-api.service openstack-cinder-scheduler.service openstack-cinder-volume.service设置ceph的类型和存储类型 [root@controller ~]# source admin-openrc
6 [8 l( ?4 T( H+ m( T6 i3 e+ b9 l& ?5 |1 }
[root@controller ~]# cinder type-create ceph-1# {- E' I% H# E+ E" C
% r4 [+ ?4 _; m5 J, T4 Y
[root@controller ~]# cinder type-key ceph set volume_backend_name=ceph-1
9 @4 X8 G: F' S& e) A; [' ^: {
. C: Q& `. p( V; C对接nova-compute模块3 m% H# K; q" m4 j" s6 s
computer结点修改配置文件 [root@computer ~]# vi /etc.nova/nova.conf
- v1 P# o% N1 d0 Y. h
, e6 X! z7 }/ ?% v) ]8 n0 E[libvirt]
/ u1 q5 e8 b- R$ Y: W" o8 P/ c
( p) e: K% y# f. P8 i) a) N. uvirt_type = qemu
; P) l" b, V; a3 a7 e5 l {, N& |& M+ `7 G) I0 C
inject_password = true3 R' F0 ^) L `9 T; m
: {7 x+ o4 c7 H z' z; L2 [% p! E
inject_partition = -1) {6 m/ E/ e2 V" i
2 i8 v0 ^# |- E5 u5 L: l
images_type = rbd& i3 c$ o; e/ W; y9 ]/ j% j( I
" ^/ K M' t+ ~5 y( Oimages_rbd_pool = vms- w6 |5 B; G- U V5 l8 }* l; m$ P
# A& k" v, x* \" E' K+ B$ J$ Fimages_rbd_ceph_conf = /etc/ceph/ceph.conf
. d \* P; T, R# v9 v3 v- B4 p# X0 C; h; X/ X, d7 k# G
rbd_user = cinder
& D( k3 W- x' [4 B8 f$ d1 M% u: h/ @! [: g5 q
rbd_secret_uuid = 1fad1f90-63fb-4c15-bfc3-366c6559c1fe, G9 S/ d/ i; b; k2 D _, T
" T6 @! Q9 U: [$ b$ Gdisk_cachemodes = "network=writeback"
- [- v4 ]6 f. B' @
' p9 P; D( R- M: q) wlive_migration_flag = "VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST,VIR_MIGRATE_TUNNELLED"/ E9 H6 B8 p7 j+ G2 a
/ i' c' o) F% A4 p0 }hw_disk_discard = unmap
+ q: B* a6 B0 I) A0 h* l: h% A. B8 }2 Q: [, o1 d/ J
[root@computer ~]# vi /etc/ceph/ceph.conf , L q: C7 q7 b
6 w' W) t% m* g[client]
& b, {: I, H4 f `) o8 \
1 ], ^3 r/ M+ d5 Lrbd cache=true& p& `& o) k5 G4 x2 T- V( g% O$ ^
w! t: I3 w# E( u
rbd cache writethrough until flush=true" h1 Y/ ^8 b* s8 F3 `, V4 z
" X: M% E& k2 s/ W6 a1 H/ ?2 W) {
admin socket = /var/run/ceph/guests/$cluster-$type.$id.$pid.$cctid.asok9 m7 ^0 P% ~4 C, e5 Y, T
+ Z! N6 ~' G" z; ^5 N6 X! O7 hlog file = /var/log/qemu/qemu-guest-$pid.log* u4 T+ Q a- u) k- A7 J6 l: y9 w8 s
/ i C3 W/ g' r, f6 }rbd concurrent management ops = 20
; G7 U* y% G8 i2 l9 l. m8 c2 e, G创建日志目录 [root@computer ~]# mkdir -p /var/run/ceph/guests/ /var/log/qemu/- g' A1 V, l/ U% v- F
4 K4 h7 `0 U4 O3 R[root@computer ~]# chown 777 -R /var/run/ceph/guests/ /var/log/qemu/
4 D9 q, g7 _& |# } ^; P5 }controller下发密钥 [root@controller ~]# cd /etc/ceph
: [4 A3 b3 z# i# H5 ?! f0 {+ d
* o# G$ D. r9 B. ]* V5 c2 d[root@controller ~]# scp ceph.client.cinder.keyring root@compute01:/etc/ceph# P" V' m' T8 ?8 T6 Q
重启服务 [root@computer ~]# systemctl stop libvirtd openstack-nova-compute. B+ Y- ]/ l) E# u# ~) l
( |- u2 U* }4 `- Y[root@computer ~]# systemctl start libvirtd openstack-nova-compute5 a8 b# x+ |1 I9 `
7 T+ F" R. ?* X" x! Y8 m# J
: |% Y1 `& |/ P* P% W& ]
|
|