<div dir="ltr"><div><div><div><div><div>Hi,<br><br></div>It is working fine.<br></div>But I want to disable migration policy. It didn't solve my purpose.<br><br></div>What else I have to do to disable migration ?<br><br></div>Thanks,<br></div>~Rohit<br><div><div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 19, 2017 at 1:36 PM, TranceWorldLogic . <span dir="ltr"><<a href="mailto:tranceworldlogic@gmail.com" target="_blank">tranceworldlogic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thanks will try and let you know,<br></div>~Rohit<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 19, 2017 at 1:18 PM, Juan Hernández <span dir="ltr"><<a href="mailto:jhernand@redhat.com" target="_blank">jhernand@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_-506429838290100346HOEnZb"><div class="m_-506429838290100346h5">On 04/19/2017 09:34 AM, Juan Hernández wrote:<br>
> On 04/19/2017 08:41 AM, TranceWorldLogic . wrote:<br>
>> Hi,<br>
>><br>
>> I was trying to create VM on specific HOST using python sdk as shown below.<br>
>><br>
>> ------ Code -------------------<br>
>> vm = vms_service.add( ....<br>
>> host = types.Host(<br>
>> name = "host-01",<br>
>> ),<br>
>> )<br>
>> ------ End Code -------------------<br>
>><br>
>> It created VM successfully, but when I see in ovirt GUI I saw that VM is<br>
>> not bonded with specific host.<br>
>><br>
>> Ovirt GUI:<br>
>> Virtual Machines -> click on VM -> "Edit" button -> In advance menu -><br>
>> "Host" tab<br>
>> Start Running On:<br>
>> o Any Host in Cluster <== This option got selected<br>
>> o Specific Host(s) <== *I want this option to select.*<br>
>><br>
>> Please help me to bind VM to specific Host via Python SDK<br>
>><br>
><br>
> The Vm.host attribute is used only to indicate in what host is the VM<br>
> currently running.<br>
><br>
> To pin the VM to a set of hosts you have to use Vm.placement_policy, as<br>
> described here:<br>
><br>
><br>
> <a href="http://ovirt.github.io/ovirt-engine-api-model/4.1/#types/vm/attributes/placement_policy" rel="noreferrer" target="_blank">http://ovirt.github.io/ovirt-e<wbr>ngine-api-model/4.1/#types/vm/<wbr>attributes/placement_policy</a><br>
><br>
> With the Python SDK it should be something like this:<br>
><br>
> vm = vms_service.add(<br>
> vm=types.Vm(<br>
> ...<br>
> placement_policy=types.Placem<wbr>entPolicy(<br>
> hosts=[<br>
> types.Host(name='host-01')<br>
> ]<br>
> )<br>
> )<br>
> )<br>
><br>
<br>
</div></div>Sorry, the name of the type is incorrect, should be<br>
'types.VmPlacementPolicy'. So the complete example should be like this:<br>
<span><br>
vm = vms_service.add(<br>
vm=types.Vm(<br>
...<br>
</span> placement_policy=types.VmPlace<wbr>mentPolicy(<br>
<div class="m_-506429838290100346HOEnZb"><div class="m_-506429838290100346h5"> hosts=[<br>
types.Host(name='host-01')<br>
]<br>
)<br>
)<br>
)<br>
<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>