From 85518a93ef01ae997ecfc0687d89ba87f7607f54 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Mon, 16 Jan 2012 15:28:49 -0800 Subject: Add default policy rule If a specific rule is not found, we will check the rule defined in FLAGS.policy_default_action. Change-Id: Ib1b1aa4bbeec74bdb1562d0fc649d33838076f01 --- nova/volume/api.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'nova/volume') diff --git a/nova/volume/api.py b/nova/volume/api.py index 6f5921f7c..cc9cac019 100644 --- a/nova/volume/api.py +++ b/nova/volume/api.py @@ -146,9 +146,10 @@ class API(base.Base): self.db.volume_update(context, volume['id'], fields) def get(self, context, volume_id): - check_policy(context, 'get', {'id': volume_id}) rv = self.db.volume_get(context, volume_id) - return dict(rv.iteritems()) + volume = dict(rv.iteritems()) + check_policy(context, 'get', volume) + return volume def get_all(self, context, search_opts={}): check_policy(context, 'get_all') @@ -262,7 +263,7 @@ class API(base.Base): def _create_snapshot(self, context, volume, name, description, force=False): - check_policy(context, 'create_snapshot') + check_policy(context, 'create_snapshot', volume) if ((not force) and (volume['status'] != "available")): raise exception.ApiError(_("Volume status must be available")) -- cgit