Comment 2 for bug 1704928

Revision history for this message
Balazs Gibizer (balazs-gibizer) wrote :

During the Third instance update when the model_query with update runs in the sqlalchemy api the updated_at field magically updated.
https://github.com/openstack/nova/blob/57473088857014d7f46c17ffb3a476e09e0db30f/nova/db/sqlalchemy/api.py#L2741

Before model_query the values parameter of that model_query call does not contain the update_at field.

Some home made tracing of these code parts:

    build_and_run_instance before instance_claim None
    resource_tracker before set_instance_host_and_node None
    _set_instance_host_and_node before save None
    instance.save() before instance_extra_update_by_uuid None {'numa_topology': None, 'flavor': '{"new": null, "cur": {"nova_object.changes": ["extra_specs"], "nova_object.name": "Flavor", "nova_object.namespace": "nova", "nova_object.version": "1.1", "nova_object.data": {"rxtx_factor": 1.0, "is_public": true, "deleted": false, "name": "test_flavor", "vcpu_weight": 0, "root_gb": 1, "extra_specs": {"hw:watchdog_action": "disabled"}, "ephemeral_gb": 0, "swap": 0, "disabled": false, "updated_at": null, "vcpus": 1, "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", "id": 7, "created_at": "2012-10-29T13:42:11Z", "deleted_at": null, "memory_mb": 512}}, "old": null}', 'pci_requests': '[]'}
    instance.save() before instance_update_and_get_original None {'system_metadata': {u'image_min_disk': u'1', 'boot_roles': u'', u'image_kernel_id': u'nokernel', u'image_container_format': u'raw', u'image_base_image_ref': u'155d900f-4e14-4e4c-a73d-069cbf4541e6', u'owner_project_name': None, u'image_disk_format': u'raw', u'owner_user_name': None, u'image_architecture': u'x86_64', u'image_ramdisk_id': u'nokernel'}, 'host': u'compute', 'node': u'fake-mini', 'launched_on': u'compute'}
    convert_object_related_datetimes values, keys {'host': u'compute', 'node': u'fake-mini', 'launched_on': u'compute'} ('created_at', 'deleted_at', 'updated_at', 'launched_at', 'terminated_at')
    convert_object_related_datetimes returning {'host': u'compute', 'node': u'fake-mini', 'launched_on': u'compute'}
    _instance_update before model_query {'host': u'compute', 'node': u'fake-mini', 'launched_on': u'compute'}
    _instance_update after model_query 2012-10-29 13:42:11
    _instance_update returns 2012-10-29 13:42:11
    instance.save() after instance_update_and_get_original + from_db_object 2012-10-29 13:42:11+00:00

I'm totally puzzled how that model_query call ends up updating the update_at field.