[Openstack-operators] [nova] Sort order when filtering by changes-since

Matt Riedemann mriedemos at gmail.com
Fri Oct 20 02:13:34 UTC 2017


Nova has two specs approved for Queens for filtering instance actions 
and migrations by the 'changes-since' filter, which filters on the 
updated_at field.

https://review.openstack.org/#/c/507762/

https://review.openstack.org/#/c/506030/

Those APIs don't take a sort key like the servers API does. Since the 
default sort keys for instances are (created_at, id), we said we'd do 
the same for instance actions and migrations:

https://github.com/openstack/nova/blob/8d21d711000fff80eb367692b157d09b6532923f/nova/db/sqlalchemy/api.py#L2515

When you filter instances using the changes-since filter, it applies to 
the updated_at field but the default sort key is still created_at (in 
descending order):

https://github.com/openstack/nova/blob/8d21d711000fff80eb367692b157d09b6532923f/nova/api/openstack/common.py#L142

Since we're not adding sorting ability to the instance actions and 
migrations APIs, we just said we'd use the same defaults as for listing 
instances.

During the spec review, Alex Xu was asking why we don't sort by the 
updated_at column if the changes-since filter is applied. The only 
response is that's not what we do, by default, when listing instances 
and applying the changes-since filter and we're being consistent with 
those defaults.

So my question is, does anyone have a strong opinion on if we should 
default to sort by created_at but if changes-since is specified, we sort 
by updated_at? Does it matter?

Talk among yourselves.

-- 

Thanks,

Matt



More information about the OpenStack-operators mailing list