Remove glanceclient wrapper¶
This spec proposes removing the wrapper code around glanceclient and allow nova to use glanceclient directly.
Nova currently uses a wrapper on top of glanceclient, which is a close-enough implementation of the same API exposed by the client itself. This wrapper has evolved over the years allowing nova to move from older versions of glance’s API to newer ones. Unfortunately, this code is quite old and contains some workarounds to allow nova for using some of the latest features exposed through Glance’s API.
As of Kilo, Glance’s team plans to deprecate the version 1 of the API but to do that, it is necessary to ensure that all projects depending on it are able to function correctly with the latest version and that the transition from the previous version to the new one is as painless as possible.
The idea behind this cleanup is to reduce the code that needs to be maintained by the nova team and allow Glance to evolve without being blocked by other projects. The changes proposed in this spec shouldn’t have any impact on developers, end users or operators.
The proposed change is to remove entirely the nova.image.glance module and keep the existing nova.image.api module until we’re able to get rid of nova.image.download too.
The nova.image.glance modules contains the code for the above mentioned wrapper that we’d like to cleanup. This code contains some logic duplications from glanceclient and most of it is not needed. The bits that are needed - those that at least could be reused - are the ones enhancing image downloads. That is, the piece of code that allows to access the image data directly depending on the store and whether it’s been enabled in the configuration file. In order to keep supporting this behavior, we must keep the code under nova.image.download until glance_store is adopted by nova - a separate blueprint will be written for this.
Once glance_store is refactored and adopted, there won’t be any need to maintain the code under nova.image.api either. This will be addressed in the glance_store spec as well.
During these changes, the existing glance specific config options will be updated too. There are some old and not useful options - host, port, protocol - that could be deprecated in favor of better ones - api_servers.
In addition to the above changes, the default version of the glance api will be bumped to v2. This change will require updating nova tests to test this version of the API as well.
Keep the wrapper and clean it up until it matches exactly glance’s client API. Please, don’t! :)
Another way to make this transition to use v2 more lightweight is by removing the wrapper code but keep using the v1 of the API. This will allow users to opt-in to glance v2 by just changing the glance api url in Nova’s conf. Although conservatives may like this option better, I’d recommend to move straight to v2. The main reason being that Glance’s v1 has some issues, including security ones - see unchecked image membership - that are not going to be fixed since anymore. Furthermore, v2 of the API allows for smarter implementations for image data access and it’s the current maintained and fully supported version.
Data model impact¶
REST API impact¶
Other end user impact¶
Other deployer impact¶
The change will keep backwards compatibility with the existing configuration options and work on a upgrade path for deployers.
This change will introduce Glance’s API v2 as the default version to use. Deployers of this service will need to downgrade the version if they don’t want to use it. For what is worth, Glance enables the API v2 by default.
- Primary assignee:
- Other contributors:
Rewrite nova.image.api.Api methods using glanceclient directly
Move current glance specific options and remove nova.image.glance code
Deprecate old nova.image.glance options like: host, port, protocol
All existing test will continue to function as they do but they’ll test Glance’s v2. It’ll be necessary to add a test for Glance’s v1 as well until it’s fully deprecated.
For functional and integration tests to work properly, it’ll be necessary to register Glance’s API v2 in keystone as the default one. Devstack currently registers just the v1. This will allow us to test everything in the gate as well.
Commits with the configuration changes will be marked with DocImpact