libvirt.imagebackend.cache needs to be refactored to eliminate the callback to call_if_not_exists(). The only way it could meet all the requirements while remaining a callback is if the os.path.exists() check were removed from the function, which would then require path checks in each of the backend classes where prepare_template() is called. Ultimately, this is a lot more code than simply adding a backend-specific call to each class.
There's too much risk associated with such a refactor at such a late stage for Grizzly, so we'll look to tackle this for Havana.
Ok, finally I have found time to perform the mentioned refactoring, but I have a few questions. Rafi, as a bug reporter could you please clarify a few details: not_exists( ) be completely removed or just the "os.path.exists()" check should be removed from it (but leave and possibly rename call_if_ not_exists( ))? If it should be removed, what about synchronization (there is a @utils.synchronized decorator)? virt.libvirt. test_imagebacke nd.LvmTestCase. test_cache_ template_ exists, nova.tests. virt.libvirt. test_imagebacke nd.Qcow2TestCas e.test_ cache, ...) that expect that exists() should be called. They should be updated, as the client should perform the check now, right? Or am I misunderstanding something?
1. From the bug description I cannot figure out should call_if_
2. The other question is about unit tests. There are a few test cases (e.g. nova.tests.
Note. I have attached a patch with the changes I have already made, so you could look through them if you have questions. I could put them on review, but I want to update the tests (or implementation) first.
One more note. I'm quite new to OpenStack development, so I'd very appreciate your help even if the questions look stupid. Thanks.