From 54d97ffcda7409c06829780578b0b7f7f4417939 Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Wed, 2 Aug 2017 13:44:58 +0100 Subject: [PATCH] Add occi.compute.ephemeral_storage.size attribute Implemented as an alias of org.openstack.flavor.ephemeral so both can be used. Change-Id: I8764af5778d73b3a9e112cfff97be7efdda6af33 Related-Bug: 1687943 --- ooi/openstack/templates.py | 4 ++++ ooi/tests/unit/occi/test_openstack.py | 1 + 2 files changed, 5 insertions(+) diff --git a/ooi/openstack/templates.py b/ooi/openstack/templates.py index 226fe1a..236b2fb 100644 --- a/ooi/openstack/templates.py +++ b/ooi/openstack/templates.py @@ -56,6 +56,10 @@ class OpenStackResourceTemplate(templates.OCCIResourceTemplate): attrs = attribute.AttributeCollection({a.name: a for a in attrs}) + # occi attribute is an alias for the OpenStack one + attrs["occi.compute.ephemeral_storage.size"] = ( + attrs["org.openstack.flavor.ephemeral"]) + location = "%s/%s" % (self._location, id) super(OpenStackResourceTemplate, self).__init__( id, diff --git a/ooi/tests/unit/occi/test_openstack.py b/ooi/tests/unit/occi/test_openstack.py index f196d8f..315abc9 100644 --- a/ooi/tests/unit/occi/test_openstack.py +++ b/ooi/tests/unit/occi/test_openstack.py @@ -73,6 +73,7 @@ class TestOpenStackResourceTemplate(base.TestCase): for attr in [("occi.compute.cores", cores), ("occi.compute.memory", memory), ("org.openstack.flavor.swap", swap), + ("occi.compute.ephemeral_storage.size", ephemeral), ("org.openstack.flavor.ephemeral", ephemeral), ("org.openstack.flavor.disk", disk)]: self.assertEqual(tpl.attributes[attr[0]].default, attr[1])