From fd310fc56b3fa0616e9f068b4b1c474c7ba4c6ec Mon Sep 17 00:00:00 2001 From: Thijs Metsch Date: Mon, 2 Jul 2012 10:32:28 +0200 Subject: [PATCH] fixes #14 --- api/compute/compute_resource.py | 6 ++++++ nova_glue/vm.py | 1 + 2 files changed, 7 insertions(+) diff --git a/api/compute/compute_resource.py b/api/compute/compute_resource.py index 78141d3..ceb9561 100644 --- a/api/compute/compute_resource.py +++ b/api/compute/compute_resource.py @@ -182,6 +182,12 @@ class ComputeBackend(KindBackend, ActionBackend): context = extras['nova_ctx'] uid = entity.attributes['occi.core.id'] + # set state and applicable actions - so even if the user hasn't done + # a GET het can still the most applicable action now... + state, actions = vm.get_occi_state(uid, context) + entity.attributes['occi.compute.state'] = state + entity.actions = actions + if action not in entity.actions: raise AttributeError("This action is currently not applicable.") elif action == infrastructure.START: diff --git a/nova_glue/vm.py b/nova_glue/vm.py index 63e7c50..18dcc60 100644 --- a/nova_glue/vm.py +++ b/nova_glue/vm.py @@ -334,6 +334,7 @@ def attach_volume(instance_id, volume_id, mount_point, context): vol_instance = VOLUME_API.get(context, volume_id) except exception.NotFound: raise exceptions.HTTPError(404, 'Volume not found!') + print vol_instance, dir(vol_instance) volume_id = vol_instance[0] COMPUTE_API.attach_volume(