Hi, everyone,
   I have found the API snapshotCreateXML() can create a snapshot for a virtual machine, and the xml configuration file - snapshot.xml as folllows:
<domainsnapshot>
  <name>snapshot01</name>
  <description>Snapshot of OS install and updates</description>
  <disks>
     <disk name='vda' snapshot='external'>
     <source file='/data10/snapshot'/>
     </disk>
     </disks>
</domainsnapshot>

How can I use the API or could I use "snapshot-create" ?
I try "virsh snapshot-create domain_name snapshot.xml", but I report an error: error: unsupported configuration: disk 'vda' must use snapshot mode 'internal'.
What's the probem? I feel crazy now.
Could someone give me a sucessfule example?




At 2013-06-25 16:46:32,"cmcc.dylan" <dx10years@126.com> wrote:
Thanks for you reply!
    Firstly, I'm very sorry I forgot introduce the scenarios in my experiments. Supposing a case, I have a virtual machine with two disks. One is mounted as a root partition and the other is data partition and the second disk is an iscsi lun, that is to say, not a local disk or image. Now the result wanted is that creating a snapshot for the root disk but not for the data disk when executing "virsh snapshot-create-as" command. Actually, it meet an error:
      error:unsuported configuration: source for disk 'vdc' is not a regular file; refusing to generate external snapshot name.
    The xml configuration of this virtual machine as follows:
         <disk type='block' device='disk'>
              <driver name='qemu' type='raw' />
             <source dev='/dev/sdm1' >                 // sdm1 is a remote scsi lun and mounted at the local host
              <target dev='vdc' bus='virtio' />
         </disk>
     Given above problem, I want to only create the snapshot of local disk.



ÔÚ 2013-06-24 23:22:47£¬"vonNieda, Adam (USMS)" <Adam.vonNieda@usdoj.gov> дµÀ£º

 

   I think what you¡¯re looking for is LVM snapshots. The whole purpose of taking VM snapshots is to have a consistent image of the machine as a whole. There¡¯s lots of articles out there on LVM snapshots, here¡¯s one.

 

   http://www.tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html

 

From: libvirt-users-bounces@redhat.com [mailto:libvirt-users-bounces@redhat.com] On Behalf Of cmcc.dylan
Sent: Saturday, June 22, 2013 11:13 AM
To: libvirt-users@redhat.com
Subject: [libvirt-users] snapshot-create-as for a single disk not all disks

 

Hi everyone!

   Is there any way to create snaphot for a single disk of a virtual machine. As I konw, "virsh snapshot-create-as domain_name  snapshot_name --disk-only" traverses all block devices to create snapshot. However I don't want to create snapshot except for root partition.

  The version of qemu and libvirt I used is as follows:

                qemu-1.4.2 and libvrit-0.10.2

  I meet an error when I delete the snapshot which is created by "snapshot-create-as" command. whether or not qemu(1.4.2) and libvirt(0.10.2) don't support the function currently.

 

   Look forward to your help!