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

楼主 |
发表于 2022-10-20 14:12:56
|
显示全部楼层
0# W7 k8 X( E" t7 Y9 l. }* R3 F
j4 H7 Q* m F
6 k, Y9 c& T( a, [0 P' q* u" o8 K P' _
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:# |. C8 ^6 p2 }% z7 T# M
" u/ g2 L- b5 Q; u+ M& n
Image c1d9.... is unacceptable: Unable to rebuild with a different image for a volume-backed server5 \+ J1 n! L$ K1 @ q& m
1 Q3 Q7 o) c; {! @& W# v. J
How can I rebuild volume-backend server?' ^9 W' S6 l9 G0 F5 ^$ r; Q& A
+ i7 ~' S& d5 |* l$ }( Nopenstackopenstack-nova, v/ Q8 s* a9 B7 a" f/ V
Share3 N# G; B; n6 n1 D1 [+ x6 g& B
Improve this question. E1 [' D, n: I6 b6 G, l
Follow
0 n8 O8 |+ A' \asked May 18, 2021 at 11:34- p. z! L9 o& F8 v% `
Bani's user avatar- R+ x! q$ s+ z5 \/ w2 H& j
Bani" F0 ^$ o/ r6 H# t
1966 bronze badges
, k2 G) `! p, f) bAdd a comment1 T' T7 ~% H- A" V* `
1 Answer* v- I% n6 L) {+ {6 b3 z6 m# z
Sorted by:
& ]; z3 ?( B: r# }
* L; m9 [6 Z; m/ P: U8 t) i4 YHighest score (default), W( u/ `8 M" W# m
7 h1 y2 j) J$ f1 G* K$ S
0: I, @; B( O* \
5 K- N$ {% x8 q
0 t6 p) X" i- q0 l) s: J. ZAs noted in Openstack docs [1], rebuild is not supported for volume-based VMs.
5 B. m* C( |% u2 z
& h% U9 j. X& qAssuming 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.
: f( r5 U# Z+ O
3 I# X. l& l3 s% D4 oFor Ceph based backend, it would be something like
& c% ~2 x4 e) G* t# m0 _0 b6 g
- ~" L6 {& O0 vopenstack volume show <...> => Get pool/path from rbd backend& W! Q# X [- A# F7 }" S
openstack image show <...> => Get pool/path from rbd backend; h( |- v; m, y* Y
openstack server stop <VM> => Stop the VM
. f# [* S) X9 X1 Z* k
5 [7 \5 g/ ^9 Q Erbd -p <POOL NAME> mv <VM VOLUME UUID> <VM VOLUME UUID>.old9 a% G5 t c' Y7 S
rbd -p <POOL NAME> cp <IMAGE VOLUME UUID> <VM VOLUME UUID> * G, I/ U4 M% f$ v
Once the copy finishes, start the VM
) _) y% @" n( A' K/ h" u. t( E7 h$ o+ X$ l) _; u
openstack server start <VM> |
|