Allow the server name limit to be configurable

For some deployments 53 may be to high of a value and
a lower value may be used (ie for registration into active
directory, which has lower name limits) so add the ability
to reduce the valid length of server names (but
preserve the current limits by default).

Change-Id: Icd06aba14dbf156b9164b0e25233f2df7099fc9b
This commit is contained in:
Joshua Harlow 2016-04-15 16:27:09 -07:00
parent a2d829f312
commit 8ac7fa0206
4 changed files with 19 additions and 6 deletions

View File

@ -132,6 +132,13 @@ engine_opts = [
help=_('Number of times to retry when a client encounters an '
'expected intermittent error. Set to 0 to disable '
'retries.')),
# Server host name limit to 53 characters by due to typical default
# linux HOST_NAME_MAX of 64, minus the .novalocal appended to the name
cfg.IntOpt('max_server_name_length',
default=53,
max=53,
help=_('Maximum length of a server name to be used '
'in nova.')),
cfg.IntOpt('max_interface_check_attempts',
min=1,
default=10,

View File

@ -13,9 +13,12 @@
import copy
from oslo_config import cfg
from oslo_log import log as logging
import six
cfg.CONF.import_opt('max_server_name_length', 'heat.common.config')
from heat.common import exception
from heat.common.i18n import _
from heat.common.i18n import _LI
@ -340,9 +343,7 @@ class Instance(resource.Resource, sh.SchedulerHintsMixin):
),
}
# Server host name limit to 53 characters by due to typical default
# linux HOST_NAME_MAX of 64, minus the .novalocal appended to the name
physical_resource_name_limit = 53
physical_resource_name_limit = cfg.CONF.max_server_name_length
default_client_name = 'nova'

View File

@ -38,6 +38,7 @@ from heat.engine import translation
from heat.rpc import api as rpc_api
cfg.CONF.import_opt('default_software_config_transport', 'heat.common.config')
cfg.CONF.import_opt('max_server_name_length', 'heat.common.config')
LOG = logging.getLogger(__name__)
@ -577,9 +578,7 @@ class Server(stack_user.StackUser, sh.SchedulerHintsMixin,
),
}
# Server host name limit to 53 characters by due to typical default
# linux HOST_NAME_MAX of 64, minus the .novalocal appended to the name
physical_resource_name_limit = 53
physical_resource_name_limit = cfg.CONF.max_server_name_length
default_client_name = 'nova'

View File

@ -0,0 +1,6 @@
---
features:
- Adds new 'max_server_name_length' configuration option
which defaults to the prior upper bound (53) and can be
lowered by users (if they need to, for example due to
ldap or other internal name limit restrictions).