Hello everyone, I am a newcomer.
I am learning OpenStack and kvm,but now I met a difficult problem:
I have a qcow2 image A,
a qcow2 delta image B whose backing file is A,
and a qcow2 image C whose backing file is B.
Now I want to merge the B and C into a qcow2 image D whose backing file is A.
I have tried to use qemu-img to solve it, but still didn't get positive solutions.
I hope you can help me, really appreciate.
With the vm in question currently running use a virsh blockpull.
virsh blockpull --domain vmname --path /var/lib/libvirt/images/c.qcow2
this assumes vmname is the vm using c.qcow2 which is backed by b.qcow2 which is backed by a.qcow2.
If you'd like a file other than c.qcow2 to be the final new complete backless file, then use the vm and create a d.qcow2 first and name it in the virsh command. This will leave a,b,c intact and pull a+b+c into d.
And yes, the domain is to be up and running while you do it.
cp C D
qemu-img rebase -b A D
This creates a copy of C
called D
and then rebases D
on A
.