Change in vdsm[master]: net: Introduce nameservers (dns) network api
by edwardh@redhat.com
Edward Haas has uploaded a new change for review.
Change subject: net: Introduce nameservers (dns) network api
......................................................................
net: Introduce nameservers (dns) network api
oVirt is required to preserved and manage the nameservers for the host.
This patch introduces the api layer through which nameservers may be
set.
Nameservers can be set through setupNetworks verb, using the 'nameservers'
key in the networks sub-verb where the value is a list of nameservers.
Canonization: In case the key is missing, it will be populated with the
current dns setting (from resolv.conf) for the management network
(identified by the defaultRoute flag).
Change-Id: Ic9b0d0370951fe3985f61e550374eb63eb2cf161
Signed-off-by: Edward Haas <edwardh(a)redhat.com>
---
M lib/api/vdsm-api.yml
M lib/vdsm/network/api.py
M lib/vdsm/network/canonicalize.py
M lib/vdsm/network/kernelconfig.py
4 files changed, 26 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/39/61739/1
diff --git a/lib/api/vdsm-api.yml b/lib/api/vdsm-api.yml
index a99c488..4ac51e4 100644
--- a/lib/api/vdsm-api.yml
+++ b/lib/api/vdsm-api.yml
@@ -5305,6 +5305,13 @@
type: boolean
- defaultvalue: no-default
+ description: List of nameservers
+ name: nameservers
+ type:
+ - string
+ added: '4.0'
+
+ - defaultvalue: no-default
description: Specify Switch. Legacy is used if not passed
name: switch
type: string
diff --git a/lib/vdsm/network/api.py b/lib/vdsm/network/api.py
index 151b469..a09ebfb 100644
--- a/lib/vdsm/network/api.py
+++ b/lib/vdsm/network/api.py
@@ -217,6 +217,7 @@
ipv6autoconf="0|1"
dhcpv6="0|1"
defaultRoute=True|False
+ nameservers=[<dns1>, <dns2> ...]"
switch="legacy|..."
(other options will be passed to the config file AS-IS)
-- OR --
diff --git a/lib/vdsm/network/canonicalize.py b/lib/vdsm/network/canonicalize.py
index 3c2da55..34b97dc 100644
--- a/lib/vdsm/network/canonicalize.py
+++ b/lib/vdsm/network/canonicalize.py
@@ -21,7 +21,7 @@
import six
-from .netinfo import (bridges, mtus, bonding)
+from .netinfo import (bridges, mtus, bonding, dns)
from vdsm import utils
from .errors import ConfigNetworkError
@@ -46,6 +46,7 @@
_canonicalize_ipv6(attrs)
_canonicalize_switch_type_net(attrs)
_canonicalize_ip_default_route(attrs)
+ _canonicalize_nameservers(attrs)
def canonicalize_bondings(bonds):
@@ -128,3 +129,12 @@
def _canonicalize_ip_default_route(data):
if 'defaultRoute' not in data:
data['defaultRoute'] = False
+
+
+def _canonicalize_nameservers(data):
+ if 'nameservers' not in data:
+ # Nameservers are relevant only for the management network.
+ if data['defaultRoute']:
+ data['nameservers'] = dns.get_host_nameservers()
+ else:
+ data['nameservers'] = []
diff --git a/lib/vdsm/network/kernelconfig.py b/lib/vdsm/network/kernelconfig.py
index a125e69..abb73cf 100644
--- a/lib/vdsm/network/kernelconfig.py
+++ b/lib/vdsm/network/kernelconfig.py
@@ -26,6 +26,7 @@
from vdsm.network.netinfo import addresses
from vdsm.network.netinfo import bonding
from vdsm.network.netinfo import bridges
+from vdsm.network.netinfo import dns
from vdsm.network.netinfo import routes
from vdsm.network.netconfpersistence import BaseConfig
@@ -84,6 +85,7 @@
_translate_ipaddr(attributes, net_attr)
_translate_hostqos(attributes, net_attr)
_translate_switch_type(attributes, net_attr)
+ _translate_nameservers(attributes)
return attributes
@@ -157,6 +159,11 @@
attributes['switch'] = net_attr['switch']
+def _translate_nameservers(attributes):
+ nservers = dns.get_host_nameservers() if attributes['defaultRoute'] else []
+ attributes['nameservers'] = nservers
+
+
def _remove_zero_values_in_net_qos(net_qos):
"""
net_qos = {'out': {
--
To view, visit https://gerrit.ovirt.org/61739
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9b0d0370951fe3985f61e550374eb63eb2cf161
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Edward Haas <edwardh(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: Adding network functional tests to check-merged job
by automation@ovirt.org
gerrit-hooks has posted comments on this change.
Change subject: Adding network functional tests to check-merged job
......................................................................
Patch Set 9:
* Update tracker: IGNORE, no Bug-Url found
--
To view, visit https://gerrit.ovirt.org/53902
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9e0c2c0e0c40bf9d269bfe1f0c3ca2b78f51ed69
Gerrit-PatchSet: 9
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: No
7 years, 9 months
Change in vdsm[master]: configs: move sudoers to static
by ybronhei@redhat.com
Yaniv Bronhaim has posted comments on this change.
Change subject: configs: move sudoers to static
......................................................................
Patch Set 5:
(1 comment)
https://gerrit.ovirt.org/#/c/61603/5/static/Makefile.am
File static/Makefile.am:
PS5, Line 60: chmod
> This fully makes sense. But now I'm wondering: why do we need to rename aft
+1. please if you do more than just moving the files, specify everything you changed in the commit msg .
--
To view, visit https://gerrit.ovirt.org/61603
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2fd006ff4fdafbe436974f868e461c105ae0dba1
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: Yes
7 years, 9 months
Change in vdsm[master]: configs: move sudoers to static
by fromani@redhat.com
Francesco Romani has posted comments on this change.
Change subject: configs: move sudoers to static
......................................................................
Patch Set 5:
(2 comments)
https://gerrit.ovirt.org/#/c/61603/5/static/Makefile.am
File static/Makefile.am:
PS5, Line 58: mv
> Because we're renaming the file.
Makes sense, see below for a little followup
PS5, Line 60: chmod
> After discussing further with vfeenstra, in this case install and mkdir are
This fully makes sense. But now I'm wondering: why do we need to rename after all?
Could be even simpler if we arrange our static dir to mirror the final layout, so no rename is needed.
e.g
static/sudoers.vdsm[.in]
becomes
static/sudoers.d/50_vdsm[.in]
IMO this is a bit clearer and easier to manage
just an idea, feel free to postpone/discard
--
To view, visit https://gerrit.ovirt.org/61603
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2fd006ff4fdafbe436974f868e461c105ae0dba1
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: Yes
7 years, 9 months
Change in vdsm[master]: configs: move sudoers to static
by Martin Polednik
Martin Polednik has posted comments on this change.
Change subject: configs: move sudoers to static
......................................................................
Patch Set 5:
(2 comments)
https://gerrit.ovirt.org/#/c/61603/5/static/Makefile.am
File static/Makefile.am:
PS5, Line 58: mv
> why mv and not cp?
Because we're renaming the file.
PS5, Line 60: chmod
> Agreed on the install; unsure about the dir: it is created somewhere in the
After discussing further with vfeenstra, in this case install and mkdir are *wrong*. The directory is created by autotools as it is one of dir suffixed variables, and install is supposed to be used to copy file from one location to other, this is a rename.
--
To view, visit https://gerrit.ovirt.org/61603
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2fd006ff4fdafbe436974f868e461c105ae0dba1
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: Yes
7 years, 9 months
Change in vdsm[master]: netinfo: report DNS search domains from /etc/resolv.conf
by osvoboda@redhat.com
Ondřej Svoboda has uploaded a new change for review.
Change subject: netinfo: report DNS search domains from /etc/resolv.conf
......................................................................
netinfo: report DNS search domains from /etc/resolv.conf
The search domains are specified in /etc/resolv.conf either
using 'domain' or 'search' directives. The former takes
a single domain name, while the latter takes a list.
Only the last directive is used and serves to translate short
host names to fully qualified domain names (FQDN).
'searchDomains' is now a part of host capabilities, alongside
the recently renamed 'nameservers'.
Change-Id: I6305a8861e7e82441085bcb68c2c5cf1ec52ee51
Signed-off-by: Ondřej Svoboda <osvoboda(a)redhat.com>
---
M lib/api/vdsm-api.yml
M lib/vdsm/network/canonicalize.py
M lib/vdsm/network/kernelconfig.py
M lib/vdsm/network/netinfo/cache.py
M lib/vdsm/network/netinfo/dns.py
M tests/network/netinfo_test.py
6 files changed, 35 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/61794/1
diff --git a/lib/api/vdsm-api.yml b/lib/api/vdsm-api.yml
index e794e77..a6790c9 100644
--- a/lib/api/vdsm-api.yml
+++ b/lib/api/vdsm-api.yml
@@ -6462,6 +6462,12 @@
- string
added: '4.0'
+ - description: DNS search domains from /etc/resolve.conf
+ name: searchDomains
+ type:
+ - string
+ added: '4.0'
+
- description: Distance information between each two numa nodes
name: numaNodeDistance
type: *NumaNodeDistanceMap
diff --git a/lib/vdsm/network/canonicalize.py b/lib/vdsm/network/canonicalize.py
index b0bc983..71a8f5a 100644
--- a/lib/vdsm/network/canonicalize.py
+++ b/lib/vdsm/network/canonicalize.py
@@ -135,6 +135,7 @@
if 'nameservers' not in data:
# Nameservers are relevant only for the management network.
if data['defaultRoute']:
- data['nameservers'] = dns.get_host_nameservers()
+ nameservers, _ = dns.get_resolver_config()
+ data['nameservers'] = nameservers
else:
data['nameservers'] = []
diff --git a/lib/vdsm/network/kernelconfig.py b/lib/vdsm/network/kernelconfig.py
index abb73cf..e4e1fc4 100644
--- a/lib/vdsm/network/kernelconfig.py
+++ b/lib/vdsm/network/kernelconfig.py
@@ -160,8 +160,11 @@
def _translate_nameservers(attributes):
- nservers = dns.get_host_nameservers() if attributes['defaultRoute'] else []
- attributes['nameservers'] = nservers
+ if attributes['defaultRoute']:
+ nameservers, _ = dns.get_resolver_config()
+ else:
+ nameservers = []
+ attributes['nameservers'] = nameservers
def _remove_zero_values_in_net_qos(net_qos):
diff --git a/lib/vdsm/network/netinfo/cache.py b/lib/vdsm/network/netinfo/cache.py
index 26c0b8d..5376b0b 100644
--- a/lib/vdsm/network/netinfo/cache.py
+++ b/lib/vdsm/network/netinfo/cache.py
@@ -37,7 +37,7 @@
from . import bridges
from .dhcp import (propose_updates_to_reported_dhcp, update_reported_dhcp,
dhcp_status, dhcp_faked_status)
-from .dns import get_host_nameservers
+from .dns import get_resolver_config
from .mtus import getMtu
from . import nics
from . import vlans
@@ -59,8 +59,10 @@
retrieving data from libvirt.
:return: Dict of networking devices with all their details.
"""
+ nameservers, search_domains = get_resolver_config()
networking = {'bondings': {}, 'bridges': {}, 'networks': {}, 'nics': {},
- 'vlans': {}, 'nameservers': get_host_nameservers()}
+ 'vlans': {}, 'nameservers': nameservers,
+ 'searchDomains': search_domains}
paddr = bonding.permanent_address()
ipaddrs = getIpAddrs()
routes = get_routes()
diff --git a/lib/vdsm/network/netinfo/dns.py b/lib/vdsm/network/netinfo/dns.py
index 674f176..66f4966 100644
--- a/lib/vdsm/network/netinfo/dns.py
+++ b/lib/vdsm/network/netinfo/dns.py
@@ -21,19 +21,27 @@
DNS_CONF_FILE = '/etc/resolv.conf'
-def get_host_nameservers():
- """Returns a list of nameservers listed in /etc/resolv.conf"""
+def get_resolver_config():
+ """
+ Return a list of nameservers and a list of search domains as listed in
+ /etc/resolv.conf
+ """
with open(DNS_CONF_FILE, 'r') as file_object:
file_text = file_object.read()
- return _parse_dnss(file_text)
+ return _parse_resolver_configuration(file_text)
-def _parse_dnss(file_text):
+def _parse_resolver_configuration(file_text):
nameservers = []
+ search_domains = []
for line in file_text.splitlines():
words = line.strip().split()
if len(words) < 2:
continue
if words[0] == 'nameserver':
nameservers.append(words[1])
- return nameservers
+ elif words[0] in ('domain', 'search'):
+ # According to resolv.conf(5) "the last instance [of a 'domain' or
+ # 'search' line] wins".
+ search_domains = words[1:]
+ return nameservers, search_domains
diff --git a/tests/network/netinfo_test.py b/tests/network/netinfo_test.py
index 06dfb56..25875d3 100644
--- a/tests/network/netinfo_test.py
+++ b/tests/network/netinfo_test.py
@@ -57,7 +57,8 @@
'nameserver 8.8.8.8\n'
'nameserver 8.8.4.4\n'
)
- dnss = ['192.168.0.100', '8.8.8.8', '8.8.4.4']
+ expected_nameservers = ['192.168.0.100', '8.8.8.8', '8.8.4.4']
+ expected_search_domains = ['example.com'] # 'domain' won over 'search'
with namedTemporaryDir() as temp_dir:
file_path = os.path.join(temp_dir, 'resolv.conf')
@@ -66,8 +67,9 @@
with open(file_path, 'w') as file_object:
file_object.write(content)
- self.assertEqual(
- dns.get_host_nameservers(), dnss)
+ nameservers, search_domains = dns.get_resolver_config()
+ self.assertEqual(nameservers, expected_nameservers)
+ self.assertEqual(search_domains, expected_search_domains)
def testNetmaskConversions(self):
path = os.path.join(os.path.dirname(__file__), "netmaskconversions")
--
To view, visit https://gerrit.ovirt.org/61794
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6305a8861e7e82441085bcb68c2c5cf1ec52ee51
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: network: preserve the current 'search domains' as well
by osvoboda@redhat.com
Ondřej Svoboda has uploaded a new change for review.
Change subject: network: preserve the current 'search domains' as well
......................................................................
network: preserve the current 'search domains' as well
Change-Id: Ib001c04e527f1bdce94f56a15a0dbbfe88155754
Signed-off-by: Ondřej Svoboda <osvoboda(a)redhat.com>
---
M lib/vdsm/network/configurators/ifcfg.py
M lib/vdsm/network/legacy_switch.py
M lib/vdsm/network/models.py
M lib/vdsm/network/netinfo/cache.py
M lib/vdsm/network/netinfo/dns.py
5 files changed, 14 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/61476/1
diff --git a/lib/vdsm/network/configurators/ifcfg.py b/lib/vdsm/network/configurators/ifcfg.py
index e926d2e..f9e6cbf 100644
--- a/lib/vdsm/network/configurators/ifcfg.py
+++ b/lib/vdsm/network/configurators/ifcfg.py
@@ -557,6 +557,9 @@
if device.nameservers and ipv4.defaultRoute:
for i, nameserver in enumerate(device.nameservers[0:2], 1):
conf += 'DNS{}={}\n'.format(i, nameserver)
+ if device.search_domains:
+ conf += 'DOMAIN={}\n'.format(pipes.quote(
+ ' '.join(device.search_domains)))
ifcfg_file = NET_CONF_PREF + name
hook_dict = {'ifcfg_file': ifcfg_file,
diff --git a/lib/vdsm/network/legacy_switch.py b/lib/vdsm/network/legacy_switch.py
index 796bc6b..abc6eaa 100644
--- a/lib/vdsm/network/legacy_switch.py
+++ b/lib/vdsm/network/legacy_switch.py
@@ -162,6 +162,7 @@
top_net_dev.blockingdhcp = (configurator._inRollback or
utils.tobool(blockingdhcp))
top_net_dev.nameservers = _netinfo.nameservers
+ top_net_dev.search_domains = _netinfo.search_domains
return top_net_dev
diff --git a/lib/vdsm/network/models.py b/lib/vdsm/network/models.py
index ce08182..469f5ee 100644
--- a/lib/vdsm/network/models.py
+++ b/lib/vdsm/network/models.py
@@ -42,6 +42,7 @@
self.master = None
self.duid_source = None
self.nameservers = None
+ self.search_domains = None
def __iter__(self):
raise NotImplementedError
diff --git a/lib/vdsm/network/netinfo/cache.py b/lib/vdsm/network/netinfo/cache.py
index db01b97..d378f35 100644
--- a/lib/vdsm/network/netinfo/cache.py
+++ b/lib/vdsm/network/netinfo/cache.py
@@ -59,8 +59,10 @@
retrieving data from libvirt.
:return: Dict of networking devices with all their details.
"""
+ nameservers, search_domains = get_host_nameservers()
networking = {'bondings': {}, 'bridges': {}, 'networks': {}, 'nics': {},
- 'vlans': {}, 'dnss': get_host_nameservers()}
+ 'vlans': {}, 'dnss': nameservers,
+ 'searchdomains': search_domains}
paddr = bonding.permanent_address()
ipaddrs = getIpAddrs()
routes = get_routes()
@@ -217,6 +219,7 @@
self.bondings = _netinfo['bondings']
self.bridges = _netinfo['bridges']
self.nameservers = _netinfo['dnss']
+ self.search_domains = _netinfo['searchdomains']
def del_network(self, network):
del self.networks[network]
@@ -354,3 +357,4 @@
self.bondings = _netinfo['bondings']
self.bridges = _netinfo['bridges']
self.nameservers = _netinfo['dnss']
+ self.search_domains = _netinfo['searchdomains']
diff --git a/lib/vdsm/network/netinfo/dns.py b/lib/vdsm/network/netinfo/dns.py
index e22714e..43a532c 100644
--- a/lib/vdsm/network/netinfo/dns.py
+++ b/lib/vdsm/network/netinfo/dns.py
@@ -30,10 +30,13 @@
def _parse_dnss(file_text):
dnss = []
+ search_domains = []
for line in file_text.splitlines():
words = line.strip().split()
if len(words) < 2:
continue
if words[0] == 'nameserver':
dnss.append(words[1])
- return dnss
+ elif words[0] == 'search':
+ search_domains.extend(words[1:])
+ return dnss, search_domains
--
To view, visit https://gerrit.ovirt.org/61476
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib001c04e527f1bdce94f56a15a0dbbfe88155754
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: network: introduce DNS search domains to the API
by osvoboda@redhat.com
Ondřej Svoboda has uploaded a new change for review.
Change subject: network: introduce DNS search domains to the API
......................................................................
network: introduce DNS search domains to the API
This patch adds 'searchDomains' key to the 'setupNetworks'
verb. If the key is missing and the network in question is the
management network (bearing the default route), it is completed
with information from /etc/resolv.conf in the same manner as
the previously introduced 'nameservers' key.
Change-Id: Ib3849ebac81a07fbb3b9d1ebc5d517dc143e291f
Signed-off-by: Ondřej Svoboda <osvoboda(a)redhat.com>
---
M lib/api/vdsm-api.yml
M lib/vdsm/network/api.py
M lib/vdsm/network/canonicalize.py
M lib/vdsm/network/kernelconfig.py
4 files changed, 22 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/61795/1
diff --git a/lib/api/vdsm-api.yml b/lib/api/vdsm-api.yml
index a6790c9..a49e071 100644
--- a/lib/api/vdsm-api.yml
+++ b/lib/api/vdsm-api.yml
@@ -5334,6 +5334,13 @@
added: '4.0'
- defaultvalue: no-default
+ description: List of DNS search domains
+ name: searchDomains
+ type:
+ - string
+ added: '4.0'
+
+ - defaultvalue: no-default
description: Specify Switch. Legacy is used if not passed
name: switch
type: string
diff --git a/lib/vdsm/network/api.py b/lib/vdsm/network/api.py
index a09ebfb..0a4abd5 100644
--- a/lib/vdsm/network/api.py
+++ b/lib/vdsm/network/api.py
@@ -218,6 +218,7 @@
dhcpv6="0|1"
defaultRoute=True|False
nameservers=[<dns1>, <dns2> ...]"
+ searchDomains=[<domain1>, <domain2> ...]"
switch="legacy|..."
(other options will be passed to the config file AS-IS)
-- OR --
diff --git a/lib/vdsm/network/canonicalize.py b/lib/vdsm/network/canonicalize.py
index 71a8f5a..c666f58 100644
--- a/lib/vdsm/network/canonicalize.py
+++ b/lib/vdsm/network/canonicalize.py
@@ -46,7 +46,7 @@
_canonicalize_ipv6(attrs)
_canonicalize_switch_type_net(attrs)
_canonicalize_ip_default_route(attrs)
- _canonicalize_nameservers(attrs)
+ _canonicalize_nameservers_and_search_domains(attrs)
def canonicalize_bondings(bonds):
@@ -131,11 +131,14 @@
data['defaultRoute'] = False
-def _canonicalize_nameservers(data):
+def _canonicalize_nameservers_and_search_domains(data):
if 'nameservers' not in data:
- # Nameservers are relevant only for the management network.
+ # Nameservers and search domains are relevant only for the management
+ # network.
if data['defaultRoute']:
- nameservers, _ = dns.get_resolver_config()
- data['nameservers'] = nameservers
+ nameservers, search_domains = dns.get_resolver_config()
else:
- data['nameservers'] = []
+ nameservers = []
+ search_domains = []
+ data['nameservers'] = nameservers
+ data['searchDomains'] = search_domains
diff --git a/lib/vdsm/network/kernelconfig.py b/lib/vdsm/network/kernelconfig.py
index e4e1fc4..3ed15cd 100644
--- a/lib/vdsm/network/kernelconfig.py
+++ b/lib/vdsm/network/kernelconfig.py
@@ -85,7 +85,7 @@
_translate_ipaddr(attributes, net_attr)
_translate_hostqos(attributes, net_attr)
_translate_switch_type(attributes, net_attr)
- _translate_nameservers(attributes)
+ _translate_nameservers_and_search_domains(attributes)
return attributes
@@ -159,12 +159,14 @@
attributes['switch'] = net_attr['switch']
-def _translate_nameservers(attributes):
+def _translate_nameservers_and_search_domains(attributes):
if attributes['defaultRoute']:
- nameservers, _ = dns.get_resolver_config()
+ nameservers, search_domains = dns.get_resolver_config()
else:
nameservers = []
+ search_domains = []
attributes['nameservers'] = nameservers
+ attributes['searchDomains'] = search_domains
def _remove_zero_values_in_net_qos(net_qos):
--
To view, visit https://gerrit.ovirt.org/61795
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3849ebac81a07fbb3b9d1ebc5d517dc143e291f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: mount: Support NFS4 mounts with double slash
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: mount: Support NFS4 mounts with double slash
......................................................................
mount: Support NFS4 mounts with double slash
With NFS4, the kernel may present fs_spec using double slashes [1]:
noveria.wodel.wd://vmengine
Instead of the original (normalized) mount path:
noveria.wodel.wd:/vmengine
According to [2], this is unlikely to be fixed in the near future.
This patch normalizes fs_spec read from /proc/mounts, restoring
Mount.isMounted() with NFS4.
[1] http://lists.ovirt.org/pipermail/users/2016-July/041519.html
[2] http://www.spinics.net/lists/util-linux-ng/msg13079.html
Change-Id: Iee85efb6aaff5d3fe887d11d7c4a5045ae72ea57
Reported-By: wodel youchi <wodel.youchi(a)gmail.com>
Bug-Url: XXX
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M lib/vdsm/storage/mount.py
M tests/mountTests.py
2 files changed, 21 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/61579/1
diff --git a/lib/vdsm/storage/mount.py b/lib/vdsm/storage/mount.py
index da1179e..dd54225 100644
--- a/lib/vdsm/storage/mount.py
+++ b/lib/vdsm/storage/mount.py
@@ -35,6 +35,8 @@
from vdsm import supervdsm
from vdsm import utils
+from vdsm.storage import fileUtils
+
# Common vfs types
VFS_NFS = "nfs"
@@ -58,9 +60,11 @@
fs_freq = int(fs_freq)
fs_passno = int(fs_passno)
- # We expect normalized inputs for
- # fs_spec and fs_file from the kernel.
- fs_spec = _parseFstabPath(fs_spec)
+ # Using NFS4 the kernel shows the mount path with double slashes,
+ # regarless of the original (normalized) mount path.
+ fs_spec = fileUtils.normalize_path(_parseFstabPath(fs_spec))
+
+ # We expect normalized fs_file from the kernel.
fs_file = _parseFstabPath(fs_file)
for suffix in (" (deleted)", ):
if not fs_file.endswith(suffix):
diff --git a/tests/mountTests.py b/tests/mountTests.py
index 0133a3f..3b49b84 100644
--- a/tests/mountTests.py
+++ b/tests/mountTests.py
@@ -184,6 +184,20 @@
mnt = mount.Mount(fs_spec, fs_file)
self.assertEqual(mnt.isMounted(), equality)
+ @permutations([
+ # NFS4 using fsid=0 - kernel display mount as server://path instead of
+ # normalized server:/path
+ (b"server://a/b /mnt/server:_a_b nfs defaults 0 0",),
+
+ # Not seen yet, but it should work now
+ (b"server:/a//b /mnt/server:_a_b nfs defaults 0 0",),
+ (b"server:/a/b// /mnt/server:_a_b nfs defaults 0 0",),
+ ])
+ def test_is_mounted_normalize_kernel_mounts(self, mount_line):
+ with fake_mounts([mount_line]):
+ mnt = mount.Mount("server:/a/b", "/mnt/server:_a_b")
+ self.assertTrue(mnt.isMounted())
+
def test_is_mounted_with_symlink(self):
with namedTemporaryDir() as dir:
file = os.path.join(dir, "file")
--
To view, visit https://gerrit.ovirt.org/61579
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iee85efb6aaff5d3fe887d11d7c4a5045ae72ea57
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 9 months