Add support for allowable network drivers configuration

Problem:
With the changes that were merged with https://review.openstack.org/230147, the
choices of container network drivers that can be selected for a given COE type
when creating a Magnum baymodel are hardcoded, and are based on network drivers
that Magnum can support for each COE.

These hard-coded selections will probably make sense in most cases. However, in
some cloud instances, a cloud provider or cloud admin may want to restrict the
choices of network drivers that a user can select for a given COE even further,
based on specific restrictions in the cloud.

Magnum should provide support for configuration of what container network
drivers are allowed, and this needs to be provided on a per-COE basis.

Proposed fix:
Add 3 configuration list options to the config in /etc/magnum/magnum.conf for
configuring allowed nework drivers for kubernetes, swarm and mesos
respectively. The keyword 'all' can be used to allow all network drivers
supported by Magnum for that COE. The new config options are:
- kubernetes_allowed_network_drivers
  (default=['all'])
- swarm_allowed_network_drivers
  (default=['all'])
- mesos_allowed_network_drivers
  (default=['all'])
Validation of the --network-driver attributes for a baymodel create will be
performed against this above configuration on a per-COE basis.

Change-Id: Ibaa21d43fd6b5c1a6acc10e56145280eeaea8534
Closes-Bug: #1504635
This commit is contained in:
Dane LeBlanc 2015-10-09 16:42:45 -04:00
parent 49975e29a4
commit c457a95cf2
1 changed files with 9 additions and 0 deletions

View File

@ -172,3 +172,12 @@ class BayModelTest(base.BaseMagnumTest):
self.assertRaises(
exceptions.BadRequest,
bay_model_client.patch_baymodel, datagen.random_uuid(), gen_model)
@testtools.testcase.attr('negative')
def test_create_baymodel_invalid_network_driver(self):
bay_model_client = cli.BayModelClient.as_user('default')
gen_model = datagen.random_baymodel_data_w_valid_keypair_and_image_id()
gen_model.network_driver = 'invalid_network_driver'
self.assertRaises(
exceptions.BadRequest,
bay_model_client.post_baymodel, gen_model)