From 8d3f20e776af0fe174474a9fe8ee02eabe64053b Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Thu, 5 May 2011 15:56:04 -0400 Subject: Added interfaces to server controller --- nova/api/openstack/servers.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'nova/api') diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index 3cf78e32c..1d3eab65b 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -75,6 +75,26 @@ class Controller(common.OpenstackController): """ Returns a list of server details for a given user """ return self._items(req, is_detail=True) + def _image_id_from_req_data(self, data): + raise NotImplementedError + + def _flavor_id_from_req_data(self, data): + raise NotImplementedError + + def _get_view_builder(self, req): + raise NotImplementedError + + def _limit_items(self, items, req): + raise NotImplementedError + + def _limit_items(self, items, req): + raise NotImplementedError + + def _action_rebuild(self, info, request, instance_id): + raise NotImplementedError + + + def _items(self, req, is_detail): """Returns a list of servers for a given user. -- cgit From 5a3e8eea45bc11978112e3fed93768a1daf71530 Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Thu, 5 May 2011 16:29:31 -0400 Subject: Added interface function to ViewBilder --- nova/api/openstack/flavors.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nova/api') diff --git a/nova/api/openstack/flavors.py b/nova/api/openstack/flavors.py index 40787bd17..dee70bb2b 100644 --- a/nova/api/openstack/flavors.py +++ b/nova/api/openstack/flavors.py @@ -45,6 +45,9 @@ class Controller(common.OpenstackController): items = self._get_flavors(req, is_detail=True) return dict(flavors=items) + def _get_view_builder(self, req): + raise NotImplementedError + def _get_flavors(self, req, is_detail=True): """Helper function that returns a list of flavor dicts.""" ctxt = req.environ['nova.context'] -- cgit From bbb2bba0f05493ec40c70279b532b26a4a4c235c Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Fri, 6 May 2011 10:48:11 -0400 Subject: Added stub function for a referenced, previously non-existant function --- nova/api/ec2/cloud.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nova/api') diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 092b80fa2..40ae06750 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -366,6 +366,9 @@ class CloudController(object): g['ipPermissions'] += [r] return g + def _get_instance(instance_id): + raise NotImplementedError + def _revoke_rule_args_to_dict(self, context, to_port=None, from_port=None, ip_protocol=None, cidr_ip=None, user_id=None, source_security_group_name=None, -- cgit From 2946a21f78e4fd2b18bd6eb8c85eb2cc0c764f8a Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Fri, 6 May 2011 14:13:27 -0400 Subject: Added interface functions --- nova/api/ec2/cloud.py | 2 +- nova/api/openstack/servers.py | 14 ++++++-------- nova/api/openstack/views/limits.py | 9 +++++++++ 3 files changed, 16 insertions(+), 9 deletions(-) (limited to 'nova/api') diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 40ae06750..9aa4e7778 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -367,7 +367,7 @@ class CloudController(object): return g def _get_instance(instance_id): - raise NotImplementedError + raise NotImplementedError() def _revoke_rule_args_to_dict(self, context, to_port=None, from_port=None, ip_protocol=None, cidr_ip=None, user_id=None, diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index 1d3eab65b..2bf405545 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -76,24 +76,22 @@ class Controller(common.OpenstackController): return self._items(req, is_detail=True) def _image_id_from_req_data(self, data): - raise NotImplementedError + raise NotImplementedError() def _flavor_id_from_req_data(self, data): - raise NotImplementedError + raise NotImplementedError() def _get_view_builder(self, req): - raise NotImplementedError + raise NotImplementedError() def _limit_items(self, items, req): - raise NotImplementedError + raise NotImplementedError() def _limit_items(self, items, req): - raise NotImplementedError + raise NotImplementedError() def _action_rebuild(self, info, request, instance_id): - raise NotImplementedError - - + raise NotImplementedError() def _items(self, req, is_detail): """Returns a list of servers for a given user. diff --git a/nova/api/openstack/views/limits.py b/nova/api/openstack/views/limits.py index 552db39ee..22d1c260d 100644 --- a/nova/api/openstack/views/limits.py +++ b/nova/api/openstack/views/limits.py @@ -23,6 +23,15 @@ from nova.api.openstack import common class ViewBuilder(object): """Openstack API base limits view builder.""" + def _build_rate_limits(self, rate_limits): + raise NotImplementedError() + + def _build_rate_limit(self, rate_limit): + raise NotImplementedError() + + def _build_absolute_limits(self, absolute_limit): + raise NotImplementedError() + def build(self, rate_limits, absolute_limits): rate_limits = self._build_rate_limits(rate_limits) absolute_limits = self._build_absolute_limits(absolute_limits) -- cgit From 3a7d1422d52f551e870542305ce9bab9e9e6ebad Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Fri, 6 May 2011 16:13:35 -0400 Subject: Fixed method in flavors --- nova/api/openstack/flavors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/api') diff --git a/nova/api/openstack/flavors.py b/nova/api/openstack/flavors.py index dee70bb2b..4c5971cf6 100644 --- a/nova/api/openstack/flavors.py +++ b/nova/api/openstack/flavors.py @@ -46,7 +46,7 @@ class Controller(common.OpenstackController): return dict(flavors=items) def _get_view_builder(self, req): - raise NotImplementedError + raise NotImplementedError() def _get_flavors(self, req, is_detail=True): """Helper function that returns a list of flavor dicts.""" -- cgit From e1cfa28fc9e1194bbd4c9ce9c2f06ea3f6e5548e Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Fri, 6 May 2011 16:48:38 -0400 Subject: Fixed duplicate function --- nova/api/openstack/servers.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index 2bf405545..71cb31c72 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -87,9 +87,6 @@ class Controller(common.OpenstackController): def _limit_items(self, items, req): raise NotImplementedError() - def _limit_items(self, items, req): - raise NotImplementedError() - def _action_rebuild(self, info, request, instance_id): raise NotImplementedError() -- cgit From 43fa5afac9e5af74e2e3977a5dafd9640d064cf1 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Wed, 11 May 2011 15:12:12 +0000 Subject: Abstract out IPv6 address generation to pluggable backends --- nova/api/ec2/cloud.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nova/api') diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 092b80fa2..993c91fe1 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -39,6 +39,7 @@ from nova import log as logging from nova import network from nova import utils from nova import volume +from nova import ipv6 from nova.api.ec2 import ec2utils from nova.compute import instance_types from nova.image import s3 @@ -718,7 +719,7 @@ class CloudController(object): fixed = instance['fixed_ip'] floating_addr = fixed['floating_ips'][0]['address'] if instance['fixed_ip']['network'] and 'use_v6' in kwargs: - i['dnsNameV6'] = utils.to_global_ipv6( + i['dnsNameV6'] = ipv6.to_global( instance['fixed_ip']['network']['cidr_v6'], instance['mac_address']) -- cgit From d2b8350a026e0f00eae7cadbacaa15d4b44331af Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Wed, 11 May 2011 21:04:40 +0000 Subject: Implement IPv6 address generation that includes account identifier --- nova/api/ec2/cloud.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nova/api') diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 1b51b5463..63baf8036 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -721,7 +721,8 @@ class CloudController(object): if instance['fixed_ip']['network'] and 'use_v6' in kwargs: i['dnsNameV6'] = ipv6.to_global( instance['fixed_ip']['network']['cidr_v6'], - instance['mac_address']) + instance['mac_address'], + instance['project_id']) i['privateDnsName'] = fixed_addr i['privateIpAddress'] = fixed_addr -- cgit From 1aad930383fa425b88e59929aa1698e31978eb62 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Thu, 12 May 2011 22:19:52 +0000 Subject: Make sure imports are in alphabetical order --- nova/api/ec2/cloud.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/api') diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 63baf8036..1fa07d042 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -35,11 +35,11 @@ from nova import crypto from nova import db from nova import exception from nova import flags +from nova import ipv6 from nova import log as logging from nova import network from nova import utils from nova import volume -from nova import ipv6 from nova.api.ec2 import ec2utils from nova.compute import instance_types from nova.image import s3 -- cgit From 262dec736fa6ef54a1101a0a17671ff2a19cbd95 Mon Sep 17 00:00:00 2001 From: Nirmal Ranganathan Date: Mon, 16 May 2011 11:12:16 -0500 Subject: Added the imageRef and flavorRef attributes in the xml deserialization --- nova/api/openstack/servers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index 3cf78e32c..1289c1e0a 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -746,8 +746,9 @@ class ServerCreateRequestXMLDeserializer(object): """Marshal the server attribute of a parsed request""" server = {} server_node = self._find_first_child_named(node, 'server') - for attr in ["name", "imageId", "flavorId"]: - server[attr] = server_node.getAttribute(attr) + for attr in ["name", "imageId", "flavorId", "imageRef", "flavorRef"]: + if server_node.getAttribute(attr): + server[attr] = server_node.getAttribute(attr) metadata = self._extract_metadata(server_node) if metadata is not None: server["metadata"] = metadata -- cgit From e7f699706089919274055fc5c57c276f36d7a301 Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Mon, 16 May 2011 14:02:56 -0400 Subject: Removed obsolete method and test --- nova/api/ec2/cloud.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'nova/api') diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 9aa4e7778..092b80fa2 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -366,9 +366,6 @@ class CloudController(object): g['ipPermissions'] += [r] return g - def _get_instance(instance_id): - raise NotImplementedError() - def _revoke_rule_args_to_dict(self, context, to_port=None, from_port=None, ip_protocol=None, cidr_ip=None, user_id=None, source_security_group_name=None, -- cgit From 11a36377f81f6f4c6c20e5802aa91e472772fbc9 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Tue, 17 May 2011 11:31:09 -0700 Subject: make token use typo that is in database. Also fix now -> utcnow and stop using . syntax for dealing with tokens --- nova/api/openstack/auth.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py index 311e6bde9..7ccd46f54 100644 --- a/nova/api/openstack/auth.py +++ b/nova/api/openstack/auth.py @@ -17,7 +17,6 @@ import datetime import hashlib -import json import time import webob.exc @@ -25,11 +24,9 @@ import webob.dec from nova import auth from nova import context -from nova import db from nova import exception from nova import flags from nova import log as logging -from nova import manager from nova import utils from nova import wsgi from nova.api.openstack import faults @@ -102,11 +99,13 @@ class AuthMiddleware(wsgi.Middleware): token, user = self._authorize_user(username, key, req) if user and token: res = webob.Response() - res.headers['X-Auth-Token'] = token.token_hash + res.headers['X-Auth-Token'] = token['token_hash'] + # NOTE(vish): the apparrent typo in manageent is actually how it + # is in the db res.headers['X-Server-Management-Url'] = \ - token.server_management_url - res.headers['X-Storage-Url'] = token.storage_url - res.headers['X-CDN-Management-Url'] = token.cdn_management_url + token['server_manageent_url'] + res.headers['X-Storage-Url'] = token['storage_url'] + res.headers['X-CDN-Management-Url'] = token['cdn_management_url'] res.content_type = 'text/plain' res.status = '204' LOG.debug(_("Successfully authenticated '%s'") % username) @@ -130,11 +129,11 @@ class AuthMiddleware(wsgi.Middleware): except exception.NotFound: return None if token: - delta = datetime.datetime.now() - token.created_at + delta = datetime.datetime.utcnow() - token['created_at'] if delta.days >= 2: - self.db.auth_token_destroy(ctxt, token.token_hash) + self.db.auth_token_destroy(ctxt, token['token_hash']) else: - return self.auth.get_user(token.user_id) + return self.auth.get_user(token['user_id']) return None def _authorize_user(self, username, key, req): @@ -159,7 +158,7 @@ class AuthMiddleware(wsgi.Middleware): token_dict['token_hash'] = token_hash token_dict['cdn_management_url'] = '' os_url = req.url - token_dict['server_management_url'] = os_url + token_dict['server_manageent_url'] = os_url token_dict['storage_url'] = '' token_dict['user_id'] = user.id token = self.db.auth_token_create(ctxt, token_dict) -- cgit From 91e96cea27c91190f6205defa1f5a3641a0e0f56 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Tue, 17 May 2011 12:12:48 -0700 Subject: add migration for proper name --- nova/api/openstack/auth.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py index 7ccd46f54..6c6ee22a2 100644 --- a/nova/api/openstack/auth.py +++ b/nova/api/openstack/auth.py @@ -100,10 +100,8 @@ class AuthMiddleware(wsgi.Middleware): if user and token: res = webob.Response() res.headers['X-Auth-Token'] = token['token_hash'] - # NOTE(vish): the apparrent typo in manageent is actually how it - # is in the db res.headers['X-Server-Management-Url'] = \ - token['server_manageent_url'] + token['server_management_url'] res.headers['X-Storage-Url'] = token['storage_url'] res.headers['X-CDN-Management-Url'] = token['cdn_management_url'] res.content_type = 'text/plain' @@ -158,7 +156,7 @@ class AuthMiddleware(wsgi.Middleware): token_dict['token_hash'] = token_hash token_dict['cdn_management_url'] = '' os_url = req.url - token_dict['server_manageent_url'] = os_url + token_dict['server_management_url'] = os_url token_dict['storage_url'] = '' token_dict['user_id'] = user.id token = self.db.auth_token_create(ctxt, token_dict) -- cgit