Merge "Update OS::Magnum::BayModel with latest Magnum changes"

changes/31/271431/1
Jenkins 2016-01-22 08:24:29 +00:00 committed by Gerrit Code Review
commit bc4e5ffd15
2 changed files with 29 additions and 8 deletions

View File

@ -31,12 +31,14 @@ class BayModel(resource.Resource):
NAME, IMAGE, FLAVOR, MASTER_FLAVOR, KEYPAIR,
EXTERNAL_NETWORK, FIXED_NETWORK, DNS_NAMESERVER,
DOCKER_VOLUME_SIZE, SSH_AUTHORIZED_KEY, COE, NETWORK_DRIVER,
HTTP_PROXY, HTTPS_PROXY, NO_PROXY, LABELS, TLS_DISABLED
HTTP_PROXY, HTTPS_PROXY, NO_PROXY, LABELS, TLS_DISABLED, PUBLIC,
REGISTRY_ENABLED
) = (
'name', 'image', 'flavor', 'master_flavor', 'keypair',
'external_network', 'fixed_network', 'dns_nameserver',
'docker_volume_size', 'ssh_authorized_key', 'coe', 'network_driver',
'http_proxy', 'https_proxy', 'no_proxy', 'labels', 'tls_disabled'
'http_proxy', 'https_proxy', 'no_proxy', 'labels', 'tls_disabled',
'public', 'registry_enabled'
)
properties_schema = {
@ -113,7 +115,7 @@ class BayModel(resource.Resource):
properties.Schema.STRING,
_('The Container Orchestration Engine for this bay model.'),
constraints=[
constraints.AllowedValues(['kubernetes', 'swarm'])
constraints.AllowedValues(['kubernetes', 'swarm', 'mesos'])
],
required=True
),
@ -148,11 +150,22 @@ class BayModel(resource.Resource):
),
TLS_DISABLED: properties.Schema(
properties.Schema.BOOLEAN,
_('Disable TLS in the Bay.'),
_('Disable TLS in the bay.'),
default=False,
support_status=support.SupportStatus(version='6.0.0')
),
PUBLIC: properties.Schema(
properties.Schema.BOOLEAN,
_('Make the baymodel public.'),
default=False,
support_status=support.SupportStatus(version='6.0.0')
),
REGISTRY_ENABLED: properties.Schema(
properties.Schema.BOOLEAN,
_('Enable the docker registry in the bay.'),
default=False,
support_status=support.SupportStatus(version='6.0.0')
)
}
default_client_name = 'magnum'
@ -185,6 +198,10 @@ class BayModel(resource.Resource):
args['labels'] = self.properties[self.LABELS]
if self.properties[self.TLS_DISABLED]:
args['tls_disabled'] = self.properties[self.TLS_DISABLED]
if self.properties[self.PUBLIC]:
args['public'] = self.properties[self.PUBLIC]
if self.properties[self.REGISTRY_ENABLED]:
args['registry_enabled'] = self.properties[self.REGISTRY_ENABLED]
bm = self.client().baymodels.create(**args)
self.resource_id_set(bm.uuid)

View File

@ -113,13 +113,15 @@ class TestMagnumBayModelWithAddedProperties(TestMagnumBayModel):
dns_nameserver: 8.8.8.8
docker_volume_size: 5
ssh_authorized_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB
coe: 'swarm'
coe: 'mesos'
network_driver: 'flannel'
http_proxy: 'http://proxy.com:123'
https_proxy: 'https://proxy.com:123'
no_proxy: '192.168.0.1'
labels: {'flannel_cidr': ['10.101.0.0/16', '10.102.0.0/16']}
tls_disabled: True
public: True
registry_enabled: True
'''
expected = {
'name': 'test_bay_model',
@ -132,11 +134,13 @@ class TestMagnumBayModelWithAddedProperties(TestMagnumBayModel):
'dns_nameserver': '8.8.8.8',
'docker_volume_size': 5,
'ssh_authorized_key': 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB',
'coe': 'swarm',
'coe': 'mesos',
'network_driver': 'flannel',
'http_proxy': 'http://proxy.com:123',
'https_proxy': 'https://proxy.com:123',
'no_proxy': '192.168.0.1',
'labels': {'flannel_cidr': ['10.101.0.0/16', '10.102.0.0/16']},
'tls_disabled': True
'tls_disabled': True,
'public': True,
'registry_enabled': True
}