Skip to content

Commit

Permalink
Allow the server name limit to be configurable
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Joshua Harlow committed May 12, 2016
1 parent a2d829f commit 8ac7fa0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
7 changes: 7 additions & 0 deletions heat/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@
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,
Expand Down
7 changes: 4 additions & 3 deletions heat/engine/resources/aws/ec2/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'

Expand Down
5 changes: 2 additions & 3 deletions heat/engine/resources/openstack/nova/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
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__)

Expand Down Expand Up @@ -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'

Expand Down
Original file line number Diff line number Diff line change
@@ -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).

0 comments on commit 8ac7fa0

Please sign in to comment.