[libvirt] Ability to add arbitrary data to snapshots

Hello! Currently our Virtuozzo company is working on some kind of management tool for libvirt. We encountered some problems with snapshots while development. So I would like to ask community a few questions: 1) Would you mind if I extend current libvirt snapshot with ability to add arbitrary data (blob or some config files)? 2) Would this feature be useful for your users? I see it as something like: virsh snapshot-create VM1 --blob /path/to/some-file virsh snapshot-revert VM1 <number> and /path/to/some-file appeared again. Looking forward for your comments and help. Thanks! -- Regards, Alexander Burluka

On Sat, Jan 23, 2016 at 03:17:43PM +0300, Alexander Burluka wrote:
Hello!
Currently our Virtuozzo company is working on some kind of management tool for libvirt. We encountered some problems with snapshots while development. So I would like to ask community a few questions: 1) Would you mind if I extend current libvirt snapshot with ability to add arbitrary data (blob or some config files)? 2) Would this feature be useful for your users?
I see it as something like: virsh snapshot-create VM1 --blob /path/to/some-file virsh snapshot-revert VM1 <number> and /path/to/some-file appeared again.
You don't really explain what you would want libvirt to do with this data ? Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

Just save this data near main snapshot data (e.g. in /var/lib/libvirt/qemu/snapshot/<domain-name>/<snapshot-hash>) and restore it on previous or specified path. On 01/25/2016 11:46 AM, Daniel P. Berrange wrote:
On Sat, Jan 23, 2016 at 03:17:43PM +0300, Alexander Burluka wrote:
Hello!
Currently our Virtuozzo company is working on some kind of management tool for libvirt. We encountered some problems with snapshots while development. So I would like to ask community a few questions: 1) Would you mind if I extend current libvirt snapshot with ability to add arbitrary data (blob or some config files)? 2) Would this feature be useful for your users?
I see it as something like: virsh snapshot-create VM1 --blob /path/to/some-file virsh snapshot-revert VM1 <number> and /path/to/some-file appeared again. You don't really explain what you would want libvirt to do with this data ?
Regards, Daniel
-- Regards, Alexander Burluka

On Mon, Jan 25, 2016 at 11:54:55AM +0300, Alexander Burluka wrote:
Just save this data near main snapshot data (e.g. in /var/lib/libvirt/qemu/snapshot/<domain-name>/<snapshot-hash>) and restore it on previous or specified path.
What sort of data is this - we already have ability to record arbitrary metadata in the XML, so it is not particularly attractive to add extra hacks to the snapshot XML for dealing with extra config data, when it could be just pplaced in the metadata block. In general I think everything we deal with should be part of the XML config of the guest, so I don't much like the suggestion to extend the snapshot APis to pass through arbitrary opaque blobs.
On 01/25/2016 11:46 AM, Daniel P. Berrange wrote:
On Sat, Jan 23, 2016 at 03:17:43PM +0300, Alexander Burluka wrote:
Hello!
Currently our Virtuozzo company is working on some kind of management tool for libvirt. We encountered some problems with snapshots while development. So I would like to ask community a few questions: 1) Would you mind if I extend current libvirt snapshot with ability to add arbitrary data (blob or some config files)? 2) Would this feature be useful for your users?
I see it as something like: virsh snapshot-create VM1 --blob /path/to/some-file virsh snapshot-revert VM1 <number> and /path/to/some-file appeared again. You don't really explain what you would want libvirt to do with this data ?
Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

For example, we want to store suspended state of VM. I'm aware that some other careless application dealing with libvirt may erase metadata section and info about additional snapshot data will be lost. On 01/25/2016 02:38 PM, Daniel P. Berrange wrote:
Just save this data near main snapshot data (e.g. in /var/lib/libvirt/qemu/snapshot/<domain-name>/<snapshot-hash>) and restore it on previous or specified path. What sort of data is this - we already have ability to record arbitrary metadata in the XML, so it is not particularly attractive to add extra hacks to the snapshot XML for dealing with extra config data, when it could be just pplaced in the
On Mon, Jan 25, 2016 at 11:54:55AM +0300, Alexander Burluka wrote: metadata block. In general I think everything we deal with should be part of the XML config of the guest, so I don't much like the suggestion to extend the snapshot APis to pass through arbitrary opaque blobs.
On 01/25/2016 11:46 AM, Daniel P. Berrange wrote:
On Sat, Jan 23, 2016 at 03:17:43PM +0300, Alexander Burluka wrote:
Hello!
Currently our Virtuozzo company is working on some kind of management tool for libvirt. We encountered some problems with snapshots while development. So I would like to ask community a few questions: 1) Would you mind if I extend current libvirt snapshot with ability to add arbitrary data (blob or some config files)? 2) Would this feature be useful for your users?
I see it as something like: virsh snapshot-create VM1 --blob /path/to/some-file virsh snapshot-revert VM1 <number> and /path/to/some-file appeared again. You don't really explain what you would want libvirt to do with this data ? Regards, Daniel
-- Regards, Alexander Burluka

On Mon, Jan 25, 2016 at 02:55:30PM +0300, Alexander Burluka wrote:
For example, we want to store suspended state of VM. I'm aware that some other careless application dealing with libvirt may erase metadata section and info about additional snapshot data will be lost.
What do you mean by suspended state of the VM ? Are you referring to the VM memory & device state ? If so, I think that something that should be explicitly represented in the API, not a opaque blob. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

For example, we want to store suspended state of VM. I'm aware that some other careless application dealing with libvirt may erase metadata section and info about additional snapshot data will be lost. What do you mean by suspended state of the VM ? Are you referring to
On Mon, Jan 25, 2016 at 02:55:30PM +0300, Alexander Burluka wrote: the VM memory & device state ? If so, I think that something that should be explicitly represented in the API, not a opaque blob. We distinguish paused and suspended to disk domain states. For suspend to disk we are using virDomainSaveFlags API call and stop domain. This API call stores VM memory and device states to some file. If user
On 01/25/2016 04:16 PM, Daniel P. Berrange wrote: then calls virDomainSnapshotCreateXML, the resulted snapshot lacks VM memory and device states because it looks like domain is stopped and it is not aware about state file. Thus, switch to this snapshot does not work as expected. We need to store this file somewhere, so what API change could be done here? Or maybe we can emulate suspend to disk in other way? Please advice. Thank you!
Regards, Daniel
-- Regards, Alexander Burluka

On Tue, Jan 26, 2016 at 12:59:00 +0300, Alexander Burluka wrote:
On 01/25/2016 04:16 PM, Daniel P. Berrange wrote:
For example, we want to store suspended state of VM. I'm aware that some other careless application dealing with libvirt may erase metadata section and info about additional snapshot data will be lost. What do you mean by suspended state of the VM ? Are you referring to
On Mon, Jan 25, 2016 at 02:55:30PM +0300, Alexander Burluka wrote: the VM memory & device state ? If so, I think that something that should be explicitly represented in the API, not a opaque blob. We distinguish paused and suspended to disk domain states. For suspend to disk we are using virDomainSaveFlags API call and stop domain.
So you are saving the domain to a file which is out of libvirt's control and your management app (I guess) tracks the file for each domain.
This API call stores VM memory and device states to some file. If user then calls virDomainSnapshotCreateXML, the resulted snapshot lacks VM memory and device states because it looks like domain is stopped and it is not aware about state file. Thus, switch to this snapshot does not work as expected.
It is the responsibility of your management app to associate the state files with snapshots and to properly restore them when switching between snapshots. I don't think libvirt should behave as a general purpose database for management apps. The situation would be quite different if you used virDomainManagedSave to save its state. In this case, it's libvirt's responsibility to be aware of a saved state when creating/reverting snapshots. And currently libvirt doesn't handle this correctly. Jirka
participants (3)
-
Alexander Burluka
-
Daniel P. Berrange
-
Jiri Denemark