From 6b47f87c9e22fa09cedc3e48b7c8dcf52b5d016a Mon Sep 17 00:00:00 2001 From: Tushar Patil Date: Tue, 19 Jul 2011 17:35:44 -0700 Subject: Fixed broken unit testcases after adding extension and minor code refactoring --- nova/api/openstack/contrib/createserverext.py | 11 ++++++++++- nova/api/openstack/create_instance_helper.py | 9 --------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/contrib/createserverext.py b/nova/api/openstack/contrib/createserverext.py index e8fe9afad..78dba425a 100644 --- a/nova/api/openstack/contrib/createserverext.py +++ b/nova/api/openstack/contrib/createserverext.py @@ -137,6 +137,15 @@ class CreateInstanceHelperEx(helper.CreateInstanceHelper): # Let the caller deal with unhandled exceptions. + def _validate_fixed_ip(self, value): + if not isinstance(value, basestring): + msg = _("Fixed IP is not a string or unicode") + raise exc.HTTPBadRequest(explanation=msg) + + if value.strip() == '': + msg = _("Fixed IP is an empty string") + raise exc.HTTPBadRequest(explanation=msg) + def _get_requested_networks(self, requested_networks): """ Create a list of requested networks from the networks attribute @@ -202,7 +211,7 @@ class Createserverext(extensions.ExtensionDescriptor): return "Extended support to the Create Server v1.1 API" def get_namespace(self): - return "http://docs.openstack.org/ext/serverscreateext/api/v1.1" + return "http://docs.openstack.org/ext/createserverext/api/v1.1" def get_updated(self): return "2011-07-19T00:00:00+00:00" diff --git a/nova/api/openstack/create_instance_helper.py b/nova/api/openstack/create_instance_helper.py index 8579c45df..fba0cb8ba 100644 --- a/nova/api/openstack/create_instance_helper.py +++ b/nova/api/openstack/create_instance_helper.py @@ -193,15 +193,6 @@ class CreateInstanceHelper(object): msg = _("Server name is an empty string") raise exc.HTTPBadRequest(explanation=msg) - def _validate_fixed_ip(self, value): - if not isinstance(value, basestring): - msg = _("Fixed IP is not a string or unicode") - raise exc.HTTPBadRequest(explanation=msg) - - if value.strip() == '': - msg = _("Fixed IP is an empty string") - raise exc.HTTPBadRequest(explanation=msg) - def _get_kernel_ramdisk_from_image(self, req, image_id): """Fetch an image from the ImageService, then if present, return the associated kernel and ramdisk image IDs. -- cgit