Re: [Users] Using python sdk to find the VMs running on a host.

2013-07-01 Thread Deepthi Dharwar
On 06/25/2013 04:04 PM, Michael Pasternak wrote:
 On 06/25/2013 09:28 AM, Itamar Heim wrote:
 On 06/25/2013 07:54 AM, Deepthi Dharwar wrote:
 Hi,

 I am using the ovirt-python-sdk to figure out if the host is idle or
 not. The way to determine if the host is idle at a given instant is
 finding out the number of VMs running on it. If the number of VMs = 0
 implies host is idle.

 adding michael for the rest of the question, but please note to check for 
 SPM role of a host before assuming it is idle.

 also, may i ask what you are trying to accomplish (it sounds like a power 
 saving policy)?


 I was exploring the python sdk to figure out Host-VMs mapping i.e What
 are the VMs running on the different host.

 Looks like the only way to find this, is to query each VM in /api/vms
 list to get the host on which it is running.

 Is this the right way ? Is there no direct query or REST API to list
 the VMs running on a given host at that instant.
 
 you can run query=host = X for that.
 

Thanks! I was able to successfully come up with the hierarchy.


 I was looking to get the data center hierarchy structure.
 Number_of_datacenters
|
V
 clusters in each data center
|
V
 Hosts in each cluster
|
V
   VMs on each host.

 This kind of mapping as seen on the GUI. Is there any way to obtain
 the same from the ovirt-python-sdk ?
 
 you can combine query to fetch vms by dc+cluster+host,
 
 query = datacenter = x and cluster = y and host = z
 
 also you can fetch hosts from the given cluster
 
 cluster=x
 
 same for cluster
 
 Datacenter.name = x
 

 With this information, this would help me write scripts to turn-off my
 hosts if idle automatically and power them on as required.

 Regards,
 Deepthi



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


 
 

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


Re: [Users] Using python sdk to find the VMs running on a host.

2013-06-25 Thread Itamar Heim

On 06/25/2013 07:54 AM, Deepthi Dharwar wrote:

Hi,

I am using the ovirt-python-sdk to figure out if the host is idle or
not. The way to determine if the host is idle at a given instant is
finding out the number of VMs running on it. If the number of VMs = 0
implies host is idle.


adding michael for the rest of the question, but please note to check 
for SPM role of a host before assuming it is idle.


also, may i ask what you are trying to accomplish (it sounds like a 
power saving policy)?




I was exploring the python sdk to figure out Host-VMs mapping i.e What
are the VMs running on the different host.

Looks like the only way to find this, is to query each VM in /api/vms
list to get the host on which it is running.

Is this the right way ? Is there no direct query or REST API to list
the VMs running on a given host at that instant.

I was looking to get the data center hierarchy structure.
Number_of_datacenters
   |
   V
clusters in each data center
   |
   V
Hosts in each cluster
   |
   V
  VMs on each host.

This kind of mapping as seen on the GUI. Is there any way to obtain
the same from the ovirt-python-sdk ?

With this information, this would help me write scripts to turn-off my
hosts if idle automatically and power them on as required.

Regards,
Deepthi



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



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


Re: [Users] Using python sdk to find the VMs running on a host.

2013-06-25 Thread Deepthi Dharwar
On 06/25/2013 11:58 AM, Itamar Heim wrote:
 On 06/25/2013 07:54 AM, Deepthi Dharwar wrote:
 Hi,

 I am using the ovirt-python-sdk to figure out if the host is idle or
 not. The way to determine if the host is idle at a given instant is
 finding out the number of VMs running on it. If the number of VMs = 0
 implies host is idle.
 
 adding michael for the rest of the question, but please note to check
 for SPM role of a host before assuming it is idle.

Yes, that is essential. Thanks for pointing it out.


 also, may i ask what you are trying to accomplish (it sounds like a
 power saving policy)?

Yes, I was looking to tweak the power saving policy to switch off
hosts that have no VMs running on them. Looks like doing it within the
ovirt-engine is better option than through scripts and SDK.


 I was exploring the python sdk to figure out Host-VMs mapping i.e What
 are the VMs running on the different host.

 Looks like the only way to find this, is to query each VM in /api/vms
 list to get the host on which it is running.

 Is this the right way ? Is there no direct query or REST API to list
 the VMs running on a given host at that instant.

 I was looking to get the data center hierarchy structure.
 Number_of_datacenters
|
V
 clusters in each data center
|
V
 Hosts in each cluster
|
V
   VMs on each host.

 This kind of mapping as seen on the GUI. Is there any way to obtain
 the same from the ovirt-python-sdk ?

 With this information, this would help me write scripts to turn-off my
 hosts if idle automatically and power them on as required.

 Regards,
 Deepthi



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

 
 
 

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


Re: [Users] Using python sdk to find the VMs running on a host.

2013-06-25 Thread Itamar Heim

On 06/25/2013 12:30 PM, Deepthi Dharwar wrote:

On 06/25/2013 11:58 AM, Itamar Heim wrote:

On 06/25/2013 07:54 AM, Deepthi Dharwar wrote:

Hi,

I am using the ovirt-python-sdk to figure out if the host is idle or
not. The way to determine if the host is idle at a given instant is
finding out the number of VMs running on it. If the number of VMs = 0
implies host is idle.


adding michael for the rest of the question, but please note to check
for SPM role of a host before assuming it is idle.


Yes, that is essential. Thanks for pointing it out.



also, may i ask what you are trying to accomplish (it sounds like a
power saving policy)?


Yes, I was looking to tweak the power saving policy to switch off
hosts that have no VMs running on them. Looks like doing it within the
ovirt-engine is better option than through scripts and SDK.


you should soon be able to write it via python sdk/scripts integrated 
with the engine via:

http://www.ovirt.org/Features/oVirtSchedulerAPI





I was exploring the python sdk to figure out Host-VMs mapping i.e What
are the VMs running on the different host.

Looks like the only way to find this, is to query each VM in /api/vms
list to get the host on which it is running.

Is this the right way ? Is there no direct query or REST API to list
the VMs running on a given host at that instant.

I was looking to get the data center hierarchy structure.
Number_of_datacenters
|
V
clusters in each data center
|
V
Hosts in each cluster
|
V
   VMs on each host.

This kind of mapping as seen on the GUI. Is there any way to obtain
the same from the ovirt-python-sdk ?

With this information, this would help me write scripts to turn-off my
hosts if idle automatically and power them on as required.

Regards,
Deepthi



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









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


Re: [Users] Using python sdk to find the VMs running on a host.

2013-06-25 Thread Michael Pasternak
On 06/25/2013 09:28 AM, Itamar Heim wrote:
 On 06/25/2013 07:54 AM, Deepthi Dharwar wrote:
 Hi,

 I am using the ovirt-python-sdk to figure out if the host is idle or
 not. The way to determine if the host is idle at a given instant is
 finding out the number of VMs running on it. If the number of VMs = 0
 implies host is idle.
 
 adding michael for the rest of the question, but please note to check for SPM 
 role of a host before assuming it is idle.
 
 also, may i ask what you are trying to accomplish (it sounds like a power 
 saving policy)?
 

 I was exploring the python sdk to figure out Host-VMs mapping i.e What
 are the VMs running on the different host.

 Looks like the only way to find this, is to query each VM in /api/vms
 list to get the host on which it is running.

 Is this the right way ? Is there no direct query or REST API to list
 the VMs running on a given host at that instant.

you can run query=host = X for that.


 I was looking to get the data center hierarchy structure.
 Number_of_datacenters
|
V
 clusters in each data center
|
V
 Hosts in each cluster
|
V
   VMs on each host.

 This kind of mapping as seen on the GUI. Is there any way to obtain
 the same from the ovirt-python-sdk ?

you can combine query to fetch vms by dc+cluster+host,

query = datacenter = x and cluster = y and host = z

also you can fetch hosts from the given cluster

cluster=x

same for cluster

Datacenter.name = x


 With this information, this would help me write scripts to turn-off my
 hosts if idle automatically and power them on as required.

 Regards,
 Deepthi



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

 


-- 

Michael Pasternak
RedHat, ENG-Virtualization RD
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Using python sdk to find the VMs running on a host.

2013-06-25 Thread Itamar Heim

On 06/25/2013 01:34 PM, Michael Pasternak wrote:

On 06/25/2013 09:28 AM, Itamar Heim wrote:

On 06/25/2013 07:54 AM, Deepthi Dharwar wrote:

Hi,

I am using the ovirt-python-sdk to figure out if the host is idle or
not. The way to determine if the host is idle at a given instant is
finding out the number of VMs running on it. If the number of VMs = 0
implies host is idle.


adding michael for the rest of the question, but please note to check for SPM 
role of a host before assuming it is idle.

also, may i ask what you are trying to accomplish (it sounds like a power 
saving policy)?



I was exploring the python sdk to figure out Host-VMs mapping i.e What
are the VMs running on the different host.

Looks like the only way to find this, is to query each VM in /api/vms
list to get the host on which it is running.

Is this the right way ? Is there no direct query or REST API to list
the VMs running on a given host at that instant.


you can run query=host = X for that.



I was looking to get the data center hierarchy structure.
Number_of_datacenters
|
V
clusters in each data center
|
V
Hosts in each cluster
|
V
   VMs on each host.

This kind of mapping as seen on the GUI. Is there any way to obtain
the same from the ovirt-python-sdk ?


you can combine query to fetch vms by dc+cluster+host,

query = datacenter = x and cluster = y and host = z


this is redundnat, since host is in one cluster which is in one 
datacenter, so just querying on host would give the same result.




also you can fetch hosts from the given cluster

cluster=x

same for cluster

Datacenter.name = x



With this information, this would help me write scripts to turn-off my
hosts if idle automatically and power them on as required.

Regards,
Deepthi



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








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


[Users] Using python sdk to find the VMs running on a host.

2013-06-24 Thread Deepthi Dharwar
Hi,

I am using the ovirt-python-sdk to figure out if the host is idle or
not. The way to determine if the host is idle at a given instant is
finding out the number of VMs running on it. If the number of VMs = 0
implies host is idle.

I was exploring the python sdk to figure out Host-VMs mapping i.e What
are the VMs running on the different host.

Looks like the only way to find this, is to query each VM in /api/vms
list to get the host on which it is running.

Is this the right way ? Is there no direct query or REST API to list
the VMs running on a given host at that instant.

I was looking to get the data center hierarchy structure.
Number_of_datacenters
  |
  V
clusters in each data center
  |
  V
Hosts in each cluster
  |
  V
 VMs on each host.

This kind of mapping as seen on the GUI. Is there any way to obtain
the same from the ovirt-python-sdk ?

With this information, this would help me write scripts to turn-off my
hosts if idle automatically and power them on as required.

Regards,
Deepthi



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