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? 
_______________________________________________
Devel mailing list -- devel@ovirt.org
To unsubscribe send an email to devel-le...@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/2NPU4DNJQAJLTYKE5CAEN3KHBNTGADOL/

Reply via email to