Re: [libvirt-users] virsh can't support VM offline blockcommit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Kashyap Chamarthy:
thank you very much for answer my question:

一: lead to VM filesystem becoming read-only
1: test case
it  lead to VM filesystem becoming read-only test case as follows:

we want to snapshot for VM , to obtain VM incremental data,and use virsh blockcommit,qemu-img commit,qemu-img rebase  to shorten snapshot chain.
Details are as  follows(when VM  running state, we perform the following operations):

(1)  the host machine control VM test
virsh snapshot-create-as mix snap1 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap1-mix.img --disk-only --atomic --quiesce
virsh snapshot-create-as mix snap2 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap2-mix.img --disk-only --atomic --quiesce
virsh snapshot-create-as mix snap3 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap3-mix.img --disk-only --atomic --quiesce
virsh snapshot-create-as mix snap4 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap4-mix.img --disk-only --atomic --quiesce
virsh blockcommit mix vda --base /tmp/mul/loop-mix-commit-rebase/snap1-mix.img --top /tmp/mul/loop-mix-commit-rebase/snap2-mix.img --wait --verbose
qemu-img commit -f qcow2 /tmp/mul/loop-mix-commit-rebase/snap1-mix.img
qemu-img rebase -f qcow2 /tmp/mul/loop-mix-commit-rebase/snap3-mix.img -b /tmp/mul/loop-mix-commit-rebase/mix.img -F qcow2 -p

virsh snapshot-delete mix snap1 --metadata
rm -fr /tmp/mul/loop-mix-commit-rebase/snap1-mix.img
virsh snapshot-delete mix snap2 --metadata
rm -fr /tmp/mul/loop-mix-commit-rebase/snap2-mix.img
virsh snapshot-create-as mix snap5 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap5-mix.img --disk-only --atomic --quiesce
virsh snapshot-create-as mix snap6 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap6-mix.img --disk-only --atomic --quiesce
virsh snapshot-create-as mix snap7 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap7-mix.img --disk-only --atomic --quiesce
virsh snapshot-create-as mix snap8 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap8-mix.img --disk-only --atomic --quiesce
virsh blockcommit mix vda --base /tmp/mul/loop-mix-commit-rebase/snap3-mix.img --top /tmp/mul/loop-mix-commit-rebase/snap6-mix.img --wait --verbose
qemu-img commit -f qcow2 /tmp/mul/loop-mix-commit-rebase/snap3-mix.img
qemu-img rebase -f qcow2 /tmp/mul/loop-mix-commit-rebase/snap7-mix.img -b /tmp/mul/loop-mix-commit-rebase/mix.img -F qcow2 -p

virsh snapshot-delete mix snap3 --metadata
rm -fr /tmp/mul/loop-mix-commit-rebase/snap3-mix.img
virsh snapshot-delete mix snap4 --metadata
rm -fr /tmp/mul/loop-mix-commit-rebase/snap4-mix.img
virsh snapshot-delete mix snap5 --metadata
rm -fr /tmp/mul/loop-mix-commit-rebase/snap5-mix.img
virsh snapshot-delete mix snap6 --metadata
rm -fr /tmp/mul/loop-mix-commit-rebase/snap6-mix.img
virsh snapshot-create-as mix snap9 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap9-mix.img --disk-only --atomic --quiesce
virsh snapshot-create-as mix snap10 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap10-mix.img --disk-only --atomic --quiesce
virsh snapshot-create-as mix snap11 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap11-mix.img --disk-only --atomic --quiesce
virsh snapshot-create-as mix snap12 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap12-mix.img --disk-only --atomic --quiesce
virsh blockcommit mix vda --base /tmp/mul/loop-mix-commit-rebase/snap7-mix.img --top /tmp/mul/loop-mix-commit-rebase/snap10-mix.img --wait --verbose
qemu-img commit -f qcow2 /tmp/mul/loop-mix-commit-rebase/snap7-mix.img
qemu-img rebase -f qcow2 /tmp/mul/loop-mix-commit-rebase/snap11-mix.img -b /tmp/mul/loop-mix-commit-rebase/mix.img -F qcow2 -p

virsh snapshot-delete mix snap7 --metadata
rm -fr /tmp/mul/loop-mix-commit-rebase/snap7-mix.img
virsh snapshot-delete mix snap8 --metadata
rm -fr /tmp/mul/loop-mix-commit-rebase/snap8-mix.img
virsh snapshot-delete mix snap9 --metadata
rm -fr /tmp/mul/loop-mix-commit-rebase/snap9-mix.img
virsh snapshot-delete mix snap10 --metadata
rm -fr /tmp/mul/loop-mix-commit-rebase/snap10-mix.img
virsh snapshot-create-as mix snap13 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap13-mix.img --disk-only --atomic --quiesce
virsh snapshot-create-as mix snap14 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap14-mix.img --disk-only --atomic --quiesce
virsh snapshot-create-as mix snap15 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap15-mix.img --disk-only --atomic --quiesce
virsh snapshot-create-as mix snap16 --diskspec vda,file=/tmp/mul/loop-mix-commit-rebase/snap16-mix.img --disk-only --atomic --quiesce
virsh blockcommit mix vda --base /tmp/mul/loop-mix-commit-rebase/snap11-mix.img --top /tmp/mul/loop-mix-commit-rebase/snap14-mix.img --wait --verbose
qemu-img commit -f qcow2 /tmp/mul/loop-mix-commit-rebase/snap11-mix.img
qemu-img rebase -f qcow2 /tmp/mul/loop-mix-commit-rebase/snap15-mix.img -b /tmp/mul/loop-mix-commit-rebase/mix.img -F qcow2 -p

virsh snapshot-delete mix snap11 --metadata
rm -fr /tmp/mul/loop-mix-commit-rebase/snap11-mix.img
virsh snapshot-delete mix snap12 --metadata
rm -fr /tmp/mul/loop-mix-commit-rebase/snap12-mix.img
virsh snapshot-delete mix snap13 --metadata
rm -fr /tmp/mul/loop-mix-commit-rebase/snap13-mix.img
virsh snapshot-delete mix snap14 --metadata
rm -fr /tmp/mul/loop-mix-commit-rebase/snap14-mix.img
。。。。。。。。。。。。。。。。。。。。。。。。。。。。(the cycle test continue)

(2)  the VM  test
in the VM,  loop write data and  delete data operations。

2: test result
when the test run for a while(8 hour or 10 hour or 20 hour or 30 hour  and so on), the VM filesystem becoming read-only!
3: We are not sure the problem
      (1)when VM running, whether it can be used to modify snapshot's backingfile by qemu-img rebase(can only be used in vm offline?)
       (2)when VM running,whether it can be used to commit the snapshot's changes by qemu-img commit(can only be used in vm offline?)
       

二: Run normal(ok) test
1: test case
      in order to eliminate potential problems,we only use virsh blockcommit shorten snapshot chain.
(1)  the host machine control VM test

virsh snapshot-create-as length snap1 --diskspec vda,file=/tmp/testsnapshot/image/snap1-length.img --disk-only --atomic --quiesce
virsh snapshot-create-as length snap2 --diskspec vda,file=/tmp/testsnapshot/image/snap2-length.img --disk-only --atomic --quiesce
virsh snapshot-create-as length snap3 --diskspec vda,file=/tmp/testsnapshot/image/snap3-length.img --disk-only --atomic --quiesce
virsh snapshot-create-as length snap4 --diskspec vda,file=/tmp/testsnapshot/image/snap4-length.img --disk-only --atomic --quiesce
virsh blockcommit length vda --base /tmp/testsnapshot/image/length.img --top /tmp/testsnapshot/image/snap3-length.img --wait --verbose
virsh snapshot-delete length snap1 --metadata
rm -fr /tmp/testsnapshot/image/snap1-length.img
virsh snapshot-delete length snap2 --metadata
rm -fr /tmp/testsnapshot/image/snap2-length.img
virsh snapshot-delete length snap3 --metadata
rm -fr /tmp/testsnapshot/image/snap3-length.img
virsh snapshot-create-as length snap5 --diskspec vda,file=/tmp/testsnapshot/image/snap5-length.img --disk-only --atomic --quiesce
virsh snapshot-create-as length snap6 --diskspec vda,file=/tmp/testsnapshot/image/snap6-length.img --disk-only --atomic --quiesce
virsh snapshot-create-as length snap7 --diskspec vda,file=/tmp/testsnapshot/image/snap7-length.img --disk-only --atomic --quiesce
virsh snapshot-create-as length snap8 --diskspec vda,file=/tmp/testsnapshot/image/snap8-length.img --disk-only --atomic --quiesce
virsh blockcommit length vda --base /tmp/testsnapshot/image/length.img --top /tmp/testsnapshot/image/snap7-length.img --wait --verbose
virsh snapshot-delete length snap4 --metadata
rm -fr /tmp/testsnapshot/image/snap4-length.img
virsh snapshot-delete length snap5 --metadata
rm -fr /tmp/testsnapshot/image/snap5-length.img
virsh snapshot-delete length snap6 --metadata
rm -fr /tmp/testsnapshot/image/snap6-length.img
virsh snapshot-delete length snap7 --metadata
rm -fr /tmp/testsnapshot/image/snap7-length.img
virsh snapshot-create-as length snap9 --diskspec vda,file=/tmp/testsnapshot/image/snap9-length.img --disk-only --atomic --quiesce
virsh snapshot-create-as length snap10 --diskspec vda,file=/tmp/testsnapshot/image/snap10-length.img --disk-only --atomic --quiesce
virsh snapshot-create-as length snap11 --diskspec vda,file=/tmp/testsnapshot/image/snap11-length.img --disk-only --atomic --quiesce
virsh snapshot-create-as length snap12 --diskspec vda,file=/tmp/testsnapshot/image/snap12-length.img --disk-only --atomic --quiesce
virsh blockcommit length vda --base /tmp/testsnapshot/image/length.img --top /tmp/testsnapshot/image/snap11-length.img --wait --verbose
virsh snapshot-delete length snap8 --metadata
rm -fr /tmp/testsnapshot/image/snap8-length.img
virsh snapshot-delete length snap9 --metadata
rm -fr /tmp/testsnapshot/image/snap9-length.img
virsh snapshot-delete length snap10 --metadata
rm -fr /tmp/testsnapshot/image/snap10-length.img
virsh snapshot-delete length snap11 --metadata
rm -fr /tmp/testsnapshot/image/snap11-length.img
virsh snapshot-create-as length snap13 --diskspec vda,file=/tmp/testsnapshot/image/snap13-length.img --disk-only --atomic --quiesce
virsh snapshot-create-as length snap14 --diskspec vda,file=/tmp/testsnapshot/image/snap14-length.img --disk-only --atomic --quiesce
virsh snapshot-create-as length snap15 --diskspec vda,file=/tmp/testsnapshot/image/snap15-length.img --disk-only --atomic --quiesce
virsh snapshot-create-as length snap16 --diskspec vda,file=/tmp/testsnapshot/image/snap16-length.img --disk-only --atomic --quiesce
virsh blockcommit length vda --base /tmp/testsnapshot/image/length.img --top /tmp/testsnapshot/image/snap15-length.img --wait --verbose
virsh snapshot-delete length snap12 --metadata
rm -fr /tmp/testsnapshot/image/snap12-length.img
virsh snapshot-delete length snap13 --metadata
rm -fr /tmp/testsnapshot/image/snap13-length.img
virsh snapshot-delete length snap14 --metadata
rm -fr /tmp/testsnapshot/image/snap14-length.img
virsh snapshot-delete length snap15 --metadata
rm -fr /tmp/testsnapshot/image/snap15-length.im

 (2)  the VM  test
in the VM,  loop write data and  delete data operations。

2: test result
the test run 200 hours, the test ok!!

Waiting for your reply, thank you very much!




justlibvirt@xxxxxxxxx
 
From: Kashyap Chamarthy
Date: 2015-10-13 21:55
To: justlibvirt@xxxxxxxxx
CC: libvir-list; libvirt-users; eblake
Subject: Re: [libvirt-users] virsh can't support VM offline blockcommit
On Tue, Oct 13, 2015 at 10:39:58AM +0800, justlibvirt@xxxxxxxxx wrote:
> Hi  everyone!
 
Hi,
 
Firstly, please don't post the same message multiple times in a row.  If
someone hasn't responded, they're either busy, or haven't noticed this
message.
 
>      I use the libvirt(version: 1.2.2) and QEMU(version: 2.2.1) to
>      test qemu snapshot features:
>    
>      I tried virsh blockcommit when VM offline,  the virsh blockcommit
>      failed: the error messase as below: error: Requested operation is
>      not valid: domain is not running when I start the VM,  the virsh
>      blockcommit  work fine!  my question is:we need virsh support
>      blockcommit when VM offline。how do?
 
As near as I know, 'blockcommit' hasn't yet gotten offline support.
 
>     we  test qemu snapshot as follows: we need  create  snapshot of
>     the cycle,and  by virsh blockcommit merge snapshot chain,but
>     when VM offline, the virsh blockcommit will fail, someone
>     suggest me:when VM offline,may use qemu-img commit to submit
>     snapshot turn,but qemu-img can't modify snapshot chain backing
>     relation,it need we use qemu-img  rebase amend snapshot‘s
>     backingfile,
 
As you note there's the 'qemu-img commit' primitive that allows you to
commit the changes in an overlay back into its base image:
 
If you have:  base.qcow2 <-- overlay1.qcow2 <-- overlay2.qcow2
 
And, if you do:
 
    $ qemu-img commit overlay2.qcow2
 
It'll commit the contents of overlay2.qcow2 into overlay1.qcow2.
 
And, indeed use the 'qemu-img rebase' to modify the backing file is the
only method I know of, for offline operations.
 
>     the main question is when we use qemu-img rebase
>     modify snapshot's backingfile, if someone start the VM, it  will
>     may lead to VM filesystem readonly。
 
Though I haven't tested this recently, why would it lead to VM
filesystem becoming read-only? 
 
>    we  should how to  solve the question?   thanks!  >
 
--
/kashyap
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]