Merge Bexar r56

This commit is contained in:
jaypipes@gmail.com 2011-01-27 14:01:02 -06:00
commit 7d314e6039
21 changed files with 142 additions and 66 deletions

View File

@ -5,17 +5,17 @@
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Glance API Server

View File

@ -3,19 +3,21 @@
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Reference implementation server for Glance Registry
"""

View File

@ -120,7 +120,7 @@ pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
modindex_common_prefix = ['glance.']
# -- Options for man page output ----------------------------------------------
# -- Options for man page output --------------------------------------------
# Grouping the document tree for man pages.
# List of tuples 'sourcefile', 'target', u'title', u'Authors name', 'manual'

View File

@ -0,0 +1,16 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -1,6 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack, LLC
# Copyright 2010-2011 OpenStack, LLC
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@ -0,0 +1,16 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -1,8 +1,8 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2010-2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -16,6 +16,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
DB abstraction for Nova and Glance
"""

View File

@ -0,0 +1,16 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -15,6 +15,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Session Handling for SQLAlchemy backend
"""

View File

@ -1,8 +1,8 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2010-2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -16,6 +16,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
DB abstraction for Nova and Glance
"""

View File

@ -2,6 +2,7 @@
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2010-2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -15,6 +16,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Defines interface for DB access
"""

View File

@ -2,6 +2,7 @@
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -15,6 +16,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Implementation of SQLAlchemy backend
"""

View File

@ -1,6 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack LLC.
# Copyright 2010-2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@ -0,0 +1,16 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -1,6 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack, LLC
# Copyright 2010-2011 OpenStack, LLC
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -136,7 +136,6 @@ def stub_out_s3_backend(stubs):
def chunk_it():
for i in xrange(0, len(cls.DATA), cls.CHUNK_SIZE):
yield cls.DATA[i:i + cls.CHUNK_SIZE]
return chunk_it()
fake_swift_backend = FakeS3Backend()
@ -202,8 +201,7 @@ def stub_out_registry(stubs):
DATA = \
{'files': [
{'location': 'file:///chunk0', 'size': 12345},
{'location': 'file:///chunk1', 'size': 1235}
]}
{'location': 'file:///chunk1', 'size': 1235}]}
@classmethod
def lookup(cls, _parsed_uri):

View File

@ -0,0 +1,16 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -1,6 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack, LLC
# Copyright 2010-2011 OpenStack, LLC
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -88,8 +88,8 @@ class TestRegistryAPI(unittest.TestCase):
'name': 'fake image #2',
'is_public': True,
'type': 'kernel',
'status': 'active'
}
'status': 'active'}
req = webob.Request.blank('/images/detail')
res = req.get_response(rserver.API())
res_dict = json.loads(res.body)
@ -105,8 +105,7 @@ class TestRegistryAPI(unittest.TestCase):
"""Tests that the /images POST registry API creates the image"""
fixture = {'name': 'fake public image',
'is_public': True,
'type': 'kernel'
}
'type': 'kernel'}
req = webob.Request.blank('/images')
@ -134,8 +133,7 @@ class TestRegistryAPI(unittest.TestCase):
'name': 'fake public image',
'is_public': True,
'type': 'kernel',
'status': 'bad status'
}
'status': 'bad status'}
req = webob.Request.blank('/images')
@ -151,8 +149,7 @@ class TestRegistryAPI(unittest.TestCase):
def test_update_image(self):
"""Tests that the /images PUT registry API updates the image"""
fixture = {'name': 'fake public image #2',
'type': 'ramdisk'
}
'type': 'ramdisk'}
req = webob.Request.blank('/images/2')
@ -175,8 +172,7 @@ class TestRegistryAPI(unittest.TestCase):
'name': 'fake public image',
'is_public': True,
'type': 'kernel',
'status': 'bad status'
}
'status': 'bad status'}
req = webob.Request.blank('/images/3')

View File

@ -1,6 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack, LLC
# Copyright 2010-2011 OpenStack, LLC
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -161,15 +161,13 @@ class TestRegistryClient(unittest.TestCase):
'type': 'kernel',
'size': 19,
'location': "file:///tmp/glance-tests/2",
'properties': {'distro': 'Ubuntu 10.04 LTS'}
}
'properties': {'distro': 'Ubuntu 10.04 LTS'}}
expected = {'name': 'fake public image',
'is_public': True,
'type': 'kernel',
'size': 19,
'location': "file:///tmp/glance-tests/2",
'properties': {'distro': 'Ubuntu 10.04 LTS'}
}
'properties': {'distro': 'Ubuntu 10.04 LTS'}}
new_image = self.client.add_image(fixture)
@ -216,8 +214,7 @@ class TestRegistryClient(unittest.TestCase):
def test_update_image(self):
"""Tests that the /images PUT registry API updates the image"""
fixture = {'name': 'fake public image #2',
'type': 'ramdisk'
}
'type': 'ramdisk'}
self.assertTrue(self.client.update_image(2, fixture))
@ -233,7 +230,7 @@ class TestRegistryClient(unittest.TestCase):
'name': 'fake public image',
'is_public': True,
'type': 'kernel',
'status': 'bad status'
'status': 'bad status',
}
self.assertRaises(exception.NotFound,
@ -386,9 +383,8 @@ class TestClient(unittest.TestCase):
"""Tests client returns image as queued"""
fixture = {'name': 'fake public image',
'is_public': True,
'type': 'kernel'
'type': 'kernel',
}
image_meta = self.client.add_image(fixture)
self.assertEquals('queued', image_meta['status'])
self.assertEquals(0, image_meta['size'])
@ -401,7 +397,6 @@ class TestClient(unittest.TestCase):
'size': 19,
'location': "file:///tmp/glance-tests/2",
}
new_image = self.client.add_image(fixture)
new_image_id = new_image['id']
@ -425,16 +420,15 @@ class TestClient(unittest.TestCase):
'type': 'kernel',
'size': 19,
'location': "file:///tmp/glance-tests/2",
'properties': {'distro': 'Ubuntu 10.04 LTS'}
'properties': {'distro': 'Ubuntu 10.04 LTS'},
}
expected = {'name': 'fake public image',
'is_public': True,
'type': 'kernel',
'size': 19,
'location': "file:///tmp/glance-tests/2",
'properties': {'distro': 'Ubuntu 10.04 LTS'}
'properties': {'distro': 'Ubuntu 10.04 LTS'},
}
new_image = self.client.add_image(fixture)
new_image_id = new_image['id']
@ -485,7 +479,7 @@ class TestClient(unittest.TestCase):
'is_public': True,
'type': 'kernel',
'size': 19,
'properties': {'distro': 'Ubuntu 10.04 LTS'}
'properties': {'distro': 'Ubuntu 10.04 LTS'},
}
image_data_fixture = r"chunk00000remainder"
@ -510,7 +504,7 @@ class TestClient(unittest.TestCase):
'is_public': True,
'type': 'kernel',
'size': 19,
'properties': {'distro': 'Ubuntu 10.04 LTS'}
'properties': {'distro': 'Ubuntu 10.04 LTS'},
}
image_data_fixture = r"chunk00000remainder"
@ -546,7 +540,7 @@ class TestClient(unittest.TestCase):
fixture = {'name': 'fake public image',
'is_public': True,
'type': 'kernel',
'properties': {'distro': 'Ubuntu 10.04 LTS'}
'properties': {'distro': 'Ubuntu 10.04 LTS'},
}
image_data_fixture = r"chunk00000remainder"
@ -574,7 +568,7 @@ class TestClient(unittest.TestCase):
'type': 'kernel',
'size': 19,
'store': 'bad',
'properties': {'distro': 'Ubuntu 10.04 LTS'}
'properties': {'distro': 'Ubuntu 10.04 LTS'},
}
image_data_fixture = r"chunk00000remainder"
@ -587,7 +581,7 @@ class TestClient(unittest.TestCase):
def test_update_image(self):
"""Tests that the /images PUT registry API updates the image"""
fixture = {'name': 'fake public image #2',
'type': 'ramdisk'
'type': 'ramdisk',
}
self.assertTrue(self.client.update_image(2, fixture))
@ -604,7 +598,7 @@ class TestClient(unittest.TestCase):
'name': 'fake public image',
'is_public': True,
'type': 'kernel',
'status': 'bad status'
'status': 'bad status',
}
self.assertRaises(exception.NotFound,

View File

@ -1,6 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack, LLC
# Copyright 2010-2011 OpenStack, LLC
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -80,7 +80,7 @@ class TestImageController(unittest.TestCase):
'name': 'fake image #2',
'is_public': True,
'type': 'kernel',
'status': 'active'
'status': 'active',
}
req = webob.Request.blank('/images/detail')
res = req.get_response(server.API())
@ -97,7 +97,7 @@ class TestImageController(unittest.TestCase):
"""Tests that the /images POST registry API creates the image"""
fixture = {'name': 'fake public image',
'is_public': True,
'type': 'kernel'
'type': 'kernel',
}
req = webob.Request.blank('/images')
@ -126,7 +126,7 @@ class TestImageController(unittest.TestCase):
'name': 'fake public image',
'is_public': True,
'type': 'kernel',
'status': 'bad status'
'status': 'bad status',
}
req = webob.Request.blank('/images')
@ -143,7 +143,7 @@ class TestImageController(unittest.TestCase):
def test_update_image(self):
"""Tests that the /images PUT registry API updates the image"""
fixture = {'name': 'fake public image #2',
'type': 'ramdisk'
'type': 'ramdisk',
}
req = webob.Request.blank('/images/2')
@ -167,7 +167,7 @@ class TestImageController(unittest.TestCase):
'name': 'fake public image',
'is_public': True,
'type': 'kernel',
'status': 'bad status'
'status': 'bad status',
}
req = webob.Request.blank('/images/3')

View File

@ -1,6 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack, LLC
# Copyright 2010-2011 OpenStack, LLC
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -107,7 +107,6 @@ class TestS3Backend(TestBackend):
class TestSwiftBackend(TestBackend):
def setUp(self):
super(TestSwiftBackend, self).setUp()
stubs.stub_out_swift_backend(self.stubs)

View File

@ -4,7 +4,7 @@
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2010 OpenStack, LLC
# Copyright 2010 OpenStack LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -33,7 +33,7 @@ PIP_REQUIRES = os.path.join(ROOT, 'tools', 'pip-requires')
def die(message, *args):
print >>sys.stderr, message % args
print >> sys.stderr, message % args
sys.exit(1)