Genadi Chereshnya has uploaded a new change for review.
Change subject: api: Adding dns as additional field for setupNetworks ifcfg: Updating
ifcfg file with DNSs
......................................................................
api: Adding dns as additional field for setupNetworks
ifcfg: Updating ifcfg file with DNSs
Adding DNSs to the setupNetwork command
With multiple paragraphs if necessary.
Change-Id: Ib9ea16d033cc07ef10c05868da3e6b4bcee56f74
Bug-Url:
https://bugzilla.redhat.com/??????
Signed-off-by: Genadi Chereshnya <gcheresh(a)redhat.com>
---
M vdsm/network/api.py
M vdsm/network/configurators/ifcfg.py
2 files changed, 12 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/43/47843/1
diff --git a/vdsm/network/api.py b/vdsm/network/api.py
index 4ed64f3..e3f8289 100755
--- a/vdsm/network/api.py
+++ b/vdsm/network/api.py
@@ -89,7 +89,7 @@
ipv6addr=None, ipv6gateway=None, ipv6autoconf=None,
dhcpv6=None, defaultRoute=None, _netinfo=None,
configurator=None, blockingdhcp=None,
- implicitBonding=None, opts=None):
+ implicitBonding=None, opts=None, dnss=None):
"""
Constructs an object hierarchy that describes the network configuration
that is passed in the parameters.
@@ -118,6 +118,7 @@
routing table?
:param opts: misc options received by the callee, e.g., {'stp': True}. this
function can modify the dictionary.
+ :param dnss: list of DNSs
:returns: the top object of the hierarchy.
"""
@@ -249,7 +250,7 @@
ipv6addr=None, ipv6gateway=None, ipv6autoconf=None,
force=False, configurator=None, bondingOptions=None,
bridged=True, _netinfo=None, hostQos=None,
- defaultRoute=None, blockingdhcp=False, **options):
+ defaultRoute=None, blockingdhcp=False, dnss=None, **options):
nics = nics or ()
if _netinfo is None:
_netinfo = netinfo.NetInfo()
@@ -311,7 +312,8 @@
netmask=netmask, gateway=gateway, bootproto=bootproto, dhcpv6=dhcpv6,
blockingdhcp=blockingdhcp, ipv6addr=ipv6addr, ipv6gateway=ipv6gateway,
ipv6autoconf=ipv6autoconf, defaultRoute=defaultRoute,
- _netinfo=_netinfo, configurator=configurator, opts=options)
+ _netinfo=_netinfo, configurator=configurator, opts=options, dnss=dnss
+ )
if bridged and network in _netinfo.bridges:
net_ent_to_configure = net_ent.port
diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py
index c2b0345..c342d90 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -503,7 +503,9 @@
if self.unifiedPersistence and utils.isOvirtNode():
node_fs.Config().persist(fileName)
- def _createConfFile(self, conf, name, ipv4, ipv6, mtu=None, **kwargs):
+ def _createConfFile(
+ self, conf, name, ipv4, ipv6, mtu=None, dnss=None, **kwargs
+ ):
""" Create ifcfg-* file with proper fields per device
"""
cfg = 'DEVICE=%s\n' % pipes.quote(name)
cfg += conf
@@ -536,6 +538,10 @@
elif ipv6.dhcpv6:
cfg += 'DHCPV6C=yes\n'
cfg += 'IPV6_AUTOCONF=%s\n' % _to_ifcfg_bool(ipv6.ipv6autoconf)
+ if dnss:
+ for i, dns in enumerate(dnss):
+ cfg += 'DNS' + str(i+1) + '=%s\n' % dns
+
BLACKLIST = ['TYPE', 'NAME', 'DEVICE', 'VLAN',
'bondingOptions',
'force', 'blockingdhcp', 'custom',
'connectivityCheck', 'connectivityTimeout',
--
To view, visit
https://gerrit.ovirt.org/47843
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9ea16d033cc07ef10c05868da3e6b4bcee56f74
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Genadi Chereshnya <gcheresh(a)redhat.com>