Re: [Users] oVirt-sdk to fetch individual cpu stats

2013-09-10 Thread Deepthi Dharwar
Thanks a lot Micheal. Works like a charm :)

How does one know that you need to access first field in
statistic.get_values().get_value()[0].datum.
Are these documented any place ?

Regards,
Deepthi

On 09/08/2013 03:55 PM, Michael Pasternak wrote:


> 
> Hi Deepthi,
> 
> On 09/06/2013 01:12 PM, Deepthi Dharwar wrote:
>> Hi,
>>
>> I was trying to get the cpu statistics of a host using the oVirt python
>> sdk. But beyond a point I am unable to deference to the actual cpu stats
>> field and the data.
>>
>> h_list = api.hosts.list()
>> for h in h_list: 
>>  y = h.statistics.list()
>>  for i in y:
>>  print i.get_values()
>>
>> O/P:
>>
>>  
>>  
>>  
>>  
>>  
>>
>> Can some one please let me know how I can get individual fields like
>> cpu.current.system or cpu.current.idle stats from here.
> 
> you can use sdk client side filtering on collections using
> map based constraints [1], just note that you cannot use
> same constrain (name) twice [2] as following entry will always
> override the former one,
> 
> to work this out, just use your private inline filtering [3] (it will have
> same complexity as using sdk filtering)
> 
> [1]
> 
> for h in h_list:
> statistics = h.statistics.list(**{
> 'name':'cpu.current.system'
> }
> )
> for statistic in statistics:
> print "%s=%0.4f %s" % (
> statistic.get_name(),
> statistic.get_values().get_value()[0].datum,
> statistics[0].get_unit()
> )
> 
> [2]
> 
> statistics = h.statistics.list(**{
> 'name':'cpu.current.system',
> 'name':'cpu.current.idle'
> }
> )
> 
> 
> [3]
> 
> h_list = api.hosts.list()
> stats_to_show = ['cpu.current.system', 'cpu.current.idle']
> for h in h_list:
> statistics = h.statistics.list()
> for statistic in statistics:
> if statistic.get_name() in stats_to_show:
> print "%s=%0.4f %s" % (
> statistic.get_name(),
> 
> statistic.get_values().get_value()[0].datum ,
> statistics[0].get_unit()
> )
> 
> 
> 
> hope it helps.
> 
>>
>> Thanks!
>> Deepthi
>>
> 
> 

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


[Users] oVirt-sdk to fetch individual cpu stats

2013-09-06 Thread Deepthi Dharwar
Hi,

I was trying to get the cpu statistics of a host using the oVirt python
sdk. But beyond a point I am unable to deference to the actual cpu stats
field and the data.

h_list = api.hosts.list()
for h in h_list:
y = h.statistics.list()
for i in y:
print i.get_values()

O/P:

 
 
 
 
 

Can some one please let me know how I can get individual fields like
cpu.current.system or cpu.current.idle stats from here.

Thanks!
Deepthi

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


Re: [Users] so, what do you want next in oVirt?

2013-09-02 Thread Deepthi Dharwar
Hi,

On 09/02/2013 01:12 PM, Karli Sjöberg wrote:
> Hi,
> 
> I would like to see a more advanced type of Power-Saving Cluster policy,
> where an empty Host gets put into a sleep-mode, so that it draws as
> little power as possible and can be awoken by engine when VM's starts to
> use more resources.
> 
> A typical scenario would be that all VM's are spread evenly over Hosts
> during day-time, when customers are actively using their VM's. But then
> during off-hours, VM's gets clumped up into maybe one or two Hosts, and
> the other Hosts can be put to sleep to save energy, and then woken up in
> the morning again.


I agree. Current power-saving policy doesn't do much other than
consolidating VMs. Having a tunable based on which X/Y idle hosts in the
cluster could be powered-off, where Y-X hosts are ON just for backup. I
would love to see that in the coming days in oVirt.

It would also benefit if there is some kind of power-metering that is
flagged in the GUI. How much power each system is consuming and over-all
cluster is consuming.
This would be a real handy number to access power consumption of the
systems.

Regards,
Deepthi

> /Karli
> 
> tis 2013-08-20 klockan 17:19 -0400 skrev Itamar Heim:
>> earlier in the year we did a survey for feature requests / improvements 
>> / etc.
>>
>> since a lot of things were added, and priorities usually change, I'd 
>> like to ask again for "what do you need the most from oVirt / what are 
>> your pain points" next?
>>
>> below[1] I've listed my understanding of what already went in from 
>> previous survey requests (to various degrees of coverage).
>>
>> Thanks,
>> Itamar
>>
>> [1] from the top 12
>> V Allow disk resize
>> V Integrate Nagios/Zabbix monitoring - via a ui plugin
>> V Highly Available engine - via hosted engine[2]
>> V Open vSwitch integration - via neutron integration
>> X Allow cloning VMs without template
>> ? Enable hypervisor upgrade/updates through engine[3]
>> V Allow engine on an oVirt hosted VM - via hosted engine[2]
>> V Enable guest configuration (root password, SSH keys, network) via
>>guest agent in engine - via cloud-init
>> X Integrate v2v into engine
>> ? Bond/extend ovirtmgmt with a second network for HA/increased
>>bandwidth[4]
>> X Integrate scheduling of snapshots and VM export for backups in
>>engine[5]
>> V Spice – support Google Chrome - via mime based launch
>>
>>
>> Other items mentioned in previous survey which should be covered by now:
>> - Fix timeout when adding local host during all-in-one configuration
>> - Fix engine set-up when SELinux is disabled
>> - Provide packages for el6 (CentOS, Red Hat Enterprise Linux)
>> - Allow multiple VMs to be deployed from the same template at the same
>>time
>> - ISO domains on local/GlusterS
>> - Show IP addresses in Virtual Machines->Network Interfaces
>> - OpenStack Quantum support (now called Neutron)
>> - noVNC support
>> - Support spice.html5 and websocket proxy
>> - Add other guest OSes to list
>> - Port oVirt guest agent to Ubuntu[6]
>> - SLA - Allow resource time-sharing
>> - Spice - Mac client (via mime based launch)
>> - Spice - port XPI plug-in to Windows (not sure this will happen, but
>>mime based launch allows using firefox now)
>> - Spice - client for Ubuntu/Debian (should be covered via mime based
>>launch)
>>
>>
>> [2] hosted engine is in active development, but not released yet.
>> [3] host update is supported, but not for general yum update.
>> [4] a lot of improvements were done in this space, but i'm not sure if
>>  they cover this exact use case
>> [5] backup api is now being pushed to master, and orchestration of
>>  backups should probably happen via 3rd part backup vendors?
>> [6] I'm not sure packaging exists yet, but ubuntu is covered for the
>>  basic functionality of the guest agent.
>> ___
>> Users mailing list
>> Users@ovirt.org 
>> http://lists.ovirt.org/mailman/listinfo/users
> 
> -- 
> 
> Med Vänliga Hälsningar
> ---
> Karli Sjöberg
> Swedish University of Agricultural Sciences
> Box 7079 (Visiting Address Kronåsvägen 8)
> S-750 07 Uppsala, Sweden
> Phone:  +46-(0)18-67 15 66
> karli.sjob...@slu.se 
> 
> 
> 
> ___
> 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] Putting the host in maintenance mode via python SDK

2013-07-01 Thread Deepthi Dharwar
On 07/01/2013 06:08 PM, Michael Pasternak wrote:
> On 07/01/2013 02:37 PM, Vladimir Vyazmin wrote:
>> Hi,
>>
>> There is any a via pythonSDK to put the host in maintenance mode:
>>
>> hostObject = API.hosts.get(fakeHostNames)
>>
>> turboMaintenanceHost(hostObject)
>>
>> # Turbo Maintenance Host #
>> def turboMaintenanceHost(vmObject):
>> """ maintenance Host"""
>> if vmObject.status.state == 'up':
>> vmObject.deactivate()
>> LOGGER.info(TimestampScale() + "Object '%s' maintenance." % 
>> vmObject.name)
>> else:
>> LOGGER.warning(TimestampScale() + "Failed maintenance '%s' Object." 
>> % vmObject.name)
>> return True
>>

Thanks for this piece of code. Shall give it a try.

>>
>>
>>
>> - Original Message -
>>> From: "Deepthi Dharwar" 
>>> To: users@ovirt.org, "Michael Pasternak" 
>>> Sent: Monday, July 1, 2013 2:13:09 PM
>>> Subject: [Users] Putting the host in maintenance mode via python SDK
>>>
>>> Hi,
>>>
>>> I am trying to switch off Hosts in DC which are idle.
>>>
>>> I wanted to know as to why start/stop of hosts options are enabled in
>>> Power Mgmt tab only when the host is in Maintenance mode and not otherwise.
> 
> cause you don't want to kill all vms running on this host when switching it 
> off,
> moving host to the maintenance mode will make them migrating to other host/s 
> in
> the cluster,
> 
> actually there are much more scenarios where you want to be sure that you can
> safely switch off the host.

So as I understand, issuing a STOP just halts the host but not migrate
VMs . This needs to be done by putting the host in the maintenance mode
where all the VMs running are migrated. Host is disconnected from the
storage pool after which one can shut-down the system.

Maintenance is per-requisite mode where u explicitly tell the engine
to migrate the VMs and disconnect host from storage and not done as part
of integral shutdown process.

>>>
>>> Also, is there any way via pythonSDK to put the host in maintenance mode ?
>>>
>>> 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] Putting the host in maintenance mode via python SDK

2013-07-01 Thread Deepthi Dharwar
Hi,

I am trying to switch off Hosts in DC which are idle.

I wanted to know as to why start/stop of hosts options are enabled in
Power Mgmt tab only when the host is in Maintenance mode and not otherwise.

Also, is there any way via pythonSDK to put the host in maintenance mode ?

Regards,
Deepthi

___
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-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 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


[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


[Users] Query on Load balancing policies.

2013-05-21 Thread Deepthi Dharwar
Hi,

I have been trying out various cluster policies on latest ovirt.
On enabling Load Balancing policy: power saving, I have observed
migration of VMs and consolidating them on fewer hosts resulting in
under utilised hosts cleared of VMs.

Is the onus on the administrator to switch off all
under utilized systems ? Is there any knob I am missing
that automatically turns off under utilized hosts
and powers on the hosts on a need basis.


Regards,
Deepthi

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