[ovirt-users] SQL : last time halted?

Juan Hernández jhernand at redhat.com
Thu Jul 6 15:48:01 UTC 2017


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.


More information about the Users mailing list