Change in vdsm[master]: netinfo:Report host DNSs in getVdsCapd networkTests: Check t...
myakove at redhat.com
myakove at redhat.com
Wed Sep 16 13:26:52 UTC 2015
Meni Yakove has uploaded a new change for review.
Change subject: netinfo:Report host DNSs in getVdsCapd networkTests: Check that getVdsCaps report host DNSs
......................................................................
netinfo:Report host DNSs in getVdsCapd
networkTests: Check that getVdsCaps report host DNSs
Change-Id: I45bb4aec72cbcf4cc6131fd829ff8cb1d8fa4403
Signed-off-by: Meni Yakove <myakove at redhat.com>
---
M lib/vdsm/netinfo.py
M tests/functional/networkTests.py
M vdsm/rpc/vdsmapi-schema.json
3 files changed, 33 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/33/46233/1
diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 1ca5c06..44501c9 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -597,6 +597,11 @@
return info
+def _dnsinfo():
+ """Get DNS servers from /etc/resolve.conf"""
+ return get_host_nameservers()
+
+
def _parse_expiry_time(expiry_time):
EPOCH = 'epoch '
@@ -770,7 +775,7 @@
def get(vdsmnets=None):
d = {'bondings': {}, 'bridges': {}, 'networks': {}, 'nics': {},
- 'vlans': {}}
+ 'vlans': {}, 'dnss': _dnsinfo()}
paddr = permAddr()
ipaddrs = _getIpAddrs()
dhcpv4_ifaces, dhcpv6_ifaces = _get_dhclient_ifaces()
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index 2f60762..2bebb35 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -49,6 +49,8 @@
from testValidation import (brokentest, slowtest, RequireDummyMod,
RequireVethMod, ValidateRunningAsRoot)
from nettestlib import Tap
+from monkeypatch import MonkeyPatchScope
+from vdsm import netinfo
import dhcp
import dummy
@@ -2771,3 +2773,24 @@
self.assertEqual(status, SUCCESS, msg)
self.assertNetworkDoesntExist(NETWORK_NAME)
self.assertBondDoesntExist(BONDING_NAME, nics)
+
+ @ValidateRunningAsRoot
+ def test_dns_info(self):
+ resolve_conf = (
+ '# Generated by NetworkManager\n'
+ 'search example.com company.net\n'
+ 'domain example.com\n'
+ 'nameserver 192.168.0.100\n'
+ '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']
+ with namedTemporaryDir() as temp_dir:
+ file_path = os.path.join(temp_dir, 'resolv.conf')
+
+ with MonkeyPatchScope([(netinfo, 'DNS_CONF_FILE', file_path)]):
+ with open(file_path, 'w') as file_object:
+ file_object.write(resolve_conf)
+
+ net_info = netinfo.get()
+ self.assertEqual(net_info.get('dns_servers'), dnss)
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index e0e95b9..7bdb5b4 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -1273,6 +1273,8 @@
# supported in this host.
# (new in version 4.17.0)
#
+# @dnss: Provides host DNS servers from /etc/resolve.conf
+#
# Since: 4.17.0
#
# Notes: Since ovirt-engine cannot parse software versions in 'x.y.z' format,
@@ -1299,7 +1301,8 @@
'autoNumaBalancing': 'AutoNumaBalancingStatus',
'selinux': 'SELinuxStatus', '*liveSnapshot': 'bool',
'kdumpStatus': 'int', '*liveMerge': 'bool',
- 'directedPassthrough': 'bool', 'additionalFeatures': ['str']}}
+ 'directedPassthrough': 'bool', 'additionalFeatures': ['str'],
+ 'dnss': ['str']}}
##
# @Host.getCapabilities:
--
To view, visit https://gerrit.ovirt.org/46233
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I45bb4aec72cbcf4cc6131fd829ff8cb1d8fa4403
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Meni Yakove <myakove at redhat.com>
More information about the vdsm-patches
mailing list