glance / nova images refactoring
glyph opened this issue · comments
Glyph commented
Presently, the behavior of Glance / Nova images is broken in a few ways:
- the glance API and the nova API should be presenting different views of the same underlying data; however, right now the glance image store on the session is holding a completely different set of data from the nova image store. As per discussion between @tawalton and @lekhajee offline, the existing glance plugin should be removed once the more thoroughly fleshed-out rackspace image support is implemented.
- the internals of the nova API are coupled to the specific internals of the Rackspace images implementation; for example, as of #459 , in the (generic)
mimic/model/nova_image_collection.py
, we referenceself.image_store.create_image_store
, which is defined only in the (rackspace-specific)mimic/model/rackspace_image_store.py
. - there is a lot of duplication, and an undocumented implicit abstract interface, shared among all the base classes for images, including
glance_objects.Image
,rackspace_images.Image
,rackspace_images.RackspaceSavedImage
, andrackspace_images.OnMetalImage
. These should all be unified into a single class, since all these subclasses vary entirely in what data populates them, not in their behavior. This class should have all the necessary logic to translate the internal attributes of the image into the various formats it may need to be requested in - including the nova image list, the glance image list, and the nova detailed information resource. - the docstrings in all these modules really need to be brought up to a better quality standard - specifically, everything needs to say what types its arguments and return values are; if we had been more strictly enforcing that, it would have been clear that methods like
get_image_by_id
have no coherent type they could describe their return value with, which might have prevented some of this subclass sprawl. (So we will need a new interface or single implementation class to make it clear what "an image" is).
After this refactoring is done, only one image store class should exist, and it should probably live in the "glance" session, and nova should reference it, since nova is really just providing a view into Glance.