Make docker_storage_driver a str instead of enum
Allow any value to be passed on the docker_storage_driver field by turning it into a StringField (was EnumField), and remove the constraints limiting the values to 'devicemapper' and 'overlay'. Change the docker storage setup to have a generic setup for all drivers with the exception of 'devicemapper', which keeps its own specific storage config function. For all others, do the same we already did for overlay (with two cases for usage of a cinder volume or not) and simply set the storage driver in the docker configuration to the value provided in the cluster template. Change-Id: I9aa8f232ce64ece4d439c0a476f463820a499617 Closes-Bug: #1722522
This commit is contained in:
parent
46b265ed47
commit
28fff8006a
@ -225,8 +225,7 @@ dns_nameserver:
|
||||
docker_storage_driver:
|
||||
description: |
|
||||
The name of a driver to manage the storage for the images and the
|
||||
container's writable layer. The supported drivers are ``devicemapper`` and
|
||||
``overlay``. The default is ``devicemapper``.
|
||||
container's writable layer. The default is ``devicemapper``.
|
||||
in: body
|
||||
required: true
|
||||
type: string
|
||||
|
@ -236,8 +236,7 @@ They are loosely grouped as: mandatory, infrastructure, COE specific.
|
||||
|
||||
--docker-storage-driver \<docker-storage-driver\>
|
||||
The name of a driver to manage the storage for the images and the
|
||||
container's writable layer. The supported drivers are 'devicemapper'
|
||||
and 'overlay'. The default is 'devicemapper'.
|
||||
container's writable layer. The default is 'devicemapper'.
|
||||
|
||||
--labels \<KEY1=VALUE1,KEY2=VALUE2;KEY3=VALUE3...\>
|
||||
Arbitrary labels in the form of key=value pairs. The accepted keys
|
||||
@ -1025,8 +1024,7 @@ Volume driver (volume-driver)
|
||||
|
||||
Storage driver (docker-storage-driver)
|
||||
Specified in the ClusterTemplate to select the Docker storage driver. The
|
||||
supported storage drivers are 'devicemapper' and 'overlay', with
|
||||
'devicemapper' being the default. Refer to the `Storage`_ section for more
|
||||
default is 'devicemapper'. Refer to the `Storage`_ section for more
|
||||
details.
|
||||
|
||||
Image (image)
|
||||
@ -1203,8 +1201,7 @@ Volume driver (volume-driver)
|
||||
|
||||
Storage driver (docker-storage-driver)
|
||||
Specified in the ClusterTemplate to select the Docker storage driver. The
|
||||
supported storage driver are 'devicemapper' and 'overlay', with
|
||||
'devicemapper' being the default. Refer to the `Storage`_ section for more
|
||||
default is 'devicemapper'. Refer to the `Storage`_ section for more
|
||||
details.
|
||||
|
||||
Image (image)
|
||||
|
@ -127,7 +127,7 @@ class BayModel(base.APIBase):
|
||||
insecure_registry = wtypes.StringType(min_length=1, max_length=255)
|
||||
"""Insecure registry URL when creating a Baymodel"""
|
||||
|
||||
docker_storage_driver = wtypes.Enum(str, *fields.DockerStorageDriver.ALL)
|
||||
docker_storage_driver = wtypes.StringType(min_length=1, max_length=255)
|
||||
"""Docker storage driver"""
|
||||
|
||||
master_lb_enabled = wsme.wsattr(types.boolean, default=False)
|
||||
|
@ -128,7 +128,7 @@ class ClusterTemplate(base.APIBase):
|
||||
insecure_registry = wtypes.StringType(min_length=1, max_length=255)
|
||||
"""Insecure registry URL when creating a ClusterTemplate """
|
||||
|
||||
docker_storage_driver = wtypes.Enum(str, *fields.DockerStorageDriver.ALL)
|
||||
docker_storage_driver = wtypes.StringType(min_length=1, max_length=255)
|
||||
"""Docker storage driver"""
|
||||
|
||||
master_lb_enabled = wsme.wsattr(types.boolean, default=False)
|
||||
|
@ -0,0 +1,33 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
"""change storage driver to string
|
||||
|
||||
Revision ID: 04c625aa95ba
|
||||
Revises: 52bcaf58fecb
|
||||
Create Date: 2017-10-10 15:40:37.553288
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '04c625aa95ba'
|
||||
down_revision = '52bcaf58fecb'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('cluster_template', 'docker_storage_driver',
|
||||
existing_type=sa.Enum('devicemapper', 'overlay',
|
||||
name='docker_storage_driver'),
|
||||
type_=sa.String(length=512),
|
||||
nullable=True)
|
@ -32,14 +32,8 @@ fi
|
||||
|
||||
$configure_docker_storage_driver
|
||||
|
||||
if [ "$DOCKER_STORAGE_DRIVER" = "overlay" ]; then
|
||||
if [ $(echo -e "$(uname -r)\n3.18" | sort -V | head -1) = $(uname -r) ]; then
|
||||
ERROR_MESSAGE="OverlayFS requires at least Linux kernel 3.18. Cluster node kernel version: $(uname -r)"
|
||||
echo "ERROR: ${ERROR_MESSAGE}" >&2
|
||||
sh -c "${WAIT_CURL} --data-binary '{\"status\": \"FAILURE\", \"reason\": \"${ERROR_MESSAGE}\"}'"
|
||||
else
|
||||
configure_overlay
|
||||
fi
|
||||
else
|
||||
if [ "$DOCKER_STORAGE_DRIVER" = "devicemapper" ]; then
|
||||
configure_devicemapper
|
||||
else
|
||||
configure_storage_driver_generic $DOCKER_STORAGE_DRIVER
|
||||
fi
|
||||
|
@ -1,5 +1,5 @@
|
||||
# This file contains docker storage drivers configuration for fedora
|
||||
# atomic hosts. Currently, devicemapper and overlay are supported.
|
||||
# atomic hosts, as supported by Magnum.
|
||||
|
||||
# * Remove any existing docker-storage configuration. In case of an
|
||||
# existing configuration, docker-storage-setup will fail.
|
||||
@ -17,8 +17,8 @@ clear_docker_storage () {
|
||||
fi
|
||||
}
|
||||
|
||||
# Configure docker storage with xfs as backing filesystem.
|
||||
configure_overlay () {
|
||||
# Configure generic docker storage driver.
|
||||
configure_storage_driver_generic() {
|
||||
clear_docker_storage
|
||||
|
||||
if [ -n "$DOCKER_VOLUME_SIZE" ] && [ "$DOCKER_VOLUME_SIZE" -gt 0 ]; then
|
||||
@ -27,9 +27,7 @@ configure_overlay () {
|
||||
mount -a
|
||||
fi
|
||||
|
||||
echo "STORAGE_DRIVER=overlay" > /etc/sysconfig/docker-storage-setup
|
||||
|
||||
docker-storage-setup
|
||||
sed -i "/^DOCKER_STORAGE_OPTIONS=/ s/=.*/=-s $1/" /etc/sysconfig/docker-storage
|
||||
|
||||
local lvname=$(lvdisplay | grep "LV\ Path" | awk '{print $3}')
|
||||
local pvname=$(pvdisplay | grep "PV\ Name" | awk '{print $3}')
|
||||
|
@ -153,8 +153,6 @@ parameters:
|
||||
type: string
|
||||
description: docker storage driver name
|
||||
default: "devicemapper"
|
||||
constraints:
|
||||
- allowed_values: ["devicemapper", "overlay"]
|
||||
|
||||
wait_condition_timeout:
|
||||
type: number
|
||||
|
@ -60,8 +60,6 @@ parameters:
|
||||
type: string
|
||||
description: docker storage driver name
|
||||
default: "devicemapper"
|
||||
constraints:
|
||||
- allowed_values: ["devicemapper", "overlay"]
|
||||
|
||||
volume_driver:
|
||||
type: string
|
||||
|
@ -50,8 +50,6 @@ parameters:
|
||||
type: string
|
||||
description: docker storage driver name
|
||||
default: "devicemapper"
|
||||
constraints:
|
||||
- allowed_values: ["devicemapper", "overlay"]
|
||||
|
||||
tls_disabled:
|
||||
type: boolean
|
||||
|
@ -151,8 +151,6 @@ parameters:
|
||||
type: string
|
||||
description: docker storage driver name
|
||||
default: "devicemapper"
|
||||
constraints:
|
||||
- allowed_values: ["devicemapper", "overlay"]
|
||||
|
||||
wait_condition_timeout:
|
||||
type: number
|
||||
|
@ -49,8 +49,6 @@ parameters:
|
||||
type: string
|
||||
description: docker storage driver name
|
||||
default: "devicemapper"
|
||||
constraints:
|
||||
- allowed_values: ["devicemapper", "overlay"]
|
||||
|
||||
flannel_network_cidr:
|
||||
type: string
|
||||
|
@ -22,8 +22,6 @@ parameters:
|
||||
type: string
|
||||
description: docker storage driver name
|
||||
default: "devicemapper"
|
||||
constraints:
|
||||
- allowed_values: ["devicemapper", "overlay"]
|
||||
|
||||
tls_disabled:
|
||||
type: boolean
|
||||
|
@ -144,8 +144,6 @@ parameters:
|
||||
type: string
|
||||
description: docker storage driver name
|
||||
default: "devicemapper"
|
||||
constraints:
|
||||
- allowed_values: ["devicemapper", "overlay"]
|
||||
|
||||
loadbalancing_protocol:
|
||||
type: string
|
||||
|
@ -29,8 +29,6 @@ parameters:
|
||||
docker_storage_driver:
|
||||
type: string
|
||||
description: docker storage driver name
|
||||
constraints:
|
||||
- allowed_values: ["devicemapper", "overlay"]
|
||||
|
||||
external_network:
|
||||
type: string
|
||||
|
@ -38,8 +38,6 @@ parameters:
|
||||
docker_storage_driver:
|
||||
type: string
|
||||
description: docker storage driver name
|
||||
constraints:
|
||||
- allowed_values: ["devicemapper", "overlay"]
|
||||
|
||||
external_network:
|
||||
type: string
|
||||
|
@ -116,8 +116,6 @@ parameters:
|
||||
type: string
|
||||
description: docker storage driver name
|
||||
default: "devicemapper"
|
||||
constraints:
|
||||
- allowed_values: ["devicemapper", "overlay"]
|
||||
|
||||
loadbalancing_protocol:
|
||||
type: string
|
||||
|
@ -30,8 +30,6 @@ parameters:
|
||||
docker_storage_driver:
|
||||
type: string
|
||||
description: docker storage driver name
|
||||
constraints:
|
||||
- allowed_values: ["devicemapper", "overlay"]
|
||||
|
||||
external_network:
|
||||
type: string
|
||||
|
@ -38,8 +38,6 @@ parameters:
|
||||
docker_storage_driver:
|
||||
type: string
|
||||
description: docker storage driver name
|
||||
constraints:
|
||||
- allowed_values: ["devicemapper", "overlay"]
|
||||
|
||||
external_network:
|
||||
type: string
|
||||
|
@ -41,7 +41,8 @@ class ClusterTemplate(base.MagnumPersistentObject, base.MagnumObject,
|
||||
# Version 1.15: Added 'floating_ip_enabled' field
|
||||
# Version 1.16: Renamed the class from "BayModel' to 'ClusterTemplate'
|
||||
# Version 1.17: 'coe' field type change to ClusterTypeField
|
||||
VERSION = '1.17'
|
||||
# Version 1.18: DockerStorageDriver is a StringField (was an Enum)
|
||||
VERSION = '1.18'
|
||||
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
@ -63,8 +64,7 @@ class ClusterTemplate(base.MagnumPersistentObject, base.MagnumObject,
|
||||
'volume_driver': fields.StringField(nullable=True),
|
||||
'apiserver_port': fields.IntegerField(nullable=True),
|
||||
'docker_volume_size': fields.IntegerField(nullable=True),
|
||||
'docker_storage_driver': m_fields.DockerStorageDriverField(
|
||||
nullable=True),
|
||||
'docker_storage_driver': fields.StringField(nullable=True),
|
||||
'cluster_distro': fields.StringField(nullable=True),
|
||||
'coe': m_fields.ClusterTypeField(nullable=True),
|
||||
'http_proxy': fields.StringField(nullable=True),
|
||||
|
@ -72,18 +72,6 @@ class ClusterType(fields.Enum):
|
||||
super(ClusterType, self).__init__(valid_values=ClusterType.ALL)
|
||||
|
||||
|
||||
class DockerStorageDriver(fields.Enum):
|
||||
ALL = (
|
||||
DEVICEMAPPER, OVERLAY,
|
||||
) = (
|
||||
'devicemapper', 'overlay',
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
super(DockerStorageDriver, self).__init__(
|
||||
valid_values=DockerStorageDriver.ALL)
|
||||
|
||||
|
||||
class QuotaResourceName(fields.Enum):
|
||||
ALL = (
|
||||
CLUSTER,
|
||||
@ -156,9 +144,5 @@ class ClusterTypeField(fields.BaseEnumField):
|
||||
AUTO_TYPE = ClusterType()
|
||||
|
||||
|
||||
class DockerStorageDriverField(fields.BaseEnumField):
|
||||
AUTO_TYPE = DockerStorageDriver()
|
||||
|
||||
|
||||
class ServerTypeField(fields.BaseEnumField):
|
||||
AUTO_TYPE = ServerType()
|
||||
|
@ -356,7 +356,7 @@ class TestObject(test_base.TestCase, _TestObject):
|
||||
# http://docs.openstack.org/developer/magnum/objects.html
|
||||
object_data = {
|
||||
'Cluster': '1.16-7a544c5059697c464810470980f81ba1',
|
||||
'ClusterTemplate': '1.17-f1ce5212b46506360b41ab5cb7658af4',
|
||||
'ClusterTemplate': '1.18-7fa94f4fdd027acfb4f022f202afdfb5',
|
||||
'Certificate': '1.1-1924dc077daa844f0f9076332ef96815',
|
||||
'MyObj': '1.0-34c4b1aadefd177b13f9a2f894cc23cd',
|
||||
'X509KeyPair': '1.2-d81950af36c59a71365e33ce539d24f9',
|
||||
|
10
releasenotes/notes/bug-1722522-d94743c6362a5e48.yaml
Normal file
10
releasenotes/notes/bug-1722522-d94743c6362a5e48.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Allow any value to be passed on the docker_storage_driver field by turning it
|
||||
into a StringField (was EnumField), and remove the constraints limiting the
|
||||
values to 'devicemapper' and 'overlay'.
|
||||
upgrade:
|
||||
- |
|
||||
Requires a db upgrade to change the docker_storage_driver
|
||||
field to be a string instead of an enum.
|
Loading…
x
Reference in New Issue
Block a user