summaryrefslogtreecommitdiffstats
path: root/nova/tests/image
Commit message (Collapse)AuthorAgeFilesLines
* Fix EC2 RegisterImage ImageLocation starts with /Avinash Prasad2013-05-281-5/+28
| | | | | | | | | * Allows image location that begins with '/' during EC2 image register * Adds relevant unit test Fixes LP bug #1074908 Change-Id: I488b126c2079de4370823b347e80c7ec1ecc2c9f
* Fix flakey TestS3ImageService bugChris Yeoh2013-04-291-1/+1
| | | | | | | | | | | | test_show_translates_image_state_correctly sometimes fails on some systems. This is caused because the ec2utils cache is reset after the test rather than before the test (but after the images are manually added to the db in setUp). This change resets the ec2utils cache in the correct place Fixes bug 1174266 Change-Id: I2ff9b71c932c913ca0423b1de4c04ca7d9de59cf
* Map internal S3 image state to EC2 API valuesChris Yeoh2013-04-181-1/+36
| | | | | | | | | | Fixes the EC2 API so it maps internal S3 image state values to ones defined by the EC2 API rather than returning the internally used values. Fixes bug #1074904 Change-Id: Iabbda0e5fcbe4d572c76367c6f98d4bece050e73
* Reset ec2 image cache between S3 tests.Dan Prince2013-03-221-0/+2
| | | | | | | | | | | | We recently introduced EC2 image caching in 2865a76. On some python 2.6 distros I'm now seeing nova.tests.image.test_s3 failures caused by test ordering issues. Tests appear to reuse IDs and this can cause issue if we don't clear the cache in tearDown. Fixes LP Bug #1158935. Change-Id: Ifeedaf7a784b787de95d2f36394216cf7c94c5f4
* delete deleted image 500 bugBrant Knudson2013-03-051-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes bug 1138666 When you delete an image that you just deleted, you get a 500 Internal Server Error. In this case, the problem isn't an internal server error but the "unauthorized" response from the image service is not expected. This can be recreated with devstack: 1) delete an image 2) delete the same image Here's an example: $ nova image-list +--------------------------------------+---------------------------------+--------+--------+ | ID | Name | Status | Server | +--------------------------------------+---------------------------------+--------+--------+ | caa6c969-0f32-466b-8e8e-a7e0ac835470 | cirros-0.3.1-x86_64-uec | ACTIVE | | | 8af603da-b69f-49c6-8e52-25632eccb31c | cirros-0.3.1-x86_64-uec-kernel | ACTIVE | | | fe67d4e1-baca-4968-8638-2314373b620b | cirros-0.3.1-x86_64-uec-ramdisk | ACTIVE | | +--------------------------------------+---------------------------------+--------+--------+ $ nova image-delete caa6c969-0f32-466b-8e8e-a7e0ac835470 $ nova image-delete caa6c969-0f32-466b-8e8e-a7e0ac835470 ERROR: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-1254f8a5-8dda-444a-a077-2072ab3baa6a) If you delete a deleted image, the server should respond with '403 Forbidden' because the image still exists and no user is allowed to delete a deleted image. The fix is to catch the exception from the image service and convert it to a wsgi exception for '403 Forbidden'. Change-Id: I2f14687d5468b67389f5dd6ab338ceb54e8a29bb
* Update OpenStack LLC to FoundationKurt Taylor2013-02-264-4/+4
| | | | | | Update all references of "LLC" to "Foundation". Change-Id: I009e86784ef4dcf38882d64b0eff484576e04efe
* Merge "Add an extension to show image size."Jenkins2013-02-212-1/+9
|\
| * Add an extension to show image size.Andrew Laski2013-02-192-1/+9
| | | | | | | | | | | | | | | | | | | | Adds image size data that is returned from Glance into the API response. This becomes really useful for users when they take a snapshot and want to track the storage used by it. Since this information is already being pulled by Nova we should display it. DocImpact Change-Id: I8a2d4001c21bcc54cac1a2992034dfc9fbe39d7e
* | Use oslo-config-2013.1b4Mark McLoughlin2013-02-192-3/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | The cfg API is now available via the oslo-config library, so switch to it and remove the copied-and-pasted version. Add the 2013.1b4 tarball to tools/pip-requires - this will be changed to 'oslo-config>=2013.1' when oslo-config is published to pypi. This will happen in time for grizzly final. Add dependency_links to setup.py so that oslo-config can be installed from the tarball URL specified in pip-requires. Remove the 'deps = pep8==1.3.3' from tox.ini as it means all the other deps get installed with easy_install which can't install oslo-config from the URL. Make tools/hacking.py include oslo in IMPORT_EXCEPTIONS like it already does for paste. It turns out imp.find_module() doesn't correct handle namespace packages. Retain dummy cfg.py file until keystoneclient middleware has been updated (I18c450174277c8e2d15ed93879da6cd92074c27a). Change-Id: I4815aeb8a9341a31a250e920157f15ee15cfc5bc
* Removed print stmts in test casesGiampaolo Lauria2013-01-291-1/+0
| | | | | | Fixes bug 1108978 Change-Id: I5113e67bad1aaafdbaa0adc202cac97ba8d0dfdb
* fix misspellings in logs, comments and testsPádraig Brady2013-01-211-2/+2
| | | | | | | | Flagged with: https://github.com/lyda/misspell-check Run with: git ls-files | misspellings -f - Fixes bug: 1100083 Change-Id: Icf1f844fea8ad0a1101d1dc64b9a126608e9536e
* Directly copy a file URL from glance.John Bresnahan2013-01-181-0/+37
| | | | | | | | | | | | | | | | | | | | | | That patch allows nova to use shutil to copy a file directly from the glance store. For this to work glance needs to enable direct_url descriptions in the image metadata. This is done by setting show_image_direct_url to True in glance-api.conf. The path used to back glance also must match the path used to back nova instance storage. This should be a large performance increase for the cases where both glance and nova instance storage are backed by a shared file system like gluster or ceph. A new option has been added to nova: allowed_direct_url_schemes This option is set to a list of schemes that can be directly accessed. For this first simple patch only file:// is valid, and the implementation is simple and inline. In the future it would be better to make this into propagation modules which are dynamically loaded according to the scheme. DocImpact Implements: blueprint direct-file-copy Change-Id: I041b5524f8a0ea59e89ece0202f0503abf2f9d8e
* fix N402 for nova/testsSean Dague2013-01-092-3/+3
| | | | | | | | | convert docstrings on test_ functions to comments to prevent the function name from being masked by test infrastructure convert the rest of the docstrings to end in punctuation as per N401 Change-Id: Ib400537c6f7feb30739207a627b5aac3a7eb165a
* Move global glance opts into nova.image.glanceMark McLoughlin2013-01-081-0/+17
| | | | | | | | | | | | Move the glance_host, glance_port and glance_protocol options into the nova.image.glance module. Also move the generate_glance_url() and generate_image_url() utility methods there since they're the only uses of the options outside of the module. blueprint: scope-config-opts Change-Id: I3beca1a65cdd902a94ddc1c512d79a4de635ef38
* Use testr to run nova unittests.Clark Boylan2012-12-141-0/+3
| | | | | | | | | | | | | | | | | | | | Convert nova from using nosetests to testr for its test runner. Some tests had to be modified to get them to run properly under testr. run_tests.sh has been updated to run testr instead of nosetests. Coverage is collected by running subunit.run under coverage.py when the coverage environment is selected. Note that you will need to rebuild your virtualenvs as nose is being removed from the dependency lists and is being replaced by testr. Tests will run in different processes once this test is merged so you cannot use test classes to pass information between tests. Each test should be a proper independent unit. Additionally the -x and -d flags to run_tests.sh have been removed as there are currently no decent approximations for those functions. Change-Id: I019ca098972ca749b195f59968cf21edd5ba9109
* Move compute opts from nova.configMark McLoughlin2012-11-211-1/+1
| | | | | | | | | A bunch of config options are declared in nova.config but only used in nova.compute.api or nova.compute.manager. Move them to the module which uses them. blueprint: scope-config-opts Change-Id: Id33182e9276f61e799305b6b743d1a1f34f25625
* Use CONF.import_opt() for nova.config optsMark McLoughlin2012-11-201-1/+1
| | | | | | | | | | | | | The only reason for importing nova.config now is where one of the options defined in that file is needed. Rather than importing nova.config using an import statement, use CONF.import_opt() so that it is clear which option we actually require. In future, we will move many options out of nova.config so many of these import_opt() calls will either go away or cause a module other than nova.config to be imported. Change-Id: I0646efddecdf2530903afd50c1f4364cb1d5dce1
* Remove nova.config.CONFMark McLoughlin2012-11-201-1/+2
| | | | | | | | | | | | | | | Modules import nova.config for two reasons right now - firstly, to reference nova.config.CONF and, secondly, if they use one of the options defined in nova.config. Often modules import nova.openstack.common.cfg and nova.config which is a bit pointless since they could just use cfg.CONF if they just want to nova.config in order to reference CONF. Let's just use cfg.CONF everywhere and we can explicitly state where we actually require options defined in nova.config. Change-Id: Ie4184a74e3e78c99658becb18dce1c2087e450bb
* Remove nova.flagsMark McLoughlin2012-11-171-1/+0
| | | | | | | | Now that options have all moved from nova.flags to nova.config, we can safely remove the nova.flags imports and replace them with nova.config imports. Change-Id: Ic077a72dd6419bbf1e1babe71acfa43c4e8b55c8
* Remove gen_uuid()Zhongyue Luo2012-11-141-2/+3
| | | | | | | Removed gen_uuid and uuid related unittests Replaced utils.gen_uuid() with uuid.uuid4() Change-Id: I3020a0d67525eb73cfb8873d2570c93e2022bb76
* Merge "Remove custom test assertions."Jenkins2012-11-131-5/+6
|\
| * Remove custom test assertions.Monty Taylor2012-11-101-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | Now that we testtools, We can use stock testtools assert methods instead of defining our own. As part of removing them, we add Matcher classes to use in the testtools.assertThat method. testtools matchers can be arbitrarily combined and chained, so give more flexibility than plain asserts Related to blueprint grizzly-testtools. Change-Id: I26d1dbac8dc3c322eb55c96c48330c0e38636107
* | Switch from FLAGS to CONF in testsMark McLoughlin2012-11-101-16/+14
|/ | | | | | | | | | | Use the global CONF variable instead of FLAGS. This is purely a cleanup since FLAGS is already just another reference to CONF. We leave the nova.flags imports until a later cleanup commit since removing them may cause unpredictable problems due to config options not being registered. Change-Id: Ic0168188dfe214fc81af04c8a9644d2d9f31600d
* Use testtools as the base testcase class.Monty Taylor2012-10-291-1/+1
| | | | | | | | | | | | As a step towards parallelizing the test runs, use testtools as the base unittest test case class. In this patch, it has caused us to catch places where setUp and tearDown were not being chained properly. Additionally, we get to remove our custom skip decorators and a few backported assert calls. Part of blueprint grizzly-testtools Change-Id: Ia2025e1b7191b65130b85b30ce6239d5c431c8ba
* add get_location method for imagesJosh Durgin2012-09-182-11/+15
| | | | | | | | | | | | | | | | | | | | This is useful for determining whether the backend storage for the image in Glance is the same as the storage used in a volume driver. The direct_url is only available in the v2 images API, so add a version parameter to each request. As more parts of the v2 API are used, this parameter will become more useful. Signed-off-by: Josh Durgin <josh.durgin@inktank.com> Conflicts: nova/image/glance.py This is based on a cherry-pick of cinder commit 171a57a6879683dac5f219a0e8f1080ea687105d Change-Id: I5ca06b6d80ffe4118f8dd381ed11283573bce71f
* Clean up handling of project_only in network_getVishvananda Ishaya2012-09-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | There was some funky logic for getting networks to work around the project only decorator. This changes the code to match what we actually want which is: In Flat and FlatDHCP mode non-admins should be able to access networks that belong to their project or networks that have no project_id assigned. In VlanManager, project_id=None projects should not be accessible as this means the project hasn't been assigned yet. The assignment is done with an elevated context. This patch adds some logic to model_query to allow None in the project_only filter and makes network_get_all_by_uuids and network_get use it. fixes bug 1048869 Change-Id: I5377cea87dec8e9d0d9cec84e07128c5c6e8dca3
* Allow connecting to a ssl-based glanceVincent Untz2012-08-271-13/+26
| | | | | | | | | | This introduces a new glance_api_insecure setting that can be used to not verify the certificate of the glance server against the certificate authorities. Fix bug 1042081. Change-Id: I0a9f081425854e9c01e00dfd641e42276c878c67
* Adds integration testing for api samplesVishvananda Ishaya2012-08-231-0/+4
| | | | | | | | | | | | | | | | We have no validation the the samples at api.openstack.org are actually correct. This creates a framework to validate the request and response samples through integration tests. Adds a bit of stubbing in fake_network to return simple network_info along with instance records and adds a call in image/fake to get av valid image. It will create non-templated versions of the samples when the tests are running if GENERATE_SAMPLES is set in the environment when running nova/tests/integrated/test_api_samples.py Change-Id: Id134af0b23f0d0932c8789697439ce94bbe2834b
* Make glance image service check base exception classesChris Behrens2012-08-211-2/+41
| | | | | | | | | | | | | Fixes bug 1039675 glanceclient can raise HTTPNotFound (as well as NotFound) it appears, but glance image service is only converting NotFound -> InstanceNotFound. Same applies to 'Forbidden' and other exceptions. This patch converts 'exc_type is NotFound'-like checks to use 'isinstance' instead, which will cover HTTPNotFound, etc. Change-Id: I0982875e667121cee3da3cfe0124499cad484fa6
* Rewrite image code to use python-glanceclientBrian Waldon2012-08-133-35/+21
| | | | | | | | | | | | | | This patch rewrites the Glance-specific code within Nova to use the new python-glanceclient library. The old client is deprecated in Folsom and should not be used in conjunction with python-glanceclient. This removes the dependency on installing 'glance' through pip. Implements bp integrate-python-glanceclient Fixes bug 880964 Change-Id: Ifb9e75593abd36a2d1c08773d02f192e5e5627fc
* Tidy up nova.image.glanceBrian Waldon2012-07-303-12/+0
| | | | | | | | | | * Add comment explaining relevance of _is_image_available * Drop superfluous log statements * Drop GlanceImageService.delete_all as it has never been implemented * Drop the 'features' kwarg for GlanceImageService.update * Code simplification Change-Id: Ie538dd93dec729fb060bbcddfbddcba6cf303e52
* Use common parse_isotime in GlanceImageServiceBrian Waldon2012-07-301-1/+7
| | | | | | | Rather than reimplement openstack-common's isotime functionality, just use what's provided for us! Change-Id: Id44eab3c34ae2c682d27d1563c6baaf68b979d2b
* Refactor glance image service codeChris Behrens2012-07-261-12/+184
| | | | | | | | | | | | | | | | Fixes bug 1029397 This adds better retry support, making sure that if we need to retry requests to glance, we cycle through all hosts before potentially attemping the hosts that failed. The old random selection could cause immediate retrying of the same host that failed. This also adds logging of the host:port that failed and fixes a bug in the retry test, which didn't actually successfully test retrying. Tests for new code added. Change-Id: I400616081e1e547b9ca2e0be622889d3a399a5bf
* Remove deprecated auth from GlanceImageServiceBrian Waldon2012-07-111-26/+0
| | | | | | | | | | * Drop the code block specific to deprecated auth in image deletion code * Remove reference to deprecated auth in the auth_strategy config option help text * Related to bp remove-deprecated-auth Change-Id: Id0f4f287d33d01d54642fbc544ada9b7ef1b83ec
* Switch to common logging.Andrew Bogott2012-07-021-1/+1
| | | | | | I only just moved logging from nova to common, so behavior should remain the same. Change-Id: I1d7304ca200f9d024bb7244d25be2f9a670318fb
* Fix some import ordering HACKING violationsJohannes Erdfelt2012-06-282-2/+2
| | | | | | | These have snuck in recently since tox does not appear to run the hacking tests anymore during gating. Change-Id: Iaaffdee03964baf4c47d25bde93c54d3b59e2154
* Rename GlanceImageService.get to downloadBrian Waldon2012-06-273-16/+7
| | | | | | | | In preparation for integration with the new Glance client, this drops the return of image metadata from GlanceImageService.get in addition to renaming it to 'download'. Change-Id: I75ca3a0a909335e74cd521da6f894c163e773e94
* Remove GlanceImageService.index in favor of detailBrian Waldon2012-06-273-118/+31
| | | | | | | | | Since there is no difference in index vs detail in the v2 API, let's drop that as a requirement in the GlanceImageService. Related to bp integrate-python-glanceclient Change-Id: If98cf68e7e18fa78a2f9c09526ca9e80d2e27c1b
* Remove image service show_by_name methodBrian Waldon2012-06-273-20/+0
| | | | | | | | | This method isn't worth keeping around. It's used in one place and consists of a try/except block. We also shouldn't encourage clients of GlanceImageService to depend on finding a single unique image by a non-unique attribute. Change-Id: I02347adef7bc7ac70407226ea150000e55a798bc
* Cleanup of image service codeBrian Waldon2012-06-273-4/+419
| | | | | | | | | | | | * Remove image_service flag * Move nova.image.fake to nova.tests.image.fake * Move nova.image.get_default_image_service to nova.image.glance.get_default_image_service * Move nova.image.get_image_service to nova.image.glance.get_remote_image_service * Related to bp integrate-python-glanceclient Change-Id: Iea6db7898328a9060fb88586e042efbc0a4351fc
* Adds missing 'owner' attribute to image.MotoKen2012-06-271-2/+8
| | | | | | Fixes bug 1018216. Change-Id: I5540e0b8ab1df1904778e3edc250369b0930987e
* Remove direct access to glance clientBrian Waldon2012-06-231-2/+2
| | | | | | | | | | All internal clients of Glance should be using GlanceImageService. This refactors the code in the xen and vmware virt drivers that were directly instantiating a glance.client object Related to bp integrate-python-glanceclient Change-Id: I354254060e400d9c1dfd6d041b071e3960a9ece6
* _s3_create update only pertinent metadataJohn Tran2012-05-251-0/+59
| | | | | | | | | Fixes bug 827458. nova/image/s3.py _s3_create iterates through each image_state during image creation isn't mindful of metadata updates such as 'is_public'. Now will only update the specific pertinent metadata instead of purging all. Change-Id: I3e678d028464ac252383aa363baf488249dca198
* Alphabetize imports in nova/tests/Joe Gordon2012-05-182-2/+2
| | | | Change-Id: Ib8e747f91f5277aecc3be01a5e8cee5bc911e823
* Replaces exceptions.Error with NovaExceptionAlex Meade2012-05-071-2/+2
| | | | | | Fixes bug 817107 Change-Id: I6253e6bbcc44676c587b315fa32afba6459e676a
* fix bug where nova ignores glance host in imagerefMike Lundy2012-04-041-1/+2
| | | | | | This is related to bug 883328. Change-Id: Iadd1aec8d1bda3bd75bd0ab7f6797b643626db90
* Handle Forbidden and NotAuthenticated glance exc.Anthony Young2012-03-261-0/+13
| | | | | | | | * Remove references to deprecated NotAuthorized exception * Handle Forbidden and NotAuthenticated * Fixes bug 965540 Change-Id: Ib5eef3015239e0fafdb01c975a0f5d553f70519e
* Fix OpenStack CapitalizationJoe Gordon2012-03-152-2/+2
| | | | | | | Openstack => OpenStack for nova/*py Change-Id: Ibcfae4776422a515a109e59510fc84f8b63c00b9
* Merge "Replaces pipelines with flag for auth strategy"Jenkins2012-03-071-1/+1
|\
| * Replaces pipelines with flag for auth strategyVishvananda Ishaya2012-03-061-1/+1
| | | | | | | | | | | | | | | | | | Forcing deployers to modify a paste config file to change auth strategies is very fragile. This simplifies things by keying pipeline construction off of a single flag. Note that this will require a small change to devstack. Change-Id: I49728c356266e6084ecafb6c59542390137f89e9