Commit 3c3c94f2 authored by John Giannelos's avatar John Giannelos
Browse files

Fixed latency in flavor populating

parent d7dfc401
......@@ -16,6 +16,8 @@ class MyBackend(KindBackend, ActionBackend):
attributes. Support for links and mixins would need to added.
# Update and Replace compute instances not supported by Cyclades
def update(self, old, new, extras):
raise AttributeError("This action is currently no applicable.")
......@@ -59,6 +61,7 @@ class ComputeBackend(MyBackend):
def retrieve(self, entity, extras):
# triggering cyclades to retrieve up to date information
conf = Config()
snf = ComputeClient(conf)
......@@ -57,10 +57,11 @@ if __name__ == '__main__':
flavors = snf.list_flavors()
for flavor in flavors:
details = snf.get_flavor_details(flavor['id'])
FLAVOR_ATTRIBUTES = {'': flavor['id'],
'occi.compute.cores': snf.get_flavor_details(flavor['id'])['cpu'],
'occi.compute.memory': snf.get_flavor_details(flavor['id'])['ram'],
'': snf.get_flavor_details(flavor['id'])['disk'],
'occi.compute.cores': details['cpu'],
'occi.compute.memory': details['ram'],
'': details['disk'],
FLAVOR = Mixin("", str(flavor['name']), [RESOURCE_TEMPLATE], attributes = FLAVOR_ATTRIBUTES)
APP.register_backend(FLAVOR, MixinBackend())
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment