|
|
楼主 |
发表于 2022-10-20 14:12:56
|
显示全部楼层
0
! c" s3 f3 P) g8 a
% {7 l4 k- g( [2 s, e- b5 M4 q$ N% @, b/ u% \2 X$ v
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:6 F% `7 n: P) b2 U
/ B: L: e5 F0 s' r# I# EImage c1d9.... is unacceptable: Unable to rebuild with a different image for a volume-backed server: B# ~: C' v# G1 b5 Z
/ Y1 V7 T- F- Z) M: c; ^) H- @
How can I rebuild volume-backend server?
2 d7 \6 v7 ?1 j
5 t, Y9 J7 B1 s0 ~3 T3 D7 topenstackopenstack-nova" T' w" r! w7 T
Share3 z# f) Y- F5 I
Improve this question
6 M, b+ \3 q r: s7 tFollow8 ~$ q# |" g! I; ~% K, T P6 Q
asked May 18, 2021 at 11:34% n) R7 Q, Y" a- z
Bani's user avatar/ E8 `: V4 ?4 D! F. a
Bani
% p. b% ]* r9 B9 Z7 t! Z1966 bronze badges
' s5 i7 T* w# p5 V v0 d# _Add a comment0 l8 G3 w9 H0 h ]* i
1 Answer
# J6 k" D5 _( J6 b# x8 s* aSorted by:4 q3 U. Z5 a3 L* `, w6 A+ q
% c. `1 A) `& `% F' r/ ?1 N6 X" K+ p
Highest score (default)
* A% @ |8 O1 o$ L* x( `. s+ n0 R+ {$ K4 k! R, B& v& O
0
8 n. r. P* |/ ?$ ?! m4 c R/ F7 d1 K
' y- S3 Z, `) s# R: n: Y* j1 z
As noted in Openstack docs [1], rebuild is not supported for volume-based VMs.
' m4 b7 d+ J# v0 R
; J) x" a/ M: X2 aAssuming 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.
" @* `, z5 D' K. r* j) H' D! C7 f0 K' |- L+ F. v
For Ceph based backend, it would be something like
3 G$ V) O/ `7 t" F, j/ Q
2 a/ b2 Y+ u3 ropenstack volume show <...> => Get pool/path from rbd backend7 C+ Z1 M0 w$ L4 L2 f
openstack image show <...> => Get pool/path from rbd backend
: T. `5 M5 [5 Z. y- h8 w# D! ~4 Topenstack server stop <VM> => Stop the VM2 h0 [7 s- m3 d6 O5 Q( p
3 ^" v9 h; q' [0 k
rbd -p <POOL NAME> mv <VM VOLUME UUID> <VM VOLUME UUID>.old0 W! u1 i7 X$ Q- _" _+ R, J5 V
rbd -p <POOL NAME> cp <IMAGE VOLUME UUID> <VM VOLUME UUID> 7 {1 E u. s9 [$ q& b
Once the copy finishes, start the VM
* J$ K4 F) t; i0 |4 x; E/ P) v+ v, C5 r6 M& W' C) m! j
openstack server start <VM> |
|