Commit 088e4262 authored by John Giannelos's avatar John Giannelos
Browse files

snf-occi now working with newer versions of kamaki

parent 2bd4ca03
......@@ -2,7 +2,7 @@
from snfOCCI.registry import snfRegistry
from snfOCCI.compute import ComputeBackend
from snfOCCI.config import SERVER_CONFIG
from snfOCCI.config import SERVER_CONFIG, KAMAKI_CONFIG
from kamaki.clients.compute import ComputeClient
from kamaki.clients.cyclades import CycladesClient
......@@ -79,6 +79,7 @@ class MyAPP(Application):
resource.attributes['occi.compute.cores'] = flavor['cpu']
resource.attributes['occi.compute.memory'] = flavor['ram']
resource.attributes['occi.compute.hostname'] = SERVER_CONFIG['hostname'] % {'id':int(key)}
self.registry.add_resource(key, resource, None)
#Compute instances in registry not available in synnefo
......@@ -89,17 +90,14 @@ class MyAPP(Application):
def __call__(self, environ, response):
conf = Config()
conf.set('compute_token',environ['HTTP_AUTH_TOKEN'])
compClient = ComputeClient(conf)
cyclClient = CycladesClient(conf)
compClient = ComputeClient(KAMAKI_CONFIG['compute_url'], environ['HTTP_AUTH_TOKEN'])
cyclClient = CycladesClient(KAMAKI_CONFIG['compute_url'], environ['HTTP_AUTH_TOKEN'])
#Up-to-date flavors and images
self.refresh_images(compClient, cyclClient)
self.refresh_flavors(compClient, cyclClient)
self.refresh_images(compClient,cyclClient)
self.refresh_flavors(compClient,cyclClient)
self.refresh_compute_instances(compClient)
# token will be represented in self.extras
return self._call_occi(environ, response, security = None, token = environ['HTTP_AUTH_TOKEN'], snf = compClient, client = cyclClient)
......
......@@ -4,6 +4,9 @@ SERVER_CONFIG = {
'compute_arch': 'x86'
}
KAMAKI_CONFIG = {
'compute_url': 'https://cyclades.okeanos.grnet.gr/api/v1.1'
}
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