- 积分
- 16844
在线时间 小时
最后登录1970-1-1
|

楼主 |
发表于 2022-10-20 14:12:56
|
显示全部楼层
0
' h, U) J+ Q' t# D# b& v- i: e5 w& H: V. G3 ?' M8 ~1 _
7 [7 J# I- n% p+ ]7 O
I create a volume then I use it to create server. I would like to rebuild this server such that its image is changed. When I call nova rebuild api with a new image, it is said:
5 |$ a. ]; U- N7 K- s0 R* R3 K2 H; ^7 |
Image c1d9.... is unacceptable: Unable to rebuild with a different image for a volume-backed server* ^4 ^. [# I' u+ `+ {6 D5 @
. w6 k: X. t/ r3 ]' R
How can I rebuild volume-backend server?
; P z3 M) |' l' l3 H$ N3 A/ F9 r T- d% R1 v
openstackopenstack-nova$ z3 G. Q5 V% M& U; x* l
Share& ^6 p5 `, E6 p9 e! h/ t {* r
Improve this question
R6 U3 z2 d9 qFollow i3 ^( l' G8 N: }8 u
asked May 18, 2021 at 11:348 P1 ]8 Q" A& @- ~; l9 Y/ l
Bani's user avatar
& v; t5 C2 Y+ z2 y( O! E; BBani
; ] Z s3 f/ |. o: R9 P+ {1966 bronze badges7 B7 f1 k0 N5 i& F. _; ~
Add a comment3 E W1 e" Y% M
1 Answer# j. S+ D6 C4 n1 L( O& Y! [
Sorted by:
7 h" G( F {9 V# O
( W, A; J$ q8 N3 oHighest score (default)
# e* ^( K2 p2 @' o0 m* `! Q- J8 s6 w) z! Q# A/ e
0& v( e+ F/ D; b* ?3 l
9 a& N: z# H& p/ ~9 ]2 G
% T" R1 p6 |# R: qAs noted in Openstack docs [1], rebuild is not supported for volume-based VMs.
, ?9 W: h; L- l
4 Q1 u! j: q9 h k' HAssuming you are trying to rebuild the VM with a fresh image ("factory reset"), a slightly "hacky" solution is to replace the underlying volume with the fresh image while keeping the same pool/path.- B- {0 K* B) ~: e4 y) S6 j+ Z
j3 {" g: k# W, r$ K, A- y0 t
For Ceph based backend, it would be something like
! [6 z0 h; [- e2 a& x, m( Z! M! T# Z! V' s P* W
openstack volume show <...> => Get pool/path from rbd backend
& V7 _( g3 P8 M* j) vopenstack image show <...> => Get pool/path from rbd backend$ K' n4 F: M ]7 l0 ?+ p
openstack server stop <VM> => Stop the VM- o0 z, `+ f. s: ^5 `
- @/ `$ F& Q( b; Drbd -p <POOL NAME> mv <VM VOLUME UUID> <VM VOLUME UUID>.old
9 d5 `9 S) H/ a; }& urbd -p <POOL NAME> cp <IMAGE VOLUME UUID> <VM VOLUME UUID> & s! X& w1 I0 C! F4 [
Once the copy finishes, start the VM
, B7 p: |; U- m! I; M
( O$ K. E7 h7 a" q0 |3 c8 T a; W& yopenstack server start <VM> |
|