diff --git a/doc/source/configuration/tables/manila-netapp.inc b/doc/source/configuration/tables/manila-netapp.inc index 36ea6c4468..ad0de5e4b0 100644 --- a/doc/source/configuration/tables/manila-netapp.inc +++ b/doc/source/configuration/tables/manila-netapp.inc @@ -53,4 +53,4 @@ * - ``netapp_volume_snapshot_reserve_percent`` = ``5`` - (Integer) The percentage of share space set aside as reserve for snapshot usage; valid values range from 0 to 90. * - ``netapp_vserver_name_template`` = ``os_%s`` - - (String) Name template to use for new Vserver. + - (String) Name template to use for new Vserver. When using CIFS protocol make sure to not configure characters illegal in DNS hostnames. diff --git a/manila/share/drivers/netapp/dataontap/client/client_cmode.py b/manila/share/drivers/netapp/dataontap/client/client_cmode.py index dd69cf0924..649243f46d 100644 --- a/manila/share/drivers/netapp/dataontap/client/client_cmode.py +++ b/manila/share/drivers/netapp/dataontap/client/client_cmode.py @@ -1381,7 +1381,11 @@ class NetAppCmodeClient(client_base.NetAppBaseClient): # 'cifs-server' is CIFS Server NetBIOS Name, max length is 15. # Should be unique within each domain (data['domain']). - cifs_server = (vserver_name[0:7] + '..' + vserver_name[-6:]).upper() + # Cut to 15 char with begin and end, attempt to make valid DNS hostname + cifs_server = (vserver_name[0:8] + + '-' + + vserver_name[-6:]).replace('_', '-').upper() + api_args = { 'admin-username': security_service['user'], 'admin-password': security_service['password'], diff --git a/manila/share/drivers/netapp/options.py b/manila/share/drivers/netapp/options.py index 5dcb779b44..534b32b26a 100644 --- a/manila/share/drivers/netapp/options.py +++ b/manila/share/drivers/netapp/options.py @@ -71,7 +71,9 @@ netapp_provisioning_opts = [ default='share_%(share_id)s'), cfg.StrOpt('netapp_vserver_name_template', default='os_%s', - help='Name template to use for new Vserver.'), + help='Name template to use for new Vserver. ' + 'When using CIFS protocol make sure to not ' + 'configure characters illegal in DNS hostnames.'), cfg.StrOpt('netapp_qos_policy_group_name_template', help='NetApp QoS policy group name template.', default='qos_share_%(share_id)s'), diff --git a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py index bb07d6b135..76a5a98542 100644 --- a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py +++ b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py @@ -2434,8 +2434,10 @@ class NetAppClientCmodeTestCase(test.TestCase): self.client.configure_active_directory(fake.CIFS_SECURITY_SERVICE, fake.VSERVER_NAME) - cifs_server = ( - fake.VSERVER_NAME[0:7] + '..' + fake.VSERVER_NAME[-6:]).upper() + cifs_server = (fake.VSERVER_NAME[0:8] + + '-' + + fake.VSERVER_NAME[-6:]).replace('_', '-').upper() + cifs_server_create_args = { 'admin-username': fake.CIFS_SECURITY_SERVICE['user'], 'admin-password': fake.CIFS_SECURITY_SERVICE['password'],