Update time is not updated when metadata of aggregate is updated

For example, When aggregate zone is updated, time is not getting updated
in updated_at field.

So, modified the code such that time gets updated in updated_at field
whenever the aggregate metadata content gets modified.

Change-Id: Icb65313ba85562fadeddbc1890ca5d463e74d3c2
Closes-Bug: #1538014
This commit is contained in:
Pallavi 2016-02-24 14:47:36 +05:30
parent 03e34a10d8
commit b4f7066e7c
3 changed files with 4 additions and 2 deletions

View File

@ -11,6 +11,6 @@
"key": "value"
},
"name": "name",
"updated_at": null
"updated_at": "2013-08-18T12:17:55.986540"
}
}

View File

@ -3670,6 +3670,7 @@ class AggregateAPI(base.Base):
action_name=AGGREGATE_ACTION_UPDATE)
if values:
aggregate.update_metadata(values)
aggregate.updated_at = timeutils.utcnow()
self.scheduler_client.update_aggregates(context, [aggregate])
# If updated values include availability_zones, then the cache
# which stored availability_zones and host need to be reset
@ -3689,6 +3690,7 @@ class AggregateAPI(base.Base):
# which stored availability_zones and host need to be reset
if metadata and metadata.get('availability_zone'):
availability_zones.reset_cache()
aggregate.updated_at = timeutils.utcnow()
return aggregate
@wrap_exception()

View File

@ -11,6 +11,6 @@
"key": "value"
},
"name": "name",
"updated_at": null
"updated_at": %(strtime)s
}
}