
Hi, A VM Snapshot can be made using SnapshotBuilder builder = new SnapshotBuilder().vm(VM).name("Snap1").description("Test"); sysService.vmsService().vmService(VM.id()).snapshotsService().add().snapshot(builder).send(); It can be made with no memory by using a builder with persistMemorystate(false) How can one be made with no disk? .diskAttachments(emptyList) isnt working. TIA

On Thu, Dec 5, 2019 at 1:07 PM <scott.fitzgerald@oracle.com> wrote:
Hi,
A VM Snapshot can be made using
SnapshotBuilder builder = new SnapshotBuilder().vm(VM).name("Snap1").description("Test");
sysService.vmsService().vmService(VM.id()).snapshotsService().add().snapshot(builder).send();
It can be made with no memory by using a builder with persistMemorystate(false)
How can one be made with no disk? .diskAttachments(emptyList) isnt working.
Do you mean a VM that has disks attached but you would like to take a snapshot of the VM configuration only (i.e. without the disks)?
TIA
_______________________________________________ Devel mailing list -- devel@ovirt.org To unsubscribe send an email to devel-leave@ovirt.org Privacy Statement: https://www.ovirt.org/site/privacy-policy/ oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/devel@ovirt.org/message/CVFPOW7RMQ4OCX...

Yes, essentially. It can be done in the UI through a checkbox, cannot find the relevant code.

On Thu, Dec 5, 2019 at 1:22 PM <scott.fitzgerald@oracle.com> wrote:
Yes, essentially. It can be done in the UI through a checkbox, cannot find the relevant code.
Daniel, this is basically single disk snapshot without a single disk :) How do you run an API call to do so?
_______________________________________________ Devel mailing list -- devel@ovirt.org To unsubscribe send an email to devel-leave@ovirt.org Privacy Statement: https://www.ovirt.org/site/privacy-policy/ oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/devel@ovirt.org/message/2A7XFA2UAR5YT5...

re this, for anyone trying to figure it out: Various combinations of null and empty lists for the DiskAttachments and Disk fields in the snapshot builder still resulted in all VM Disks being included. Having revisited this today, and after some experimentation, I got this workaround to behave as expected: List<DiskAttachment> attachments = new ArrayList<>(); attachments.add(new DiskAttachmentBuilder().build()); SnapshotBuilder builder = new SnapshotBuilder().vm(vm).name("Snap").description("Test").diskAttachments(attachments).disks((Disk) null).persistMemorystate(false); By adding the dummy attachment to the list, the resulting snapshot will have no disks. I imagine this circumvents some check like if(chosenAttachments.size == 0 || chosenAttachments == null){ chosenAttachments.addAll(vm.diskAttachments); } Slightly hacky, but functional. Possibly an RFE worth looking at?

On Thu, Feb 13, 2020 at 5:50 PM <scott.fitzgerald@oracle.com> wrote:
re this, for anyone trying to figure it out:
Various combinations of null and empty lists for the DiskAttachments and Disk fields in the snapshot builder still resulted in all VM Disks being included. Having revisited this today, and after some experimentation, I got this workaround to behave as expected:
List<DiskAttachment> attachments = new ArrayList<>(); attachments.add(new DiskAttachmentBuilder().build()); SnapshotBuilder builder = new SnapshotBuilder().vm(vm).name("Snap").description("Test").diskAttachments(attachments).disks((Disk) null).persistMemorystate(false);
By adding the dummy attachment to the list, the resulting snapshot will have no disks. I imagine this circumvents some check like
if(chosenAttachments.size == 0 || chosenAttachments == null){ chosenAttachments.addAll(vm.diskAttachments); }
Slightly hacky, but functional. Possibly an RFE worth looking at?
What is the use case for snapshot without disks? What does this snapshot mean? How do you use it? Nir
participants (3)
-
Nir Soffer
-
scott.fitzgerald@oracle.com
-
Tal Nisan