[openstack-nova/el6: 5/7] Updated patches from f16-patches

Russell Bryant russellb at fedoraproject.org
Thu Mar 29 18:28:48 UTC 2012


commit 7d800bf9080e2f5c2f43a702479c236b3b03af96
Author: Russell Bryant <rbryant at redhat.com>
Date:   Thu Mar 29 14:07:34 2012 -0400

    Updated patches from f16-patches

 ...d-validation-for-OSAPI-server-name-length.patch |   65 ++++++++++++++++++++
 openstack-nova.spec                                |    2 +
 2 files changed, 67 insertions(+), 0 deletions(-)
---
diff --git a/0012-Add-validation-for-OSAPI-server-name-length.patch b/0012-Add-validation-for-OSAPI-server-name-length.patch
new file mode 100644
index 0000000..0703452
--- /dev/null
+++ b/0012-Add-validation-for-OSAPI-server-name-length.patch
@@ -0,0 +1,65 @@
+From 6a46582bee253abbbf1f2fd3d64e950fedf04975 Mon Sep 17 00:00:00 2001
+From: Dan Prince <dprince at redhat.com>
+Date: Thu, 29 Mar 2012 10:46:59 -0400
+Subject: [PATCH] Add validation for OSAPI server name length.
+
+Diablo Fix for LP Bug #962515.
+
+Change-Id: Ifa1ca56a33ca517679fa80bfd10b962eeebe3a76
+---
+ nova/api/openstack/create_instance_helper.py |    4 ++++
+ nova/tests/api/openstack/test_servers.py     |   19 +++++++++++++++++++
+ 2 files changed, 23 insertions(+), 0 deletions(-)
+
+diff --git a/nova/api/openstack/create_instance_helper.py b/nova/api/openstack/create_instance_helper.py
+index e27ddf7..117dc89 100644
+--- a/nova/api/openstack/create_instance_helper.py
++++ b/nova/api/openstack/create_instance_helper.py
+@@ -248,6 +248,10 @@ class CreateInstanceHelper(object):
+             msg = _("Server name is an empty string")
+             raise exc.HTTPBadRequest(explanation=msg)
+ 
++        if not len(value) < 256:
++            msg = _("Server name must be less than 256 characters.")
++            raise exc.HTTPBadRequest(explanation=msg)
++
+     def _get_kernel_ramdisk_from_image(self, req, image_service, image_id):
+         """Fetch an image from the ImageService, then if present, return the
+         associated kernel and ramdisk image IDs.
+diff --git a/nova/tests/api/openstack/test_servers.py b/nova/tests/api/openstack/test_servers.py
+index 6412654..c90a3c9 100644
+--- a/nova/tests/api/openstack/test_servers.py
++++ b/nova/tests/api/openstack/test_servers.py
+@@ -2294,6 +2294,16 @@ class ServersTest(test.TestCase):
+         self.assertEqual(res_dict['server']['id'], 1)
+         self.assertEqual(res_dict['server']['name'], 'server_test')
+ 
++    def test_update_server_name_too_long_v1_1(self):
++        self.stubs.Set(nova.db.api, 'instance_get',
++                return_server_with_attributes(name='server_test'))
++        req = webob.Request.blank('/v1.1/fake/servers/1')
++        req.method = 'PUT'
++        req.content_type = 'application/json'
++        req.body = json.dumps({'server': {'name': 'x' * 256}})
++        res = req.get_response(fakes.wsgi_app())
++        self.assertEqual(res.status_int, 400)
++
+     def test_update_server_access_ipv4_v1_1(self):
+         self.stubs.Set(nova.db.api, 'instance_get',
+                 return_server_with_attributes(access_ipv4='0.0.0.0'))
+@@ -3634,6 +3644,15 @@ class TestServerInstanceCreation(test.TestCase):
+         self.assertEquals(server.nodeName, 'server')
+         self.assertEqual(16, len(server.getAttribute('adminPass')))
+ 
++    def test_create_instance_with_name_too_long(self):
++        personality = None
++        body_dict = self._create_personality_request_dict(personality)
++        body_dict['server']['name'] = 'X' * 256
++        request = self._get_create_request_json(body_dict)
++        compute_api, response = \
++            self._run_create_instance_with_mock_compute_api(request)
++        self.assertEquals(response.status_int, 400)
++
+ 
+ class TestGetKernelRamdiskFromImage(test.TestCase):
+     """
diff --git a/openstack-nova.spec b/openstack-nova.spec
index 290ddc8..b53a5cd 100644
--- a/openstack-nova.spec
+++ b/openstack-nova.spec
@@ -41,6 +41,7 @@ Patch0008: 0008-Bug-898257-abstract-out-disk-image-access-methods.patch
 Patch0009: 0009-Bug-898257-support-handling-images-with-libguestfs.patch
 Patch0010: 0010-Fix-libguestfs-operation-with-specified-partitions.patch
 Patch0011: 0011-Ensure-we-don-t-access-the-net-when-building-docs.patch
+Patch0012: 0012-Add-validation-for-OSAPI-server-name-length.patch
 
 BuildArch:        noarch
 BuildRequires:    intltool
@@ -184,6 +185,7 @@ This package contains documentation files for nova.
 %patch0009 -p1
 %patch0010 -p1
 %patch0011 -p1
+%patch0012 -p1
 
 find . \( -name .gitignore -o -name .placeholder \) -delete
 


More information about the scm-commits mailing list