qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Guannan Ren <gren@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: libvir-list@redhat.com, Jeff Cody <jcody@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [libvirt] [PATCH] snapshot: fix rollback failure in transaction mode
Date: Thu, 13 Sep 2012 11:16:20 +0800	[thread overview]
Message-ID: <50515004.5010801@redhat.com> (raw)
In-Reply-To: <5050CAB8.6040702@redhat.com>

On 09/13/2012 01:47 AM, Eric Blake wrote:
> On 09/12/2012 09:22 AM, Guannan Ren wrote:
>> After failure of qemu transaction command, the snapshot file still
>> be there with non-zero in size. In order to unlink the file, the
>> patch removes the file size checking.
> Can you give some exact steps to reproduce this, so that I know who is
> making the file have non-zero size?  I'm worried that unlinking a
> non-empty file is discarding data, so the commit message needs a lot
> more details about how we are proving that the only way the file can be
> non-zero size is because qemu happened to put data into a previously
> empty file prior to the failed 'transaction' attempt.

      qemu left non-empty file.
      Steps:
      1, Create a qemu instance with two drive images of qcow2 type 
(root user)
           /usr/libexec/qemu-kvm -m 1024 -smp 1 -name "rhel6u1" \
            -drive 
file=/var/lib/libvirt/images/firstqcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none 

            -device 
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 
\
            -drive 
file=/var/lib/libvirt/images/secondqcow2,if=none,id=drive-virtio-disk1,format=qcow2,cache=none 
\
            -device 
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk1,id=virtio-disk1 
-qmp stdio

      2, Initialize qemu qmp
          {"execute":"qmp_capabilities"}

      3, Remove the second drive image file
          rm -f /var/lib/libvirt/images/secondqcow2

      4, Run 'transaction' command with snapshot qemu commands in.
          {"execute":"transaction","arguments":
            {"actions":
[{"type":"blockdev-snapshot-sync","data":{"device":"drive-virtio-disk0","snapshot-file":"/var/lib/libvirt/images/firstqcow2-snapshot.img","format":"qcow2"}},
{"type":"blockdev-snapshot-sync","data":{"device":"drive-virtio-disk1","snapshot-file":"/var/lib/libvirt/images/secondqcow2-snapshot.img","format":"qcow2"}}]
            },
          "id":"libvirt-6"}

      5,  Got the error as follows:
          {"id": "libvirt-6", "error": {"class": "OpenFileFailed", 
"desc": "Could not open 
'/var/lib/libvirt/images/secondqcow2-snapshot.img'",
                                   "data": {"filename": 
"/var/lib/libvirt/images/secondqcow2-snapshot.img"}}}

      6, List first newly-created snapshot file:
          -rw-r--r--. 1 root root     262144 Sep 13 11:43 
firstqcow2-snapshot.img

>
> That is, after re-reading context code just now, I'm fairly confident
> that this code can only be reached when qemu supports the 'transaction'
> monitor command, and libvirt's --reuse-ext flag was not specified, and
> therefore libvirt must have just created the file.  But I want that in
> the commit message rather than having to re-read the code every time I
> visit this commit in future reads of the git log.


         That's ok,  I will add this information into commit log in v2.



> It may also be that
> qemu has a bug in that the 'transaction' command is modifying files even
> when it fails, so even while this works around the bug, I'm cc'ing Jeff
> to see if qemu also needs a bug fix.

      parent reply	other threads:[~2012-09-13  3:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1347463350-28760-1-git-send-email-gren@redhat.com>
2012-09-12 17:47 ` [Qemu-devel] [libvirt] [PATCH] snapshot: fix rollback failure in transaction mode Eric Blake
2012-09-12 18:33   ` Jeff Cody
2012-09-12 20:23     ` Eric Blake
2012-09-13  3:16   ` Guannan Ren [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50515004.5010801@redhat.com \
    --to=gren@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jcody@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).