"updated" field from nova show output doesn't reflect updates to metadata

Bug #1237106 reported by Brad Pokorny
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Opinion
Wishlist
Unassigned
python-novaclient
Won't Fix
Undecided
Unassigned

Bug Description

The "updated" field in output from "nova show" gets updated when certain fields, such as server name are changed. However, changing metadata doesn't cause the field to be updated.

Steps to recreate:
- Run the "nova show" command on an existing instance and note the timestamp in the "updated" field.
- Add or change metadata on the instance:

curl -i http://[Server IP Address]:8774/v2/[Tenant ID]/servers/[Instance ID]/metadata -X POST -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: [Token from Keystone]" -d '{"metadata": {"new_key": "new_value"}}'

- Run the "nova show" command on the instance and note that although the metadata has been added/changed, the timestamp in the "updated" field hasn't changed.

Expected result:
- The timestamp in the "updated" field should be changed to show when the metadata was changed.

The reason it doesn't currently get changed is that the timestamp for the last update of an instance is stored in the instances table, while the last update of metadata is stored in the instance_metadata table. When metadata is updated, only the instance_metadata table gets updated, and the "nova show" output only queries the instances table to fill in the "updated" timestamp.

This is an issue for a user who has access to the API's/CLI and wants to see when metadata was last updated for an instance. There's not currently a way to see when metadata was last updated via the API's/CLI.

Here are a few options for fixing:
- Update the nova code so that whenever metadata is updated, the "updated" timestamp in the instances table is also updated.
Pros: Existing users of the API's and CLI (using "nova show") who want to know when updates happen to metadata don't need to make changes.
Cons: Changes the behavior of "nova show". Possibly requires a dummy update to the instances table just to update the timestamp on it.

- Change the "nova show" code (in python-novaclient) so that it looks for the latest update date for the instance *and* the lists included in the output and shows the latest one for the "update" field.
Pros: Existing users of the API's and CLI (using "nova show") who want to know when updates happen to metadata don't need to make changes.
Cons: Changes the behavior of "nova show". Possibly confusing when debugging and trying to figure out what table the "update" field is comes from.

- Update the "List Metadata" (http://docs.openstack.org/api/openstack-compute/2/content/List_Metadata-d1e5089.html) API output so that it returns the updated_at timestamp for each metadata object in the response and provide a new CLI command (nova meta show?) so that CLI users could call the API.
Pros: Doesn't change behavior of existing CLI commands.
Cons: Existing users of the CLI (using "nova show") who want to know when updates happen to metadata need to start using a new command. Not as intuitive to users as having the date updated in the "nova show" output

I'd appreciate any comments or suggestions.

Brad Pokorny (bpokorny)
Changed in nova:
assignee: nobody → Brad Pokorny (bpokorny)
Matt Riedemann (mriedem)
Changed in nova:
status: New → In Progress
Revision history for this message
Brad Pokorny (bpokorny) wrote :

I proposed a fix in this review:
https://review.openstack.org/#/c/53680/

But there were concerns about changing the current behavior. See the discussion in the review for further info.

Revision history for this message
melanie witt (melwitt) wrote :

I think this should be addressed in nova only. Please comment if you disagree.

Changed in python-novaclient:
status: New → Won't Fix
Sean Dague (sdague)
Changed in nova:
status: In Progress → Opinion
assignee: Brad Pokorny (bpokorny) → nobody
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.