ok, I see, thank you very much for your kindly reply, the answer is very clear and useful for me. Thanks a lot!

2012/5/29 Eric Blake <eblake@redhat.com>
On 05/29/2012 03:40 AM, Rujie Xu wrote:
> Hello everyone,
>     I am trying to find a way to store an internal disk snapshot and
> supposed to restore later.
>
>     Here is the problems I met:
>     1) when I use SnapshotCreateXML() to create a disk_only snapshot while
> the domain is inactive, there is an error happened:
>      disk snapshot of inactive domains not implemented yet.
>      I am wondering is there and way I can save the disk_only snapshot when
> the domain is inactive right now?

That code still has to be written.  It's on my todo list.

https://bugzilla.redhat.com/show_bug.cgi?id=817226

That said, if you _don't_ use the disk_only flag and the domain is
offline, then the end result right now is that you get internal
snapshots for free (since a system checkpoint of an offline domain _is_
the disk snapshot, and since system checkpoint currently uses internal
snapshots only).

>
>      2) also use snapshotCreateXML() to create a disk_only snapshot while
> the domain is active, and use the xml to set the <disk name="hda"
> snapshot="internal"> there is also an error happened:
>      unsupported configuration: active qemu domains require external disk
> snapshot; disk hda requested internal

Correct.  Qemu does not support the creation of internal disk snapshots
except by the 'savevm' command which takes a system checkpoint snapshot
(that is, unless qemu gives us a way to do disk-only internal snapshots
of a running VM, you are stuck on this front).

>
>      3) when I use snapshotCreateXML() to create a disk_only snapshot using
> external file, it could be done, but when I try to use revertToSnapshot()
> to revert this snapshot there is another error happened:
>       revert to external snapshot not supported yet.

Correct, that's another API that I haven't yet coded; and you're the
second person to ask about it this week:
https://www.redhat.com/archives/libvirt-users/2012-May/msg00122.html

>
> Is there anyone can help me about this, or we just can't use libvirt to
> managed the disk snapshot right now?

Help in contributing code would be very welcome.

--
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org




--
Regards,
Roger Xu