Add ha options and fix get_dns_hosts

This commit is contained in:
Hui Xiang 2014-12-08 16:41:28 +08:00
parent 84ba5044b1
commit 4e271798f7
2 changed files with 19 additions and 4 deletions

View File

@ -127,3 +127,15 @@ options:
default: False
dns_hosts:
type: string
ha-bindiface:
type: string
default: eth0
description: |
Default network interface on which HA cluster will bind to communicate
with the other members of the HA Cluster.
ha-mcastport:
type: int
default: 5409
description: |
Default multicast port number that will be used to communicate between
HA Cluster nodes.

View File

@ -590,10 +590,13 @@ def configure_ovs():
def get_dns_host():
dns_hosts = ['8.8.8.8 ']
try:
nameservers = subprocess.check_output(['grep', 'nameserver',
'/etc/resolv.conf'])
for ns in nameservers:
dns_hosts.append(ns.split(' ')[1].split('\n')[0].strip() + ' ')
output = subprocess.check_output(['grep', 'nameserver',
'/etc/resolv.conf'])
nameservers = output.split('\n')
hosts = [(ns.split(' ')[1].split('\n')[0].strip() + ' ')
for ns in nameservers if ns.startswith('nameserver')
and ns.split(' ')[1]]
dns_hosts.append(hosts)
except Exception:
log('Failed to get nameserver from resolv.conf !', level=ERROR)