Add new attributes to instance

This change adds launched_at/started_at/deleted_at attribute to instance.

Rely on started_at/ended_at of Gnocchi to known when the operation have
done is not precise. Nova records the exact time of this event, just
copy them to Gnocchi.

Change-Id: If7870fd525d1ef58e4c2dbbbf93525bab3623b0f
This commit is contained in:
Mehdi Abaakouk 2017-12-10 22:37:58 +01:00
parent 84726b4cb0
commit 36414e1ceb
4 changed files with 22 additions and 1 deletions

View File

@ -195,6 +195,9 @@ metric:
flavor_name: $.payload.instance_type
display_name: $.payload.display_name
image_ref: $.payload.image_meta.base_image_ref
launched_at: $.payload.launched_at
created_at: $.payload.created_at
deleted_at: $.payload.deleted_at
- name: 'vcpus'
event_type: *instance_events

View File

@ -204,11 +204,22 @@ resources_update_operations = [
"attributes": {"node": {"type": "string", "min_length": 0,
"max_length": 255, "required": True}}
}]},
{"desc": "add launched_at to instance",
"type": "update_attribute_type",
"resource_type": "instance",
"data": [
{"op": "add", "path": "/attributes/launched_at",
"value": {"type": "datetime", "required": False}},
{"op": "add", "path": "/attributes/created_at",
"value": {"type": "datetime", "required": False}},
{"op": "add", "path": "/attributes/deleted_at",
"value": {"type": "datetime", "required": False}},
]},
]
# NOTE(sileht): We use LooseVersion because pbr can generate invalid
# StrictVersion like 9.0.1.dev226
REQUIRED_VERSION = version.LooseVersion("4.0.0")
REQUIRED_VERSION = version.LooseVersion("4.2.0")
def upgrade_resource_types(conf):

View File

@ -69,6 +69,9 @@ resources:
attributes:
host: resource_metadata.(instance_host|host)
image_ref: resource_metadata.image_ref
launched_at: resource_metadata.launched_at
created_at: resource_metadata.created_at
deleted_at: resource_metadata.deleted_at
display_name: resource_metadata.display_name
flavor_id: resource_metadata.(instance_flavor_id|(flavor.id)|flavor_id)
flavor_name: resource_metadata.(instance_type|(flavor.name)|flavor_name)

View File

@ -0,0 +1,4 @@
---
features:
- |
`launched_at`/`created_at`/`deleted_at` of Nova instances are now tracked.