[ovirt-users] SQL : last time halted?

Eli Mesika emesika at redhat.com
Sun Jul 9 13:19:13 UTC 2017


On Thu, Jul 6, 2017 at 6:48 PM, Juan Hernández <jhernand at 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 at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20170709/707469e2/attachment-0001.html>


More information about the Users mailing list