Skip to content

Support setting the OpenStack region per appserver.

Boros Gábor requested to merge smarnach/multi-region into master

Created by: smarnach

This change allows launching appservers in other regions than the default region.

Testing instructions

Set openstack_region to a different region on the instance, then spawn a new appserver. The region you choose needs to have the base image and SSH key needed for the instance.

Author concerns

  1. In line with the other OpenStack settings, I avoided storing the region on individual appservers. See my comment here.
  2. The OpenStack region is needed to create the Nova client, which is done in the OpenStackServer constructor. This only works if the region is stored on the server as well. The OpenStackServer is instantiated in the abstract base class AppServer, so the region needs to be accessible there. This means I need to add the region to Instance instead of OpenEdXInstance.
  3. I had to remove the declaration of base classes from the migration that creates the OpenEdXInstance model. Django imports the current version of the base class and implicitly creates all fields in that current version, which defies the whole purpose of migrations as a record of historic versions of the model. the bases parameter to CreateModel can take a string of the form app_name.model_name to retrieve a historic version of a model. However, this only works for actual models, not for abstract models, so we can't do this in this case. Simply removing the bases parameter seems to work fine though, so this is what I'm doing for now. (This was rather difficult to debug, by the way, since there was no indication what was wrong. The new migration applies fine to the current state of the database, but if you try to run all migrations on a pristine database, the last one fails with the error that the openstack_region field already exists. But none of the earlier migrations contains a reference to this field, so it was completely unclear how that happened.)
  4. Even though all lines of code I added are tested, the total coverage had dropped for reasons I don't understand, so I had to add some tests for completely unrelated code (and I found a minor bug when doing so).

Reviewers

  • @pomegranited

Merge request reports

Loading