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