Add 'VERSIONS' to all profile/policy types

This adds 'VERSIONS' to all profile types and policy types. The goal is
to return this version history (including support statuses) to users
when listing or showing profile/policy types.

Change-Id: I098c608a10d1473a58094dca0cfa438fa468ad91
This commit is contained in:
tengqm 2017-01-07 03:16:23 -05:00
parent 1735ff4c60
commit b7b0e6ac13
13 changed files with 70 additions and 12 deletions

View File

@ -34,6 +34,12 @@ RPC_PARAMS = (
'show_details', 'sort',
)
SUPPORT_STATUSES = (
EXPERIMENTAL, SUPPORTED, DEPRECATING, UNSUPPORTED,
) = (
'experimental', 'supported', 'deprecated', 'unsupported',
)
ACTION_CAUSES = (
CAUSE_RPC, CAUSE_DERIVED,
) = (

View File

@ -44,9 +44,12 @@ class AffinityPolicy(base.Policy):
This policy is expected to be enforced before new member(s) added to an
existing cluster.
"""
VERSION = '1.0'
VERSIONS = {
'1.0': [
{'status': consts.SUPPORTED, 'since': '2016.10'}
]
}
PRIORITY = 300
TARGET = [

View File

@ -32,7 +32,10 @@ CHECK_RESULTS = (
class Policy(object):
'''Base class for policies.'''
"""Base class for policies."""
VERSIONS = {}
PROFILE_TYPE = 'ANY'
KEYS = (

View File

@ -51,7 +51,11 @@ class BatchPolicy(base.Policy):
"""Policy for batching the operations on a cluster's nodes."""
VERSION = '1.0'
VERSIONS = {
'1.0': [
{'status': consts.EXPERIMENTAL, 'since': '2017.02'}
]
}
PRIORITY = 200
TARGET = [

View File

@ -40,7 +40,11 @@ class DeletionPolicy(base.Policy):
"""
VERSION = '1.0'
VERSIONS = {
'1.0': [
{'status': consts.SUPPORTED, 'since': '2016.04'}
]
}
PRIORITY = 400
KEYS = (

View File

@ -26,7 +26,11 @@ class HealthPolicy(base.Policy):
"""Policy for health management of a cluster."""
VERSION = '1.0'
VERSIONS = {
'1.0': [
{'status': consts.EXPERIMENTAL, 'since': '2017.02'}
]
}
PRIORITY = 600
TARGET = [

View File

@ -45,6 +45,11 @@ class LoadBalancingPolicy(base.Policy):
performed.
"""
VERSION = '1.1'
VERSIONS = {
'1.0': [
{'status': consts.SUPPORTED, 'since': '2016.04'}
]
}
PRIORITY = 500

View File

@ -37,6 +37,12 @@ class RegionPlacementPolicy(base.Policy):
"""Policy for placing members of a cluster across multiple regions."""
VERSION = '1.0'
VERSIONS = {
'1.0': [
{'status': consts.EXPERIMENTAL, 'since': '2016.04'},
{'status': consts.SUPPORTED, 'since': '2016.10'},
]
}
PRIORITY = 200

View File

@ -39,7 +39,12 @@ class ZonePlacementPolicy(base.Policy):
"""Policy for placing members of a cluster across availability zones."""
VERSION = '1.0'
VERSIONS = {
'1.0': [
{'status': consts.EXPERIMENTAL, 'since': '2016.04'},
{'status': consts.SUPPORTED, 'since': '2016.10'},
]
}
PRIORITY = 300
TARGET = [

View File

@ -33,7 +33,9 @@ LOG = logging.getLogger(__name__)
class Profile(object):
'''Base class for profiles.'''
"""Base class for profiles."""
VERSIONS = {}
KEYS = (
TYPE, VERSION, PROPERTIES,

View File

@ -13,6 +13,7 @@
import random
import six
from senlin.common import consts
from senlin.common import context
from senlin.common import exception as exc
from senlin.common.i18n import _
@ -29,6 +30,11 @@ from senlin.profiles import base
class DockerProfile(base.Profile):
"""Profile for a docker container."""
VERSIONS = {
'1.0': [
{'status': consts.EXPERIMENTAL, 'since': '2017.02'}
]
}
_VALID_HOST_TYPES = [
HOST_NOVA_SERVER, HOST_HEAT_STACK,

View File

@ -13,6 +13,7 @@
from oslo_log import log as logging
import six
from senlin.common import consts
from senlin.common import exception as exc
from senlin.common.i18n import _, _LE
from senlin.common import schema
@ -23,11 +24,13 @@ LOG = logging.getLogger(__name__)
class StackProfile(base.Profile):
'''Profile for an OpenStack Heat stack.
"""Profile for an OpenStack Heat stack."""
When this profile is used, the whole cluster is a collection of Heat
stacks.
'''
VERSIONS = {
'1.0': [
{'status': consts.SUPPORTED, 'since': '2016.04'}
]
}
KEYS = (
CONTEXT, TEMPLATE, TEMPLATE_URL, PARAMETERS,

View File

@ -17,6 +17,7 @@ from oslo_utils import encodeutils
import six
from senlin.common import constraints
from senlin.common import consts
from senlin.common import exception as exc
from senlin.common.i18n import _
from senlin.common import schema
@ -26,6 +27,12 @@ from senlin.profiles import base
class ServerProfile(base.Profile):
"""Profile for an OpenStack Nova server."""
VERSIONS = {
'1.0': [
{'status': consts.SUPPORTED, 'since': '2016.04'}
]
}
KEYS = (
CONTEXT, ADMIN_PASS, AUTO_DISK_CONFIG, AVAILABILITY_ZONE,
BLOCK_DEVICE_MAPPING_V2,