Port migrations extension to v3 API part 2

This patch contains changes to port migrations extension to v3.

Partially implements blueprint nova-v3-api

Change-Id: Ie79a0d1eeeee7d4fce7a61d8e0cec90982368cf2
This commit is contained in:
Mahesh Panchaksharaiah 2013-07-24 17:16:32 +05:30
parent 6944343237
commit f404751a65
5 changed files with 11 additions and 6 deletions

View File

@ -189,6 +189,7 @@
"compute_extension:v3:os-used-limits": "", "compute_extension:v3:os-used-limits": "",
"compute_extension:v3:os-used-limits:tenant": "rule:admin_api", "compute_extension:v3:os-used-limits:tenant": "rule:admin_api",
"compute_extension:migrations:index": "rule:admin_api", "compute_extension:migrations:index": "rule:admin_api",
"compute_extension:v3:os-migrations:index": "rule:admin_api",
"volume:create": "", "volume:create": "",

View File

@ -18,12 +18,12 @@ from nova.api.openstack import xmlutil
from nova import compute from nova import compute
XMLNS = "http://docs.openstack.org/compute/ext/migrations/api/v2.0" XMLNS = "http://docs.openstack.org/compute/ext/migrations/api/v3"
ALIAS = "os-migrations" ALIAS = "os-migrations"
def authorize(context, action_name): def authorize(context, action_name):
action = 'migrations:%s' % action_name action = 'v3:%s:%s' % (ALIAS, action_name)
extensions.extension_authorizer('compute', action)(context) extensions.extension_authorizer('compute', action)(context)
@ -62,12 +62,12 @@ class MigrationsController(object):
return {'migrations': migrations} return {'migrations': migrations}
class Migrations(extensions.ExtensionDescriptor): class Migrations(extensions.V3APIExtensionBase):
"""Provide data on migrations.""" """Provide data on migrations."""
name = "Migrations" name = "Migrations"
alias = ALIAS alias = ALIAS
namespace = XMLNS namespace = XMLNS
updated = "2013-05-30T00:00:00+00:00" version = 1
def get_resources(self): def get_resources(self):
resources = [] resources = []
@ -75,3 +75,6 @@ class Migrations(extensions.ExtensionDescriptor):
MigrationsController()) MigrationsController())
resources.append(resource) resources.append(resource)
return resources return resources
def get_controller_extensions(self):
return []

View File

@ -18,7 +18,7 @@ import datetime
from lxml import etree from lxml import etree
from nova.api.openstack.compute.contrib import migrations from nova.api.openstack.compute.plugins.v3 import migrations
from nova import context from nova import context
from nova import exception from nova import exception
from nova import test from nova import test

View File

@ -266,7 +266,7 @@ policy_data = """
"compute_extension:v3:os-used-limits": "", "compute_extension:v3:os-used-limits": "",
"compute_extension:v3:os-used-limits:tenant": "is_admin:True", "compute_extension:v3:os-used-limits:tenant": "is_admin:True",
"compute_extension:migrations:index": "is_admin:True", "compute_extension:migrations:index": "is_admin:True",
"compute_extension:v3:os-migrations:index": "is_admin:True",
"volume:create": "", "volume:create": "",
"volume:get": "", "volume:get": "",

View File

@ -88,6 +88,7 @@ nova.api.v3.extensions =
instance_usage_audit_log = nova.api.openstack.compute.plugins.v3.instance_usage_audit_log:InstanceUsageAuditLog instance_usage_audit_log = nova.api.openstack.compute.plugins.v3.instance_usage_audit_log:InstanceUsageAuditLog
keypairs = nova.api.openstack.compute.plugins.v3.keypairs:Keypairs keypairs = nova.api.openstack.compute.plugins.v3.keypairs:Keypairs
limits = nova.api.openstack.compute.plugins.v3.limits:Limits limits = nova.api.openstack.compute.plugins.v3.limits:Limits
migrations = nova.api.openstack.compute.plugins.v3.migrations:Migrations
multinic = nova.api.openstack.compute.plugins.v3.multinic:Multinic multinic = nova.api.openstack.compute.plugins.v3.multinic:Multinic
quota_classes = nova.api.openstack.compute.plugins.v3.quota_classes:QuotaClasses quota_classes = nova.api.openstack.compute.plugins.v3.quota_classes:QuotaClasses
quota_sets = nova.api.openstack.compute.plugins.v3.quota_sets:QuotaSets quota_sets = nova.api.openstack.compute.plugins.v3.quota_sets:QuotaSets