Merge "NetApp ONTAP: cifs add AD security service server as preferred DC"
This commit is contained in:
commit
a724e3c276
@ -1409,6 +1409,7 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
|
|||||||
def configure_active_directory(self, security_service, vserver_name):
|
def configure_active_directory(self, security_service, vserver_name):
|
||||||
"""Configures AD on Vserver."""
|
"""Configures AD on Vserver."""
|
||||||
self.configure_dns(security_service)
|
self.configure_dns(security_service)
|
||||||
|
self.set_preferred_dc(security_service)
|
||||||
|
|
||||||
# 'cifs-server' is CIFS Server NetBIOS Name, max length is 15.
|
# 'cifs-server' is CIFS Server NetBIOS Name, max length is 15.
|
||||||
# Should be unique within each domain (data['domain']).
|
# Should be unique within each domain (data['domain']).
|
||||||
@ -1511,6 +1512,26 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
|
|||||||
msg = _("Failed to configure DNS. %s")
|
msg = _("Failed to configure DNS. %s")
|
||||||
raise exception.NetAppException(msg % e.message)
|
raise exception.NetAppException(msg % e.message)
|
||||||
|
|
||||||
|
@na_utils.trace
|
||||||
|
def set_preferred_dc(self, security_service):
|
||||||
|
# server is optional
|
||||||
|
if not security_service['server']:
|
||||||
|
return
|
||||||
|
|
||||||
|
api_args = {
|
||||||
|
'preferred-dc': [],
|
||||||
|
'domain': security_service['domain'],
|
||||||
|
}
|
||||||
|
|
||||||
|
for dc_ip in security_service['server'].split(','):
|
||||||
|
api_args['preferred-dc'].append({'string': dc_ip.strip()})
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.send_request('cifs-domain-preferred-dc-add', api_args)
|
||||||
|
except netapp_api.NaApiError as e:
|
||||||
|
msg = _("Failed to set preferred DC. %s")
|
||||||
|
raise exception.NetAppException(msg % e.message)
|
||||||
|
|
||||||
@na_utils.trace
|
@na_utils.trace
|
||||||
def create_volume(self, aggregate_name, volume_name, size_gb,
|
def create_volume(self, aggregate_name, volume_name, size_gb,
|
||||||
thin_provisioned=False, snapshot_policy=None,
|
thin_provisioned=False, snapshot_policy=None,
|
||||||
|
@ -421,6 +421,7 @@ CIFS_SECURITY_SERVICE = {
|
|||||||
'ou': 'fake_ou',
|
'ou': 'fake_ou',
|
||||||
'domain': 'fake_domain',
|
'domain': 'fake_domain',
|
||||||
'dns_ip': 'fake_dns_ip',
|
'dns_ip': 'fake_dns_ip',
|
||||||
|
'server': '',
|
||||||
}
|
}
|
||||||
|
|
||||||
LDAP_SECURITY_SERVICE = {
|
LDAP_SECURITY_SERVICE = {
|
||||||
|
@ -2492,6 +2492,7 @@ class NetAppClientCmodeTestCase(test.TestCase):
|
|||||||
|
|
||||||
self.mock_object(self.client, 'send_request')
|
self.mock_object(self.client, 'send_request')
|
||||||
self.mock_object(self.client, 'configure_dns')
|
self.mock_object(self.client, 'configure_dns')
|
||||||
|
self.mock_object(self.client, 'set_preferred_dc')
|
||||||
|
|
||||||
self.client.configure_active_directory(fake.CIFS_SECURITY_SERVICE,
|
self.client.configure_active_directory(fake.CIFS_SECURITY_SERVICE,
|
||||||
fake.VSERVER_NAME)
|
fake.VSERVER_NAME)
|
||||||
@ -2511,6 +2512,8 @@ class NetAppClientCmodeTestCase(test.TestCase):
|
|||||||
|
|
||||||
self.client.configure_dns.assert_called_with(
|
self.client.configure_dns.assert_called_with(
|
||||||
fake.CIFS_SECURITY_SERVICE)
|
fake.CIFS_SECURITY_SERVICE)
|
||||||
|
self.client.set_preferred_dc.assert_called_with(
|
||||||
|
fake.CIFS_SECURITY_SERVICE)
|
||||||
self.client.send_request.assert_has_calls([
|
self.client.send_request.assert_has_calls([
|
||||||
mock.call('cifs-server-create', cifs_server_create_args)])
|
mock.call('cifs-server-create', cifs_server_create_args)])
|
||||||
|
|
||||||
@ -2703,6 +2706,37 @@ class NetAppClientCmodeTestCase(test.TestCase):
|
|||||||
self.client.configure_dns,
|
self.client.configure_dns,
|
||||||
fake.KERBEROS_SECURITY_SERVICE)
|
fake.KERBEROS_SECURITY_SERVICE)
|
||||||
|
|
||||||
|
@ddt.data('', '10.0.0.1', ['10.0.0.2', '10.0.0.3'])
|
||||||
|
def test_set_preferred_dc(self, server):
|
||||||
|
|
||||||
|
self.mock_object(self.client, 'send_request')
|
||||||
|
security_service = copy.deepcopy(fake.CIFS_SECURITY_SERVICE)
|
||||||
|
security_service['server'] = ', '.join(server)
|
||||||
|
|
||||||
|
self.client.set_preferred_dc(security_service)
|
||||||
|
|
||||||
|
if server is '':
|
||||||
|
self.client.send_request.assert_not_called()
|
||||||
|
else:
|
||||||
|
preferred_dc_add_args = {
|
||||||
|
'domain': fake.CIFS_SECURITY_SERVICE['domain'],
|
||||||
|
'preferred-dc': [{'string': dc_ip} for dc_ip in server]
|
||||||
|
}
|
||||||
|
|
||||||
|
self.client.send_request.assert_has_calls([
|
||||||
|
mock.call('cifs-domain-preferred-dc-add',
|
||||||
|
preferred_dc_add_args)])
|
||||||
|
|
||||||
|
def test_set_preferred_dc_api_error(self):
|
||||||
|
|
||||||
|
self.mock_object(self.client, 'send_request', self._mock_api_error())
|
||||||
|
security_service = copy.deepcopy(fake.CIFS_SECURITY_SERVICE)
|
||||||
|
security_service['server'] = 'fake_server'
|
||||||
|
|
||||||
|
self.assertRaises(exception.NetAppException,
|
||||||
|
self.client.set_preferred_dc,
|
||||||
|
security_service)
|
||||||
|
|
||||||
def test_create_volume(self):
|
def test_create_volume(self):
|
||||||
|
|
||||||
self.mock_object(self.client, 'send_request')
|
self.mock_object(self.client, 'send_request')
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
For NetApp CIFS share provisioning users can now specify the optional
|
||||||
|
"server" API parameter to provide an active directory domain controller IP
|
||||||
|
address for when creating a security service. Multiple IP addresses can be
|
||||||
|
given separated by comma. This represents the "Preferred DC" at the vserver
|
||||||
|
cifs domain.
|
Loading…
Reference in New Issue
Block a user