Hi,
We are considering the following use-case of libvirt’s domain snapshot (and revert) feature:
- Domain is qemu
- Snapshot type is disk-only (VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY)
- Snapshot location is internal (VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL)
- 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)
- VM can be either active or inactive
We want to extend libvirt to support this use-case.
Consider the following changes:
- 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. - 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