<div>Dear Eric,</div><div><div>Yes, I have two <disk> devices, and I want to take a snapshot with one disk, which the format is qcow2. </div><div>And I want to skip the other disk during the creation which the format is raw.</div>
<div>I will take your suggestions.</div><div>Thanks for your detailed explanations and advices.</div></div><div>I will also try the higher version of libvirt and qemu</div><div>Thank you!</div><div><br></div><div><br></div>
On Thu, Mar 28, 2013 at 7:54 PM, Eric Blake <span dir="ltr"><<a href="mailto:eblake@redhat.com" target="_blank">eblake@redhat.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 03/28/2013 03:46 AM, Hubert Chiang wrote:<br>
> Hello,<br>
><br>
> I want to do a snapshot which the VM has volumes.<br>
><br>
> But I want to skip the volume check when I do the snapshot. (Which means I<br>
> want to do a snapshot without detaching the volume)<br>
<br>
</div>If I understand you, you have a VM with two <disk> devices, but you only<br>
need a snapshot of the contents of one of those disks, so you want to<br>
skip the other one during snapshot creation.</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"> </div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
><br>
> So I try to write a snapshot XML refer by<br>
> <a href="http://libvirt.org/formatsnapshot.html" target="_blank">http://libvirt.org/formatsnapshot.html</a> as following:<br>
><br>
> vda is my VM basic disk (qcow2)<br>
> vdb is a volume (raw)<br>
> ================ t1.xml ===============<br>
> <domainsnapshot><br>
> <disks><br>
> <disk name='vda' snapshot='internal'><br>
> <source file='/var/lib/libvirt/VM1/disk' /><br>
> </disk><br>
<br>
</div>Mixing snapshot='internal' and <disk> was not possible until libvirt<br>
1.0.1; furthermore, use of snapshot='internal' requires that ALL of your<br>
<disk>s are qcow2, based on limitations still present in qemu 1.4.  What<br>
you are asking for is not possible with the current tools, although we<br>
might be able to support it in future releases. </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> <disk name='vdb' snapshot='no' /><br>
> </disks><br>
> </domainsnapshot><br>
> =====================================<br>
><br>
> with this command: # virsh snapshot-create VM1 --xmlfile t1.xml<br>
><br>
> and get the message: # error: argument unsupported: unable to handle disk<br>
> requests in snapshot<br>
><br>
> My environment is Libvirt 0.9.8, Qemu 1.0.0 on Ubuntu12.04.02<br>
<br>
</div>Correct - the version of libvirt that you are using is too old to mix<br>
<disks> with internal snapshots.  To use <disk name='vdb'<br>
snapshot='no'/> with your version of libvirt, you _have_ to pass the<br>
--disk-only flag and take an external snapshot, but then you are no<br>
longer able to capture the VM memory state (which was not possible until<br>
libvirt 1.0.1).<br>
<div class="im"><br>
><br>
> I try to do this action before at libvirt 0.9.2 QEMU 0.14.1 on Ubuntu 11.10<br>
> before with following commands, It's success.<br>
<br>
</div>No, what was really happening with libvirt 0.9.2 is that the <disks><br>
element of your snapshot was completely ignored.  <disks> support wasn't<br>
added until 0.9.5.  You were taking an internal snapshot of ALL disks,<br>
whether you realized it or not, because that old of libvirt didn't know<br>
to use <disks>.<br>
<div class="im"><br>
><br>
> Step1. I copy the XML from /etc/libvirt/qemu/VM1.xml to VM1.xml.backup<br>
<br>
</div>Dangerous.  Copying files straight from /etc/libvirt is NOT guaranteed<br>
to be reliable; instead, you should use 'virsh dumpxml $dom' if you want<br>
to back up a domain's XML.<br>
<div class="im"><br>
> Step2. I edit the VM1.xml to remove the disk tag which is create by volume<br>
<br>
</div>I'm not sure I follow.  It would help if you showed a before-and-after<br>
of the .xml file that you are editing, and a bit more explanation of<br>
what you hoped to accomplish with your edit.<br>
<div class="im"><br>
> Step3. do virsh command: virsh snapshot-create VM1<br>
> Step4. Move VM1.xml.backup to VM1.xml<br>
<br>
</div>Even more dangerous.  While it is possible to copy files out of /etc<br>
without too much risk (the worst that can happen is that you copied<br>
inconsistent state), writing files _into_ /etc goes behind libvirt's<br>
back and is liable to break things.<br>
<div class="im"><br>
><br>
> It's success on libvirt 0.9.2. But on 0.9.8 It doesn't work. Because<br>
> libvirt will check the setups from memory not the XML file in<br>
> /etc/libvirt/qemu/<br>
><br>
> What could I do with libvirt 0.9.8?<br>
<br>
</div>I'm not sure what you are really wanting to do.  Do you want an internal<br>
snapshot (requires qcow2, but the snapshot lives in the same file as the<br>
original) or an external snapshot (which creates a second qcow2 around<br>
your original file which is now frozen in time)?  Do you want this while<br>
your domain is running or offline?  Are you willing to upgrade to new<br>
enough libvirt and qemu to get things properly supported (at least<br>
libvirt 1.0.1 and qemu 1.2 or better)?<br>
<br>
It sounds like maybe you have a situation where your disk for vdb is not<br>
qcow2, so you can't do an internal snapshot while it is attached.  If<br>
that is the case, then the only supported way of doing an internal<br>
snapshot of a running domain, while using your current versions of<br>
libvirt and qemu, is to use 'virsh suspend VM1' to suspend the domain,<br>
'virsh detach-disk ...' to hot-unplug the vdb disk, 'virsh<br>
snapshot-create ...' to create your snapshot, 'virsh attach-disk ...' to<br>
hot-plug the vdb disk back in, then 'virsh resume VM1' to resume things.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Eric Blake   eblake redhat com    <a href="tel:%2B1-919-301-3266" value="+19193013266">+1-919-301-3266</a><br>
Libvirt virtualization library <a href="http://libvirt.org" target="_blank">http://libvirt.org</a><br>
<br>
</font></span></blockquote></div><br>