Assaf Muller has posted comments on this change.
Change subject: Multiple Gateways[3/2]: Re-did comms between dhclient and vdsm
......................................................................
Patch Set 3: (8 inline comments)
Replied to reviews.
....................................................
File vdsm/sourceRoute.py
Line 16: #
Line 17: # Refer to the README and COPYING files for full details of the license
Line 18: #
Line 19:
Line 20: from glob import iglob
Done
Line 21: from libvirt import libvirtError
Line 22: import logging
Line 23: import netaddr
Line 24:
....................................................
File vdsm/sourceRoute.sh
Line 2:
Line 3: timeStamp=`date +%s`
Line 4:
Line 5: sourceRoute_config() {
Line 6: echo "configure" $new_ip_address $new_subnet_mask $new_routers \
Done - Better safe than sorry.
Line 7: $interface > /var/run/vdsm/sourceRoutes/$timeStamp
Line 8: }
Line 9:
Line 10: sourceRoute_restore() {
....................................................
File vdsm/sourceRouteThread.py
Line 1: import logging
Line 2: import os
Line 3:
Line 4: import pyinotify
In a very non-opensource manner we had a phone meeting to discuss a bug.
SELinux did not allow the dhclient process to communicate VDSM directly and
configure the host's routing table. Our workaround was to change dhclient-VDSM
communications to work with files instead.
Line 5:
Line 6: from netconf.iproute2 import Iproute2
Line 7: from sourceRoute import DynamicSourceRoute
Line 8:
Line 6: from netconf.iproute2 import Iproute2
Line 7: from sourceRoute import DynamicSourceRoute
Line 8:
Line 9:
Line 10: SOURCE_ROUTES_FOLDER = '/var/run/vdsm/sourceRoutes'
Done
Line 11: configurator = Iproute2()
Line 12:
Line 13:
Line 14: class DHClientEventHandler(pyinotify.ProcessEvent):
Line 10: SOURCE_ROUTES_FOLDER = '/var/run/vdsm/sourceRoutes'
Line 11: configurator = Iproute2()
Line 12:
Line 13:
Line 14: class DHClientEventHandler(pyinotify.ProcessEvent):
Would it be better to wrap inotify in our own Python bindings? Personally I
think I would do a worse job than the python-inotify library. Polling the
directory seems like a worse idea.
Line 15: def process_IN_CREATE(self, event):
Line 16: logging.debug("Responding to DHCP response in %s" %
event.pathname)
Line 17: with open(event.pathname, 'r') as sourceRouteFile:
Line 18: sourceRouteContents = sourceRouteFile.read().split()
Line 32: sourceRoute.configure(ip, mask, gateway)
Line 33: else:
Line 34: sourceRoute.remove()
Line 35:
Line 36: os.remove(event.pathname)
Note that when VDSM boots up we scan the folder for any files that were created
when VDSM was down. If we never delete the files created by our dhclient hook,
then when VDSM boots up he will execute (again) all of the files in that
directory that were created from the beginning of time.
Line 37:
Line 38:
Line 39: def onSuperVDSMStart():
Line 40: logging.debug("sourceRouteThread.onSuperVDSMStart started")
Line 35:
Line 36: os.remove(event.pathname)
Line 37:
Line 38:
Line 39: def onSuperVDSMStart():
Absolutely.
Line 40: logging.debug("sourceRouteThread.onSuperVDSMStart started")
Line 41:
Line 42: # Subscribe to pyinotify event
Line 43: watchManager = pyinotify.WatchManager()
....................................................
File vdsm/supervdsmServer.py
Line 52: import tc
Line 53: import ksm
Line 54: import mkimage
Line 55: from storage.multipath import MPATH_CONF
Line 56: import sourceRouteThread
sourceRouteDHClientEventHandler?
Line 57:
Line 58: _UDEV_RULE_FILE_DIR = "/etc/udev/rules.d/"
Line 59: _UDEV_RULE_FILE_PREFIX = "99-vdsm-"
Line 60: _UDEV_RULE_FILE_EXT = ".rules"
--
To view, visit http://gerrit.ovirt.org/16461
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7a47a680bfbfe285f708290de97e8f08714695a
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Assaf Muller <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Assaf Muller <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Giuseppe Vallarelli <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches