```
mysql> select * from service_statuses where instance_id='bf39fa53-58eb-439d-bd33-f631c512a412';
+--------------------------------------+--------------------------------------+-----------+--------------------+------------+
| id | instance_id | status_id | status_description | updated_at |
+--------------------------------------+--------------------------------------+-----------+--------------------+------------+
| ceee1296-5e6b-4810-995d-80257c090b1a | bf39fa53-58eb-439d-bd33-f631c512a412 | 1 | running | NULL |
+--------------------------------------+--------------------------------------+-----------+--------------------+------------+
```
`updated_at` should not be NULL, because the status flipped multiple times (from new, to building, to running).
What's happening?
```
2013-06-25 21:52:41.204 15910 DEBUG trove.db.models [req-02b4bc65-d97e-4c69-ac26-b3a4f471a316 radmin 89f6c273df2142e8abf4fcd36df3cbdf] Saving DBInstance: {u'updated': datetime.datetime(2013, 6, 25, 21, 52, 41, 204734), '_sa_instance_state': <sqlalchemy.orm.state.InstanceState object at 0x443bd90>, u'name': u'DBaaSBox', u'task_id': 5, u'created': datetime.datetime(2013, 6, 25, 21, 52, 41, 204383), u'deleted': False, u'tenant_id': u'89f6c273df2142e8abf4fcd36df3cbdf', u'task_description': 'The instance is building.', u'volume_size': 5, 'errors': {}, u'flavor_id': u'6', u'id': 'bf39fa53-58eb-439d-bd33-f631c512a412'} save /opt/stack/trove/trove/db/models.py:59
2013-06-25 21:52:41.233 15910 DEBUG trove.instance.models [req-02b4bc65-d97e-4c69-ac26-b3a4f471a316 radmin 89f6c273df2142e8abf4fcd36df3cbdf] Tenant 89f6c273df2142e8abf4fcd36df3cbdf created new Trove instance bf39fa53-58eb-439d-bd33-f631c512a412... _create_resources /opt/stack/trove/trove/instance/models.py:455
2013-06-25 21:52:41.233 15910 DEBUG trove.db.models [req-02b4bc65-d97e-4c69-ac26-b3a4f471a316 radmin 89f6c273df2142e8abf4fcd36df3cbdf] Saving InstanceServiceStatus: {'updated': datetime.datetime(2013, 6, 25, 21, 52, 41, 233914), '_sa_instance_state': <sqlalchemy.orm.state.InstanceState object at 0x4439290>, u'status_id': 23, 'created': datetime.datetime(2013, 6, 25, 21, 52, 41, 233766), u'instance_id': 'bf39fa53-58eb-439d-bd33-f631c512a412', 'errors': {}, u'status_description': 'new', u'id': 'ceee1296-5e6b-4810-995d-80257c090b1a'} save /opt/stack/trove/trove/db/models.py:59
```
Note how the name for the field in InstanceServiceStatus is 'updated', much like it's sister table DBInstance.
DBInstance (aka instances) has a column named 'updated':
```
mysql> select * from instances where id='bf39fa53-58eb-439d-bd33-f631c512a412' \G;
*************************** 1. row ***************************
id: bf39fa53-58eb-439d-bd33-f631c512a412
created: 2013-06-25 21:52:41
updated: 2013-06-25 21:52:44
```
but from above, `service_statuses` does not; it's named `updated_at`, not `updated`.
That isn't quite the problem though.
https://github.com/openstack/trove/blob/7ab80b554dde5f1f1e61b6a8c45492c5ac27ed6b/trove/instance/models.py#L713
Note that the data_fields does not include `updated_at`:
_data_fields = ['instance_id', 'status_id', 'status_description']
Also note the lack of an overridden `save()` method.
I think this, in conjunction with the Guest changing the state: https://github.com/openstack/trove/blob/b0834124e8bc917cbb6ed2881234ff4b33826f44/trove/guestagent/manager/mysql_service.py#L204
Means that it needs to override `save()` for InstanceServiceStatus and do something like `self['updated_at'] = utils.utcnow()`, much like is done in other places:
(i.e. https://github.com/openstack/trove/blob/7ab80b554dde5f1f1e61b6a8c45492c5ac27ed6b/trove/db/models.py#L54 and https://github.com/openstack/trove/blob/7ab80b554dde5f1f1e61b6a8c45492c5ac27ed6b/trove/guestagent/models.py#L54 )
Fix proposed to branch: master /review. openstack. org/45146
Review: https:/