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
oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/
List Archives: https://lists.ovirt.org/archives/list/devel@ovirt.org/message/ZPB676EUPWZWE3N2YX7WCCMCJ7FUMN4R/