Skip to content

Commit

Permalink
net: Remove unused dhclient_monitor
Browse files Browse the repository at this point in the history
Remove dhclient_monitor and any related code
that was calling this module.

At the same time remove all the static files that
were used by this monitor.

Change-Id: I97e1d36980cc0349bac063b7eb8ee7edbfcd2489
Signed-off-by: Ales Musil <[email protected]>
  • Loading branch information
almusil committed Nov 2, 2020
1 parent 317d336 commit 3d4443c
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 334 deletions.
1 change: 0 additions & 1 deletion init/systemd/vdsm-tmpfiles.d.conf.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
d @VDSMRUNDIR@ 755 @VDSMUSER@ @VDSMGROUP@
d @VDSMRUNDIR@/dhclientmon 755 @VDSMUSER@ @VDSMGROUP@
d @VDSMRUNDIR@/trackedInterfaces 755 @VDSMUSER@ @VDSMGROUP@
d @VDSMRUNDIR@/v2v 700 @VDSMUSER@ @VDSMGROUP@
d @VDSMRUNDIR@/vhostuser 775 @VDSMUSER@ @VDSMGROUP@
Expand Down
204 changes: 0 additions & 204 deletions lib/vdsm/network/dhclient_monitor.py

This file was deleted.

79 changes: 4 additions & 75 deletions lib/vdsm/network/initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@

from contextlib import contextmanager
import logging
import time

from vdsm.common.config import config
from vdsm.network import bond_monitor
from vdsm.network import dhclient_monitor
from vdsm.network import dhcp_monitor
from vdsm.network import lldp
from vdsm.network import nmstate
from vdsm.network.dhclient_monitor import dhclient_monitor_ctx
from vdsm.network.ipwrapper import getLinks
from vdsm.network.nm import networkmanager

Expand All @@ -43,33 +39,18 @@ def init_privileged_network_components():


def init_unprivileged_network_components(cif, net_api):
if nmstate.is_nmstate_backend():
dhcp_monitor.initialize_monitor(cif, net_api)
else:
_init_sourceroute(net_api)
_register_notifications(cif)
dhclient_monitor.start()
dhcp_monitor.initialize_monitor(cif, net_api)
bond_monitor.initialize_monitor(cif)


def stop_unprivileged_network_components():
if nmstate.is_nmstate_backend():
dhcp_monitor.Monitor.instance().stop()
else:
dhclient_monitor.stop()

dhcp_monitor.Monitor.instance().stop()
bond_monitor.stop()


@contextmanager
def init_unpriviliged_dhclient_monitor_ctx(event_sink, net_api):
if nmstate.is_nmstate_backend():
ctx = dhcp_monitor.initialize_monitor_ctx(event_sink, net_api)
else:
_init_sourceroute(net_api)
_register_notifications(event_sink)
ctx = dhclient_monitor_ctx()
with ctx:
def init_unpriviliged_dhcp_monitor_ctx(event_sink, net_api):
with dhcp_monitor.initialize_monitor_ctx(event_sink, net_api):
yield


Expand All @@ -95,55 +76,3 @@ def _lldp_init():
)
else:
logging.warning('LLDP is inactive, skipping LLDP initialization')


def _init_sourceroute(net_api):
"""
Setup sourceroute with the dhclient monitor.
The net_api argument represents the exposed network api verbs.
The net_api can contain:
supervdsm proxy - enabling calls through the supervdsm service.
api module object - enabling calls directly through the network api.
"""

def _add_sourceroute(iface, ip, mask, route):
net_api.add_sourceroute(iface, ip, mask, route)

def _remove_sourceroute(iface):
net_api.remove_sourceroute(iface)

dhclient_monitor.register_action_handler(
action_type=dhclient_monitor.ActionType.CONFIGURE,
action_function=_add_sourceroute,
required_fields=(
dhclient_monitor.ResponseField.IFACE,
dhclient_monitor.ResponseField.IPADDR,
dhclient_monitor.ResponseField.IPMASK,
dhclient_monitor.ResponseField.IPROUTE,
),
)
dhclient_monitor.register_action_handler(
action_type=dhclient_monitor.ActionType.REMOVE,
action_function=_remove_sourceroute,
required_fields=(dhclient_monitor.ResponseField.IFACE,),
)


def _register_notifications(cif):
def _notify(**kwargs):
if not nmstate.is_nmstate_backend():
# Delay the notification in order to allow the ifup job to finish
time.sleep(5)
cif.notify('|net|host_conn|no_id')

dhclient_monitor.register_action_handler(
action_type=dhclient_monitor.ActionType.CONFIGURE,
action_function=_notify,
required_fields=(
dhclient_monitor.ResponseField.IFACE,
dhclient_monitor.ResponseField.IPADDR,
dhclient_monitor.ResponseField.IPMASK,
),
)
6 changes: 0 additions & 6 deletions static/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,6 @@ dracut_DATA = \
./usr/lib/dracut/dracut.conf.d/99-vdsm_protect_ifcfg.conf \
$(NULL)

dhclientmondir = $(sysconfdir)/dhcp/dhclient.d
dist_dhclientmon_SCRIPTS = \
./etc/dhcp/dhclient.d/dhclientmon.sh \
$(NULL)

nmdispatcherdir = $(sysconfdir)/NetworkManager/dispatcher.d
dist_nmdispatcher_SCRIPTS = \
./etc/NetworkManager/dispatcher.d/dhcp_monitor.py \
Expand Down Expand Up @@ -224,7 +219,6 @@ install-data-local: install-libvirtpasswordDATA
$(MKDIR_P) $(DESTDIR)$(vdsmlogdir)
$(MKDIR_P) $(DESTDIR)$(vdsmlogdir)/import
$(MKDIR_P) $(DESTDIR)$(vdsmrundir)
$(MKDIR_P) $(DESTDIR)$(vdsmrundir)/dhclientmon
$(MKDIR_P) $(DESTDIR)$(vdsmrundir)/trackedInterfaces
$(MKDIR_P) $(DESTDIR)$(vdsmrundir)/payload
$(MKDIR_P) $(DESTDIR)$(vdsmlibdir)/netconfback
Expand Down
40 changes: 0 additions & 40 deletions static/etc/dhcp/dhclient.d/dhclientmon.sh

This file was deleted.

Loading

0 comments on commit 3d4443c

Please sign in to comment.