summaryrefslogtreecommitdiff
path: root/glance_store/driver.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove Python 2 supportliyou012022-05-251-4/+2
| | | | | | | | | Python 2 has been deprecated for almost two years, and has not been guaranteed to work with glance_store for a while. This patch removes all traces of six, unicode strings and Python 2 tweaks. Co-Authored-By: Cyril Roelandt <cyril@redhat.com> Change-Id: Ifa78924d7ecf4f2d9a54c677888ab2926530c487
* Add location prefix url to store instanceAbhishek Kekane2019-06-031-0/+5
| | | | | | | | | | For updating location metadata with store information to the images which are existed prior to enabling multiple stores, added new public attribute 'url_prefix' to each of the store instance. Implements: blueprint location-uri-prefix Change-Id: Icd760d30e947867c2b5b87f86bbe4b1a4240d214
* Multihash Implementation for GlanceScott McClymont2018-07-181-5/+95
| | | | | | | | | | | | | | Adds the ability to compute a "multihash" (see the Glance spec for what this is exactly). To maintain backward compatability, a new store_add_to_backend_with_multihash function is added. Backward compatability for each store's add() method is achieved by a back_compat_add wrapper. Co-Authored-by: Scott McClymont <scott.mcclymont@verizonwireless.com> Co-Authored-by: Brian Rosmaita <rosmaita.fossdev@gmail.com> Change-Id: I063d0900b7dc7e0d94dfb685971eb9b17ed67c7b Partially-implements: blueprint multihash
* Enable multi store support for glanceAbhishek Kekane2018-07-151-2/+22
| | | | | | | | | | | | | | | Added supporting logic to configure, manage and use multiple stores of the same or different type/scheme. Added new config option 'default_backend' which will be used to specifiy default store to which image will be stored. Added support for file and rbd store. The default behavior is maintained for backward compatibility. DocImpact Partial-Implements: bp multi-store Change-Id: I1f2e8fa61d6dfecd8395a1f894f74ec5bcb5573c
* TrivialFix: Correct reST field lists in docstringsyfzhao2017-09-261-1/+1
| | | | | | | | | | | | Most common format for documenting arguments is reST field, the incorrect docstring will cause a Sphinx warning to be generated and caused the documentation to be improperly rendered. [1] http://sphinx-doc.org/domains.html#info-field-lists The old patch will be abandon: https://review.openstack.org/#/c/490432/ Change-Id: Icd84ad664dad2ea116864735dbaf388d1774c42a
* Cleanup i18n marker functions to match Oslo usageRonald Bradford2016-07-201-2/+1
| | | | | | | | | | Define marker functions as per usage in documentation in http://docs.openstack.org/developer/oslo.i18n/usage.html and correct message usage as defined in guidelines at http://docs.openstack.org/developer/oslo.i18n/guidelines.html Co-Authored-By: liang.jingtao@zte.com.cn Change-Id: I564f5d1f31314be5c18420b6bc3d694a561d78f2
* Merge "Fix some inconsistency in docstrings"Jenkins2016-02-121-12/+12
|\
| * Fix some inconsistency in docstringshgangwx@cn.ibm.com2016-01-281-12/+12
| | | | | | | | | | | | | | | | add colon after ":param", ":returns" and ":raises" for all such occurrences add ":param" before some parameter description Co-Authored-By: kairat_kushaev <kkushaev@mirantis.com> Change-Id: I4220e2a811793cd895333f132837c7e7ecedb62b
* | LOG.warn is deprecated in python3skseeker2016-02-121-1/+1
|/ | | | | | | | | | Replace LOG.warn with LOG.warning cause it has been deprecated in py3 and oslo_lod is not used to encapsulate this change. Co-Authored-By: kairat_kushaev <kkushaev@mirantis.com> Change-Id: I31b3f491b5d242abea4e5a7728983142ad2805a8
* Merge "Fix default mutables for set_acls"Jenkins2016-01-271-2/+2
|\
| * Fix default mutables for set_aclskairat_kushaev2016-01-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | read_tenants, write_tenants parameters in set_acls method of glance_store/driver.Store have empty lists as default values. It is not recommended approach cause it can lead to some neat issues. Moreover, Swift store class rewrites this method and uses None as default values (which is right). So we need to follow this approach in base Store class. Change-Id: Ifa0f0c286dbb822b2d34d03978655d720bb109d4
* | Merge "Add signature verifier to backend drivers"Jenkins2016-01-211-1/+2
|\ \
| * | Add signature verifier to backend driversBrianna Poulos2016-01-211-1/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to use the 'sign-the-data' approach instead of the 'sign-the- hash' approach for signature verification, the verifier must be updated with the image data at the same time that the image data is being read in order to update the checksum. This patch adds the ability for glance to pass in a verifier object to the backend drivers when an image is being uploaded, which is given the image data by the backend drivers, and used to verify the signature in glance. The following drivers are supported: * file * rbd * sheepdog * s3 * vsphere The swift driver is supported for images that are greater than the 'large_object_size' since glance_store does not read the data for images that are less than 'large_object_size' (swiftclient does the reading), and as a result the verifier cannot be updated with the data. A child patch addresses this issue. The cinder and http drivers are not supported because they do not have the 'write' capability. Partial-Bug: #1516031 Change-Id: I43799e6a4a6643a23769af8d839a2beb4e0ff9bf
* | Use oslo_utils.encodeutils.exception_to_unicode()Victor Stinner2016-01-211-2/+3
|/ | | | | | | | | | | | | | | | | | Replace glance_store.common.utils.exception_to_str() with encodeutils.exception_to_unicode(). exception_to_unicode() tries more options to get a nice error message as Unicode from an exception object. As exception_to_str(), it catches and handles exceptions. Remove glance_store.common.utils.exception_to_str() and related unit tests. The function is not part of the store API and Glance does not use it. glance already uses exception_to_unicode(): see change I86008c8adc0c5664f96573c1015cc15e2d06e3e2. By the way, glance did not use exception_to_str() from glance_store but had its own copy of the function (which was removed by the mentioned change). Change-Id: I52cab2e773c257e36d36290f6060811f83f18bb0
* Remove deprecated glance_store opts from default sectionSabari Kumar Murugesan2015-10-101-6/+0
| | | | | | | | | The glance store opts should be specified in the glance_store section. We had deprecated the opts in default section in Juno. DocImpact Change-Id: Ib0fda16d7f00f6f3ff15eeae87615aec26efaaac
* Propagate BadStoreConfiguration to library userGorka Eguileor2015-03-281-3/+5
| | | | | | | | | | | | | Propagate BadStoreConfiguration exceptions to library user on start up (on create_stores call) instead of just logging them as ERRORs. Until logic to handle runtime BadStoreConfiguration exceptions from configure and get_store_from_schema is added to Glance we'll keep just logging those exceptions at runtime. Closes-Bug: #1422699 Depends-On: Ifc038874aa0388b036729790a883ae1e1efd323d Change-Id: I1d4f95cba47d21f1eb7e580314d01ac8d3481586
* Merge "Use oslo_config.cfg.ConfigOpts in glance_store"Jenkins2015-03-131-1/+1
|\
| * Use oslo_config.cfg.ConfigOpts in glance_storeZhi Yan Liu2015-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move from oslo.config to oslo_config. This change could prevent glance failed by "NoSuchOptError: no such option: glance_store" triggered in verify_default_store() error when startup [0]. The root cause is that when we import oslo.config.cfg (when importing glance_store in glance context) first than oslo_config.cfg, global oslo.config.cfg.ConfigOpts object (CONF) in glance_store code is a different object (and type) than oslo_config.cfg.ConfigOpts object in glance code, so register_opts() of glance_store registered all store needed options to a separated ConfigOpts object but glance used one. With change I30ecbf8f9de77496fcb643c7ad9738d79ad359f0) glance is using oslo_config namespace now, so before release new glance_store, we need merge this change in. A clear and simpler example as following: Python 2.7.6 (default, Mar 22 2014, 22:59:56) >>> from glance_store import backend >>> from glance.common import config # we do this importing order for pep8 required in now code. >>> config.CONF == backend.CONF, config.CONF, backend.CONF (False, <oslo_config.cfg.ConfigOpts object at 0x7f4e4cd18690>, <oslo.config.cfg.ConfigOpts object at 0x7f4e4e521d50>) # Renew python session. >>> from glance.common import config >>> from glance_store import backend >>> config.CONF == backend.CONF, config.CONF, backend.CONF (True, <oslo_config.cfg.ConfigOpts object at 0x7fc355937450>, <oslo_config.cfg.ConfigOpts object at 0x7fc355937450>) Change-Id: I1f1962c462b0c1fcdce0c04c6a1cec57d9f191eb Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
* | Merge "Fix timeout during upload from slow resource"Jenkins2015-03-111-1/+1
|\ \ | |/ |/|
| * Fix timeout during upload from slow resourceMike Fedosin2015-03-101-1/+1
| | | | | | | | | | | | | | | | | | To prevent timeouts during upload images from slow resources it's recommended to reduce chunk size from 16mb to 4mb. Change-Id: If994748e6571123370d26eea347ee1bfb5639711 Closes-Bug: 1429785
* | Move from oslo.utils to oslo_utils (supplement)Zhi Yan Liu2015-03-101-1/+1
|/ | | | | | | | | | oslo_utils has been moved out of the oslo namespace. bp drop-namespace-packages (First Change: Id4ccf076983592026d35407107e79cf1575248ce ) Change-Id: Ie8597692978c2fc090591bdae213e649e1a80c8c Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
* Use oslo_utils.units where appropriateGorka Eguileor2015-03-091-1/+2
| | | | | | | | | | | | Use units from oslo_utils where appropriate instead of using magic numbers. Changes from patch Ib08b8d8843b72966e2cf87f741b1cc0eea0672e5 are also included. Co-Authored-By: Gorka Eguileor <geguileo@redhat.com> Co-Authored-By: James Page <james.page@canonical.com> Change-Id: I082ea91cb06e49659495cae9072b263eccda76a1
* Use a named enum for capability valuesIan Cordasco2015-02-131-1/+1
| | | | | | | | | | | In Iedf0d4f829e46ca64c3f4fc6a7dfee54d9b0605b we added support for driver capabilities in glance_store. That same change also used (mutable) module globals to check driver capabilities. By moving the capability definitions inside a subclass of IntEnum we retain all of the previous functionality with the guarantee that the enum values will not change once defined. Change-Id: I13c7bd507252e793b2c790cc9b77c7b8db432d02
* Add capabilities to storage driverZhi Yan Liu2015-02-081-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Storage capabilities is used to indicate the static and dynamic ability of the storage driver object based on current driver implementation or particular driver configuration and backend status. Use storage capabilities glance_store can do more proper operations on backend to support upper layer request, like to enable or disable add() function to glance, or if allow glance reuse driver instance for all request according to whether the driver and/or backend is stateless. This patch implemented some initial capabilities for existing drivers, and change the foundational code to make them be aware. Mainly it contains: 1. Implemented essential code to enable driver capabilities, adding necessary capabilities. 2. Added a generic checker on necessary storage operations, to make sure the capabilities of the driver are capable of handling requested operation. We can enhance the check logic as needed easily in future. 3. Added a callback based schedule logic to update dynamic capabilities of store when operator enabled it by a option. 4. Refactoring on existing disablement logic on driver add() interface, to use consistent capabilities way to handle it, removed add_disabled(). 5. Therefor the related exception conversion logic for other interfaces are redundant, due to now we can raise proper exception directly from the checker. 6. Added the logic to recreate drive object if the storage and/or driver isn't stateless. Few minor changes need to be added to Glance side: Change Ibbc85b6bc2ea98c564d316db2874d7df5aac32a6 . docImpact Implements: blueprint store-capabilities Change-Id: Iedf0d4f829e46ca64c3f4fc6a7dfee54d9b0605b Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
* Remove validate_locationStuart McLaren2014-10-071-7/+0
| | | | | | | | | As part of the fix for bug 1334196 Glance no longer uses the 'validate_location' function. (https://review.openstack.org/#/c/107383/) It can be removed from the store. Change-Id: Ib45f2d5d04bf28b8dfe9c5e879f910514f330950
* Switch to using oslo.utilsZhi Yan Liu2014-09-291-1/+1
| | | | | | | | This change switched glance_store to using oslo.utils. It is not good to add dependency on oslo-incubator if we can avoid it. Change-Id: I9efe3d57e0ce64296c7a75838bd2ee19249f0fa8 Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
* Adding common.utils.exception_to_str() to avoid encoding issueZhi Yan Liu2014-09-191-14/+2
| | | | | | | | | | 1. Ported common.utils.exception_to_str() back to glance_store. 2. Used exception_to_str() to consistently cast the exception to avoid potential encoding issue. Change-Id: I398ea0e218ebb37b9041cfe82f18b11e614662bf Related-Id: I77478a8eeeefd85bf98138156429df53d0a4c079 Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
* Configure the stores explicitlyArnaud Legendre2014-09-091-2/+0
| | | | | | | | | | | | The store configure() method is being called two times: on one hand in the store constructor and also explicitly in the create_stores() method. Since the configure() method can contain remote calls, it is better to avoid calling it more than once, especially, when it doesn't add any value. Change-Id: I6f39dfa7fd3d0ef7ff4fc2a9ebbebdfb0cf114a1
* Register store's configs w/o creating instances0.1.3Flavio Percoco2014-09-031-1/+2
| | | | | | | | Instead of invoking the each store to register the config options, we should just load the class and access `OPTIONS` from there. The old attempt for config options registration is kept for other purposes. Change-Id: I5545c1bd0ff0fd613cd40aadd87aaa4cbf2685ac
* Add deprecated options support for storage drivers0.1.2Flavio Percoco2014-09-031-0/+5
| | | | | | | | Instead of requiring all storage driver options to be migrated immediately, provide an upgrade path by supporting all config options that used to be under the `DEFAULT` section. Change-Id: Id978830c67f6c93b18e73cc16da92b99702357f5
* Rename glance.store to glance_store0.1.1Flavio Percoco2014-08-281-0/+187
Given the existing, known issues, with python namespaces, pip and setuptools, we've decided to rename glance.store into glance_store. Change-Id: I3f02ce78b3d64f34744e5116652bfbb4f3062cbf