Dear Lavi,

I am ccing others who may have a better idea than me. In the meantime if you could provide the engine and vdsm logs, we may be able to ascertain what is actually failing.

Thank you for your enquiry.

With Best Regards.

Steven.

On Sun, Jan 10, 2021 at 6:19 PM Lavi Bochnik <lavi.bochnik@gmail.com> wrote:
Hi,

I came across your page in github: https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk/examples

I wonder if its possible to define Affinity label to a new VM while adding the VM.
I tried this:
vm = vms_service.add(
  types.Vm(
........
  affinity_labels=types.AffinityLabel(id=label_id)
)

But I'm getting this error:
TypeError: 'AffinityLabel' object is not iterable

** I'm taking the label_id from the list of Affinity labels beforehands.

I saw your example of assigning the label to VM. but this is good for when the VM is already up and running.

Can you please advise how to assign an affinity label at the time of adding/creating a new VM?

Thanks in advance,
Lavi