def _hasdev(devclass): """check for existence of device, attempting to load kernel module if not present""" devname = '%s0' % devclass rth = getrth() if rth.getlink(devname): return True if util.modprobe(devclass) and rth.getlink(devname): return True return False
def setup(self): """install Remus plug on VIF outbound traffic""" self.bufdev = self.pool.get() devname = self.bufdev.devname bufdev = self.rth.getlink(devname) if not bufdev: raise BufferedNICException('could not find device %s' % devname) self.bufdev.install(self.vif) self.bufdevno = bufdev['index'] self.handle = qdisc.TC_H_ROOT self.q = qdisc.PlugQdisc() if not util.modprobe('sch_plug'): raise BufferedNICException('could not load sch_plug module')