
Not too familiar with this, but maybe this example will help[1] [1] https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/pin_vm.py On Mon, Mar 8, 2021 at 3:41 PM Lavi Buchnik via Devel <devel@ovirt.org> wrote:
Hi Shani,
Thanks for your reply. I’m aware for how to set it in the UI.
Note that because the VM is defined with Affinity label, I must first remove the affinity label from the VM and only than to choose a different host as you specified below (via the UI).
But my question is for how to set a different host using Python SDK API.
I tried/plan this via Python SDK API:
- Stop the VM.
- Remove its Affinity label.
- Update its host to the target host.
- Start the VM.
But the result is that the VM is always keep starting on its current host.
For updating the VM host, I used few ways as:
vm_service.update( types.Vm( host=types.Host( id=host_id ), ) )
Or:
vm_service.update( types.Vm( host=types.Host( name=host_name ), ) )
Then started the VM using:
vm_service.start()
or using:
vm_service.start( vm=types.Vm( host=types.Host( name=host_name ), ) )
vm_service.start( vm=types.Vm( host=types.Host( id=host_id ), ) )
I get no errors, but VM keeps starting on the current host and not on the new target host.
BTW - in case it would start on the target host, the plan is to add affinity label back just after.
Thanks,
Lavi Buchnik
*From:* Shani Leviim <sleviim@redhat.com> *Sent:* Monday, March 08, 2021 2:36 PM *To:* Lavi Buchnik <Lavi.Buchnik@exlibrisgroup.com> *Cc:* devel <devel@ovirt.org> *Subject:* Re: [ovirt-devel] Re: Starting a defined VM on a different host
*CAUTION: *EXTERNAL Email.
Hi,
You can set this one from the UI:
VM > Edit > Show advanced options (bottom left button) > host > Start running on > specific host
*Regards,*
*Shani Leviim*
On Mon, Mar 8, 2021 at 10:33 AM Lavi.Buchnik--- via Devel <devel@ovirt.org> wrote:
Hi,
Can anyone help here?
Thanks, 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 <https://urldefense.com/v3/__https:/www.ovirt.org/privacy-policy.html__;!!NkSChLMW7qAT!oXo9NzJpksnp57RWmELqGqJO2uxOMPVtcOrXvjqi3jw_Wsx1O7hcPG7oUJoHY3TW-2oazAUO$> oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ <https://urldefense.com/v3/__https:/www.ovirt.org/community/about/community-guidelines/__;!!NkSChLMW7qAT!oXo9NzJpksnp57RWmELqGqJO2uxOMPVtcOrXvjqi3jw_Wsx1O7hcPG7oUJoHY3TW-7jzCg5C$> List Archives: https://lists.ovirt.org/archives/list/devel@ovirt.org/message/ZPB676EUPWZWE3... <https://urldefense.com/v3/__https:/lists.ovirt.org/archives/list/devel@ovirt.org/message/ZPB676EUPWZWE3N2YX7WCCMCJ7FUMN4R/__;!!NkSChLMW7qAT!oXo9NzJpksnp57RWmELqGqJO2uxOMPVtcOrXvjqi3jw_Wsx1O7hcPG7oUJoHY3TW-w_4vllb$>
_______________________________________________ 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/S4DZTJCLKILITX...