From 65f3d49cf75e4496e4420fef4c0537f9f43f35f3 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Tue, 13 Dec 2016 07:45:12 -0600 Subject: [PATCH] Add new attributes to floating ips There are four attributes that show up by default in devstack installs. They come from the timestamp and standard attributes extensions, so it's possible they may not always be present. But we can make them always be present. Change-Id: I1a05ef735c24600821856c6ec36df11e981b3d36 --- doc/source/model.rst | 4 ++++ .../new-floating-attributes-213cdf5681d337e1.yaml | 4 ++++ shade/_normalize.py | 11 +++++++++++ 3 files changed, 19 insertions(+) create mode 100644 releasenotes/notes/new-floating-attributes-213cdf5681d337e1.yaml diff --git a/doc/source/model.rst b/doc/source/model.rst index 508d4a54f..0f5f2aff9 100644 --- a/doc/source/model.rst +++ b/doc/source/model.rst @@ -202,6 +202,7 @@ A Floating IP from Neutron or Nova FloatingIP = dict( location=Location(), id=str(), + description=str(), attached=bool(), fixed_ip_address=str() or None, floating_ip_address=str() or None, @@ -209,6 +210,9 @@ A Floating IP from Neutron or Nova port=str() or None, router=str(), status=str(), + created_at=str() or None, + updated_at=str() or None, + revision_number=int() or None, properties=dict()) Project diff --git a/releasenotes/notes/new-floating-attributes-213cdf5681d337e1.yaml b/releasenotes/notes/new-floating-attributes-213cdf5681d337e1.yaml new file mode 100644 index 000000000..61f4ec1db --- /dev/null +++ b/releasenotes/notes/new-floating-attributes-213cdf5681d337e1.yaml @@ -0,0 +1,4 @@ +--- +features: + - Added support for created_at, updated_at, description + and revision_number attributes for floating ips. diff --git a/shade/_normalize.py b/shade/_normalize.py index 944df2d52..95b00bf12 100644 --- a/shade/_normalize.py +++ b/shade/_normalize.py @@ -468,6 +468,13 @@ class Normalizer(object): router_id = ip.pop('router_id', None) id = ip.pop('id') port_id = ip.pop('port_id', None) + created_at = ip.pop('created_at', None) + updated_at = ip.pop('updated_at', None) + # Note - description may not always be on the underlying cloud. + # Normalizing it here is easy - what do we do when people want to + # set a description? + description = ip.pop('description', '') + revision_number = ip.pop('revision_number', None) if self._use_neutron_floating(): attached = bool(port_id) @@ -487,6 +494,10 @@ class Normalizer(object): port=port_id, router=router_id, status=status, + created_at=created_at, + updated_at=updated_at, + description=description, + revision_number=revision_number, properties=ip.copy(), ) # Backwards compat