Merge "NetApp ONTAP: allow multiple DNS IPs"

This commit is contained in:
Zuul 2019-03-07 17:29:56 +00:00 committed by Gerrit Code Review
commit c3d697e514
4 changed files with 36 additions and 10 deletions

View File

@ -21,7 +21,8 @@ types:
You can configure a security service with these options:
- A DNS IP address.
- A DNS IP address. Some drivers may allow a comma separated list of multiple
addresses, e.g. NetApp ONTAP.
- An IP address or host name.

View File

@ -1498,11 +1498,12 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
'domains': {
'string': security_service['domain'],
},
'name-servers': {
'ip-address': security_service['dns_ip'],
},
'name-servers': [],
'dns-state': 'enabled',
}
for dns_ip in security_service['dns_ip'].split(','):
api_args['name-servers'].append({'ip-address': dns_ip.strip()})
try:
self.send_request('net-dns-create', api_args)
except netapp_api.NaApiError as e:

View File

@ -2652,15 +2652,33 @@ class NetAppClientCmodeTestCase(test.TestCase):
net_dns_create_args = {
'domains': {'string': fake.CIFS_SECURITY_SERVICE['domain']},
'name-servers': {
'name-servers': [{
'ip-address': fake.CIFS_SECURITY_SERVICE['dns_ip']
},
}],
'dns-state': 'enabled'
}
self.client.send_request.assert_has_calls([
mock.call('net-dns-create', net_dns_create_args)])
def test_configure_dns_multiple_dns_ip(self):
self.mock_object(self.client, 'send_request')
mock_dns_ips = ['10.0.0.1', '10.0.0.2', '10.0.0.3']
security_service = fake.CIFS_SECURITY_SERVICE
security_service['dns_ip'] = ', '.join(mock_dns_ips)
self.client.configure_dns(security_service)
net_dns_create_args = {
'domains': {'string': security_service['domain']},
'dns-state': 'enabled',
'name-servers': [{'ip-address': dns_ip} for dns_ip in mock_dns_ips]
}
self.client.send_request.assert_has_calls([
mock.call('net-dns-create', net_dns_create_args)])
def test_configure_dns_for_kerberos(self):
self.mock_object(self.client, 'send_request')
@ -2669,9 +2687,9 @@ class NetAppClientCmodeTestCase(test.TestCase):
net_dns_create_args = {
'domains': {'string': fake.KERBEROS_SECURITY_SERVICE['domain']},
'name-servers': {
'name-servers': [{
'ip-address': fake.KERBEROS_SECURITY_SERVICE['dns_ip']
},
}],
'dns-state': 'enabled'
}
@ -2688,9 +2706,9 @@ class NetAppClientCmodeTestCase(test.TestCase):
net_dns_create_args = {
'domains': {'string': fake.KERBEROS_SECURITY_SERVICE['domain']},
'name-servers': {
'name-servers': [{
'ip-address': fake.KERBEROS_SECURITY_SERVICE['dns_ip']
},
}],
'dns-state': 'enabled'
}

View File

@ -0,0 +1,6 @@
---
features:
- |
The NetApp ONTAP driver security service dns_ip parameter also takes a list
of comma separated DNS IPs for vserver dns configuration. Allows HA setup,
where DNS can be down for maintenance.