Internal disk-only snapshots in qemu domain

Or Ozeri ORO at il.ibm.com
Thu Sep 8 10:06:57 UTC 2022


Hi,

We are considering the following use-case of libvirt's domain snapshot (and revert) feature:

  1.  Domain is qemu
  2.  Snapshot type is disk-only (VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY)
  3.  Snapshot location is internal (VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL)
  4.  All of the VM disks are:
     *   Network type (VIR_STORAGE_TYPE_NETWORK)
     *   RBD protocol (VIR_STORAGE_NET_PROTOCOL_RBD)
     *   Raw format (VIR_STORAGE_FILE_RAW)
  5.  VM can be either active or inactive

We want to extend libvirt to support this use-case.

Consider the following changes:

  1.  For the inactive VM case, libvirt currently calls "qemu-img snapshot" for taking a snapshot, as well as reverting (adding "-a" to qemu-img).
The same would also work for our-use case, as basically the same qemu-img command would work for RBD disks as well (using rbd:poolname/imagename as the filename).
So basically we need to reuse code from qemuDomainSnapshotForEachQcow2Raw.
  2.  For the active VM case, we can re-use code from qemuDomainSnapshotCreateActiveExternal, but call qemu's  "snapshot_blkdev_internal" instead of the current "snapshot_blkdev".
This would work for RBD disks, but more generally for any qemu block driver which implements "bdrv_snapshot_create".

BTW it seems to me that if you try to take an internal snapshot of just the disks, you will actually get an external snapshot? Or is there some place in the code which validates and fails this case?

Anyhow, I would really appreciate any feedback or thoughts.

Thanks,
Or
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20220908/c3841c54/attachment-0001.htm>


More information about the libvir-list mailing list