Re: [ovirt-users] [Python-SDK][Ovirt-4.0] Create VM on specific Host.

2017-04-19 Thread TranceWorldLogic .
Hi Juan,

It working fine. affinity and hosts have solved my problem.

Thanks,
~Rohit


On Wed, Apr 19, 2017 at 5:16 PM, Juan Hernández  wrote:

> On 04/19/2017 01:27 PM, TranceWorldLogic . wrote:
> > Hi,
> >
> > It is working fine.
> > But I want to disable migration policy. It didn't solve my purpose.
> >
> > What else I have to do to disable migration ?
> >
>
> Not sure what exactly you want to achieve. Can you elaborate a bit?
>
> If in addition to pin the VM to a host you also want to disable
> migration, you can use the Vm.placement_policy.affinity attribute:
>
>   vm = vms_service.add(
> vm=types.Vm(
>   ...
>   placement_policy=types.VmPlacementPolicy(
> hosts=[
>   types.Host(name='host-01')
> ],
> affinity=types.VmAffinity.PINNED
>   )
> )
>   )
>
> Martin, I think that you can explain better than me what are the
> meanings of the values of the VmAffinity enum, and what is it
> relationship to pinning. Would be nice to have that documented in the
> specification of the API.
>
> >
> >
> > On Wed, Apr 19, 2017 at 1:36 PM, TranceWorldLogic .
> > > wrote:
> >
> > Thanks will try and let you know,
> > ~Rohit
> >
> > On Wed, Apr 19, 2017 at 1:18 PM, Juan Hernández  > > wrote:
> >
> > On 04/19/2017 09:34 AM, Juan Hernández wrote:
> > > On 04/19/2017 08:41 AM, TranceWorldLogic . wrote:
> > >> Hi,
> > >>
> > >> I was trying to create VM on specific HOST using python sdk
> > as shown below.
> > >>
> > >> -- Code ---
> > >> vm = vms_service.add(  
> > >> host = types.Host(
> > >> name = "host-01",
> > >> ),
> > >>   )
> > >> -- End Code ---
> > >>
> > >> It created VM successfully, but when I see in ovirt GUI I saw
> > that VM is
> > >> not bonded with specific host.
> > >>
> > >> Ovirt GUI:
> > >> Virtual Machines -> click on VM -> "Edit" button -> In
> > advance menu ->
> > >> "Host" tab
> > >> Start Running On:
> > >>o  Any Host in Cluster  <== This option got selected
> > >>o  Specific Host(s)   <== *I want this option to select.*
> > >>
> > >> Please help me to bind VM to specific Host via Python SDK
> > >>
> > >
> > > The Vm.host attribute is used only to indicate in what host is
> > the VM
> > > currently running.
> > >
> > > To pin the VM to a set of hosts you have to use
> > Vm.placement_policy, as
> > > described here:
> > >
> > >
> > >
> > http://ovirt.github.io/ovirt-engine-api-model/4.1/#types/
> vm/attributes/placement_policy
> >  vm/attributes/placement_policy>
> > >
> > > With the Python SDK it should be something like this:
> > >
> > >   vm = vms_service.add(
> > > vm=types.Vm(
> > >   ...
> > >   placement_policy=types.PlacementPolicy(
> > > hosts=[
> > >   types.Host(name='host-01')
> > > ]
> > >   )
> > > )
> > >   )
> > >
> >
> > Sorry, the name of the type is incorrect, should be
> > 'types.VmPlacementPolicy'. So the complete example should be
> > like this:
> >
> >   vm = vms_service.add(
> > vm=types.Vm(
> >   ...
> >   placement_policy=types.VmPlacementPolicy(
> > hosts=[
> >   types.Host(name='host-01')
> > ]
> >   )
> > )
> >   )
> >
> >
> >
>
>
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] [Python-SDK][Ovirt-4.0] Create VM on specific Host.

2017-04-19 Thread Juan Hernández
On 04/19/2017 01:27 PM, TranceWorldLogic . wrote:
> Hi,
> 
> It is working fine.
> But I want to disable migration policy. It didn't solve my purpose.
> 
> What else I have to do to disable migration ?
> 

Not sure what exactly you want to achieve. Can you elaborate a bit?

If in addition to pin the VM to a host you also want to disable
migration, you can use the Vm.placement_policy.affinity attribute:

  vm = vms_service.add(
vm=types.Vm(
  ...
  placement_policy=types.VmPlacementPolicy(
hosts=[
  types.Host(name='host-01')
],
affinity=types.VmAffinity.PINNED
  )
)
  )

Martin, I think that you can explain better than me what are the
meanings of the values of the VmAffinity enum, and what is it
relationship to pinning. Would be nice to have that documented in the
specification of the API.

> 
> 
> On Wed, Apr 19, 2017 at 1:36 PM, TranceWorldLogic .
> > wrote:
> 
> Thanks will try and let you know,
> ~Rohit
> 
> On Wed, Apr 19, 2017 at 1:18 PM, Juan Hernández  > wrote:
> 
> On 04/19/2017 09:34 AM, Juan Hernández wrote:
> > On 04/19/2017 08:41 AM, TranceWorldLogic . wrote:
> >> Hi,
> >>
> >> I was trying to create VM on specific HOST using python sdk
> as shown below.
> >>
> >> -- Code ---
> >> vm = vms_service.add(  
> >> host = types.Host(
> >> name = "host-01",
> >> ),
> >>   )
> >> -- End Code ---
> >>
> >> It created VM successfully, but when I see in ovirt GUI I saw
> that VM is
> >> not bonded with specific host.
> >>
> >> Ovirt GUI:
> >> Virtual Machines -> click on VM -> "Edit" button -> In
> advance menu ->
> >> "Host" tab
> >> Start Running On:
> >>o  Any Host in Cluster  <== This option got selected
> >>o  Specific Host(s)   <== *I want this option to select.*
> >>
> >> Please help me to bind VM to specific Host via Python SDK
> >>
> >
> > The Vm.host attribute is used only to indicate in what host is
> the VM
> > currently running.
> >
> > To pin the VM to a set of hosts you have to use
> Vm.placement_policy, as
> > described here:
> >
> >
> >
> 
> http://ovirt.github.io/ovirt-engine-api-model/4.1/#types/vm/attributes/placement_policy
> 
> 
> >
> > With the Python SDK it should be something like this:
> >
> >   vm = vms_service.add(
> > vm=types.Vm(
> >   ...
> >   placement_policy=types.PlacementPolicy(
> > hosts=[
> >   types.Host(name='host-01')
> > ]
> >   )
> > )
> >   )
> >
> 
> Sorry, the name of the type is incorrect, should be
> 'types.VmPlacementPolicy'. So the complete example should be
> like this:
> 
>   vm = vms_service.add(
> vm=types.Vm(
>   ...
>   placement_policy=types.VmPlacementPolicy(
> hosts=[
>   types.Host(name='host-01')
> ]
>   )
> )
>   )
> 
> 
> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] [Python-SDK][Ovirt-4.0] Create VM on specific Host.

2017-04-19 Thread TranceWorldLogic .
Hi,

It is working fine.
But I want to disable migration policy. It didn't solve my purpose.

What else I have to do to disable migration ?

Thanks,
~Rohit


On Wed, Apr 19, 2017 at 1:36 PM, TranceWorldLogic . <
tranceworldlo...@gmail.com> wrote:

> Thanks will try and let you know,
> ~Rohit
>
> On Wed, Apr 19, 2017 at 1:18 PM, Juan Hernández 
> wrote:
>
>> On 04/19/2017 09:34 AM, Juan Hernández wrote:
>> > On 04/19/2017 08:41 AM, TranceWorldLogic . wrote:
>> >> Hi,
>> >>
>> >> I was trying to create VM on specific HOST using python sdk as shown
>> below.
>> >>
>> >> -- Code ---
>> >> vm = vms_service.add(  
>> >> host = types.Host(
>> >> name = "host-01",
>> >> ),
>> >>   )
>> >> -- End Code ---
>> >>
>> >> It created VM successfully, but when I see in ovirt GUI I saw that VM
>> is
>> >> not bonded with specific host.
>> >>
>> >> Ovirt GUI:
>> >> Virtual Machines -> click on VM -> "Edit" button -> In advance menu ->
>> >> "Host" tab
>> >> Start Running On:
>> >>o  Any Host in Cluster  <== This option got selected
>> >>o  Specific Host(s)   <== *I want this option to select.*
>> >>
>> >> Please help me to bind VM to specific Host via Python SDK
>> >>
>> >
>> > The Vm.host attribute is used only to indicate in what host is the VM
>> > currently running.
>> >
>> > To pin the VM to a set of hosts you have to use Vm.placement_policy, as
>> > described here:
>> >
>> >
>> > http://ovirt.github.io/ovirt-engine-api-model/4.1/#types/vm/
>> attributes/placement_policy
>> >
>> > With the Python SDK it should be something like this:
>> >
>> >   vm = vms_service.add(
>> > vm=types.Vm(
>> >   ...
>> >   placement_policy=types.PlacementPolicy(
>> > hosts=[
>> >   types.Host(name='host-01')
>> > ]
>> >   )
>> > )
>> >   )
>> >
>>
>> Sorry, the name of the type is incorrect, should be
>> 'types.VmPlacementPolicy'. So the complete example should be like this:
>>
>>   vm = vms_service.add(
>> vm=types.Vm(
>>   ...
>>   placement_policy=types.VmPlacementPolicy(
>> hosts=[
>>   types.Host(name='host-01')
>> ]
>>   )
>> )
>>   )
>>
>>
>
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] [Python-SDK][Ovirt-4.0] Create VM on specific Host.

2017-04-19 Thread TranceWorldLogic .
Thanks will try and let you know,
~Rohit

On Wed, Apr 19, 2017 at 1:18 PM, Juan Hernández  wrote:

> On 04/19/2017 09:34 AM, Juan Hernández wrote:
> > On 04/19/2017 08:41 AM, TranceWorldLogic . wrote:
> >> Hi,
> >>
> >> I was trying to create VM on specific HOST using python sdk as shown
> below.
> >>
> >> -- Code ---
> >> vm = vms_service.add(  
> >> host = types.Host(
> >> name = "host-01",
> >> ),
> >>   )
> >> -- End Code ---
> >>
> >> It created VM successfully, but when I see in ovirt GUI I saw that VM is
> >> not bonded with specific host.
> >>
> >> Ovirt GUI:
> >> Virtual Machines -> click on VM -> "Edit" button -> In advance menu ->
> >> "Host" tab
> >> Start Running On:
> >>o  Any Host in Cluster  <== This option got selected
> >>o  Specific Host(s)   <== *I want this option to select.*
> >>
> >> Please help me to bind VM to specific Host via Python SDK
> >>
> >
> > The Vm.host attribute is used only to indicate in what host is the VM
> > currently running.
> >
> > To pin the VM to a set of hosts you have to use Vm.placement_policy, as
> > described here:
> >
> >
> > http://ovirt.github.io/ovirt-engine-api-model/4.1/#types/
> vm/attributes/placement_policy
> >
> > With the Python SDK it should be something like this:
> >
> >   vm = vms_service.add(
> > vm=types.Vm(
> >   ...
> >   placement_policy=types.PlacementPolicy(
> > hosts=[
> >   types.Host(name='host-01')
> > ]
> >   )
> > )
> >   )
> >
>
> Sorry, the name of the type is incorrect, should be
> 'types.VmPlacementPolicy'. So the complete example should be like this:
>
>   vm = vms_service.add(
> vm=types.Vm(
>   ...
>   placement_policy=types.VmPlacementPolicy(
> hosts=[
>   types.Host(name='host-01')
> ]
>   )
> )
>   )
>
>
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] [Python-SDK][Ovirt-4.0] Create VM on specific Host.

2017-04-19 Thread Juan Hernández
On 04/19/2017 09:34 AM, Juan Hernández wrote:
> On 04/19/2017 08:41 AM, TranceWorldLogic . wrote:
>> Hi,
>>
>> I was trying to create VM on specific HOST using python sdk as shown below.
>>
>> -- Code ---
>> vm = vms_service.add(  
>> host = types.Host(
>> name = "host-01",
>> ),
>>   )
>> -- End Code ---
>>
>> It created VM successfully, but when I see in ovirt GUI I saw that VM is
>> not bonded with specific host.
>>
>> Ovirt GUI:
>> Virtual Machines -> click on VM -> "Edit" button -> In advance menu ->
>> "Host" tab
>> Start Running On:
>>o  Any Host in Cluster  <== This option got selected
>>o  Specific Host(s)   <== *I want this option to select.*
>>
>> Please help me to bind VM to specific Host via Python SDK
>>
> 
> The Vm.host attribute is used only to indicate in what host is the VM
> currently running.
> 
> To pin the VM to a set of hosts you have to use Vm.placement_policy, as
> described here:
> 
> 
> http://ovirt.github.io/ovirt-engine-api-model/4.1/#types/vm/attributes/placement_policy
> 
> With the Python SDK it should be something like this:
> 
>   vm = vms_service.add(
> vm=types.Vm(
>   ...
>   placement_policy=types.PlacementPolicy(
> hosts=[
>   types.Host(name='host-01')
> ]
>   )
> )
>   )
> 

Sorry, the name of the type is incorrect, should be
'types.VmPlacementPolicy'. So the complete example should be like this:

  vm = vms_service.add(
vm=types.Vm(
  ...
  placement_policy=types.VmPlacementPolicy(
hosts=[
  types.Host(name='host-01')
]
  )
)
  )

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] [Python-SDK][Ovirt-4.0] Create VM on specific Host.

2017-04-19 Thread Juan Hernández
On 04/19/2017 08:41 AM, TranceWorldLogic . wrote:
> Hi,
> 
> I was trying to create VM on specific HOST using python sdk as shown below.
> 
> -- Code ---
> vm = vms_service.add(  
> host = types.Host(
> name = "host-01",
> ),
>   )
> -- End Code ---
> 
> It created VM successfully, but when I see in ovirt GUI I saw that VM is
> not bonded with specific host.
> 
> Ovirt GUI:
> Virtual Machines -> click on VM -> "Edit" button -> In advance menu ->
> "Host" tab
> Start Running On:
>o  Any Host in Cluster  <== This option got selected
>o  Specific Host(s)   <== *I want this option to select.*
> 
> Please help me to bind VM to specific Host via Python SDK
> 

The Vm.host attribute is used only to indicate in what host is the VM
currently running.

To pin the VM to a set of hosts you have to use Vm.placement_policy, as
described here:


http://ovirt.github.io/ovirt-engine-api-model/4.1/#types/vm/attributes/placement_policy

With the Python SDK it should be something like this:

  vm = vms_service.add(
vm=types.Vm(
  ...
  placement_policy=types.PlacementPolicy(
hosts=[
  types.Host(name='host-01')
]
  )
)
  )
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[ovirt-users] [Python-SDK][Ovirt-4.0] Create VM on specific Host.

2017-04-19 Thread TranceWorldLogic .
Hi,

I was trying to create VM on specific HOST using python sdk as shown below.

-- Code ---
vm = vms_service.add(  
host = types.Host(
name = "host-01",
),
  )
-- End Code ---

It created VM successfully, but when I see in ovirt GUI I saw that VM is
not bonded with specific host.

Ovirt GUI:
Virtual Machines -> click on VM -> "Edit" button -> In advance menu ->
"Host" tab
Start Running On:
   o  Any Host in Cluster  <== This option got selected
   o  Specific Host(s)   <== *I want this option to select.*

Please help me to bind VM to specific Host via Python SDK

Thanks,
~Rohit
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users