Comment 2 for bug 1236585

Revision history for this message
Ken'ichi Ohmichi (oomichi) wrote :

This test scenario is the following steps:

1. Get a timestamp(TM01) which will be passed as "changes-since" parameter of list-server API.
2. Create 1st server(VM01).
3. Create 2nd server(VM02).
4. Create 3rd server(VM03).
5. Delete 3rd server.
6. Call list-server API with the timestamp(TM01) as "changes-since" parameter.
7. Check it is possible to get all servers(VM01, VM02, VM03).

According to http://logs.openstack.org/93/59093/1/check/check-tempest-devstack-vm-full/20c041b/ ,
we could not get VM01 and this test failed on step 7.

This problem happens if VM01 creation(step 2.) finishes in the same second as TM01.
For example, the following timestamps is not problem.

1. (20:21:19.247) Get a timestamp(TM01)
2. (20:21:20.247) Create 1st server(VM01).

However, this problem happens if the following timestamps:

1. (20:21:19.247) Get a timestamp(TM01)
2. (20:21:19.805) Create 1st server(VM01).

The above timestamps are the ones of http://logs.openstack.org/93/59093/1/check/check-tempest-devstack-vm-full/20c041b/ ,
and step 1. and step 2. are in the same second(20:21:19).

The reason is Nova implementation of list-server API.
changes-since is implemented with the following code:

nova/db/sqlalchemy/api.py
 1877 query_prefix = query_prefix.\
 1878 filter(models.Instance.updated_at > changes_since)

In addition, "updated_at" of "instances" table is defined as datetime from mysql.
 mysql> desc instances;
 +--------------------------+-----------------------+------+-----+---------+----------------+
 | Field | Type | Null | Key | Default | Extra |
 +--------------------------+-----------------------+------+-----+---------+----------------+
 | created_at | datetime | YES | | NULL | |
 | updated_at | datetime | YES | | NULL | |
 [..]
 +--------------------------+-----------------------+------+-----+---------+----------------+

The data type does not contain millisecond.
So if step 1. and step 2. are in the same second, it is impossible to know the timestamp difference
and "filter(models.Instance.updated_at > changes_since)" filters VM01.