You could something like this (IIUC):
    dead_snap1_params = types.Snapshot(
        description=SNAPSHOT_DESC_1,
        persist_memorystate=False,
        disk_attachments=[
            types.DiskAttachment(
                disk=types.Disk(
                    id=disk.id
                )
            )
        ]
    )

Taken from ovirt-system-tests[1]

[1] - https://github.com/oVirt/ovirt-system-tests/blob/master/basic-suite-master/test-scenarios/004_basic_sanity.py#L340

On Thu, Jun 21, 2018 at 2:57 PM Gianluca Cecchi <gianluca.cecchi@gmail.com> wrote:
Hello,
I'm trying to see how to create a snapshot of a VM, but only of a subset of its disks (actually it will be only the bootable one)

Taking the examples at 
https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk/examples

I can accomodate something like this

# Get the reference to the service that manages the virtual machines:
vms_service = system_service.vms_service()

# Find the virtual machine and put into data_vm
vm = vms_service.list(
    search='name=%s' % MY_VM_NAME,
    all_content=True,
)[0]
    'Found virtual machine \'%s\', the id is \'%s\'.',
    vm.name, vm.id,
)

# Find the services that manage the data_vm virtual machine:
vm_service = vms_service.vm_service(vm.id)

# Send the request to create the snapshot. Note that this will return
# before the snapshot is completely created, so we will later need to
# wait till the snapshot is completely created.

snaps_service = vm_service.snapshots_service()
snap = snaps_service.add(
    snapshot=types.Snapshot(
        description=snap_description,
        persist_memorystate=False,
    ),
)

This makes a snapshot of all the dsks of the vm.

I can previously filter in my case the bootable disk with something like this:

# Locate the service that manages the disk attachments of the virtual
# machine:
disk_attachments_service = vm_service.disk_attachments_service()

# Retrieve the list of disks attachments, and print the disk details.
disk_attachments = disk_attachments_service.list()
for disk_attachment in disk_attachments:
    disk = connection.follow_link(disk_attachment.disk)
    print("name: %s" % disk.name)
    print("id: %s" % disk.id)
    print("status: %s" % disk.status)
    print("bootable: %s" % disk_attachment.bootable)
    print("provisioned_size: %s" % disk.provisioned_size)

So in case of an example VM with two disks I get this print out 

name: padnpro_bootdisk
id: c122978a-70d7-48aa-97c5-2f17d4603b1e
status: ok
bootable: True
provisioned_size: 59055800320
name: padnpro_imp_Disk1
id: 5454b137-fb2c-46a7-b345-e6d115802582
status: ok
bootable: False
provisioned_size: 10737418240


But I haven't found then the syntax to use to specify a disk list in the block where I create the sapshot of the VM

snap = snaps_service.add(
    snapshot=types.Snapshot(
        description=snap_description,
        persist_memorystate=False,
        disxk x x x ? ? ?
    ),
)

Any help in this direction?
Tahnsk,
Gianluca




_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-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/users@ovirt.org/message/X5I22JVFREERWEIMM3TXCSH6EPE47TI3/