On Thu, Jul 6, 2017 at 6:48 PM, Juan Hernández <jhernand@redhat.com> wrote:
On 07/06/2017 02:07 PM, Nicolas Ecarnot wrote:
[For the record]

Juan,

Thanks to your hint, I eventually found it more convenient for me to use a SQL query to find out which VM was unsed for months :

SELECT
   vm_static.vm_name,
   vm_dynamic.status,
   vm_dynamic.vm_ip,
   vm_dynamic.vm_host,
   vm_dynamic.last_start_time,
   vm_dynamic.vm_guid,
   vm_dynamic.last_stop_time
FROM
   public.vm_dynamic,
   public.vm_static
WHERE
   vm_dynamic.vm_guid = vm_static.vm_guid AND
   vm_dynamic.status = 0
ORDER BY
   vm_dynamic.last_stop_time ASC;

Thank you.


That is nice. Just keep in mind that the database schema isn't kept backwards compatible. A minor change in the engine can make your query fail or return incorrect results.

​I tend to agree ​
 
​with Juan that if you are doing that periodically then using the Python SDK will insure that your script will survive schema changes ​

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