Thank you all. will try it out!

On Mon, Jan 11, 2021 at 12:40 PM Benny Zlotnik <bzlotnik@redhat.com> wrote:
you probably need to wrap the parameter with []:
`affinity_labels=[types.AffinityLabel(id=label_id)]`, because
affinity_labels expects a list

On Mon, Jan 11, 2021 at 12:34 PM Steven Rosenberg <srosenbe@redhat.com> wrote:
>
> 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
>>
>>
>>
> _______________________________________________
> Devel mailing list -- devel@ovirt.org
> To unsubscribe send an email to devel-leave@ovirt.org
> Privacy Statement: https://www.ovirt.org/privacy-policy.html
> oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/
> List Archives: https://lists.ovirt.org/archives/list/devel@ovirt.org/message/P3DZFJ6KBPUYQ5JF2XSWPVZES7QQJFRQ/