예제 #1
0
파일: ifcfg.py 프로젝트: rexhsu/vdsm-ubuntu
 def _ifaceDownAndCleanup(self, iface, _netinfo):
     """Returns True iff the iface is to be removed."""
     DynamicSourceRoute.addInterfaceTracking(iface)
     ifdown(iface.name)
     self._removeSourceRoute(iface)
     self.configApplier.removeIfaceCleanup(iface.name)
     return not _netinfo.ifaceUsers(iface.name)
예제 #2
0
 def _ifaceDownAndCleanup(self, iface, _netinfo):
     """Returns True iff the iface is to be removed."""
     DynamicSourceRoute.addInterfaceTracking(iface)
     ifdown(iface.name)
     self._removeSourceRoute(iface)
     self.configApplier.removeIfaceCleanup(iface.name)
     return not _netinfo.ifaceUsers(iface.name)
예제 #3
0
파일: ifcfg.py 프로젝트: therealmik/vdsm
 def removeBridge(self, bridge):
     DynamicSourceRoute.addInterfaceTracking(bridge)
     ifdown(bridge.name)
     self._removeSourceRoute(bridge)
     utils.execCmd([constants.EXT_BRCTL, 'delbr', bridge.name])
     self.configApplier.removeBridge(bridge.name)
     if bridge.port:
         bridge.port.remove()
예제 #4
0
 def _addSourceRoute(self, netEnt, ipaddr, netmask, gateway, bootproto):
     # bootproto is None for both static and no bootproto
     if bootproto != 'dhcp' and netEnt.master is None:
         logging.debug("Adding source route %s, %s, %s, %s" %
                       (netEnt.name, ipaddr, netmask, gateway))
         StaticSourceRoute(netEnt.name, self).\
             configure(ipaddr, netmask, gateway)
     DynamicSourceRoute.addInterfaceTracking(netEnt)
예제 #5
0
 def _addSourceRoute(self, netEnt, ipaddr, netmask, gateway, bootproto):
     # bootproto is None for both static and no bootproto
     if bootproto != 'dhcp' and netEnt.master is None:
         logging.debug("Adding source route %s, %s, %s, %s" %
                       (netEnt.name, ipaddr, netmask, gateway))
         StaticSourceRoute(netEnt.name, self).\
             configure(ipaddr, netmask, gateway)
     DynamicSourceRoute.addInterfaceTracking(netEnt)
예제 #6
0
 def _ifaceDownAndCleanup(self, iface):
     """Returns True iff the iface is to be removed."""
     DynamicSourceRoute.addInterfaceTracking(iface)
     to_be_removed = not netinfo.ifaceUsed(iface.name)
     if to_be_removed:
         ifdown(iface.name)
     self._removeSourceRoute(iface)
     return to_be_removed
예제 #7
0
파일: ifcfg.py 프로젝트: rexhsu/vdsm-ubuntu
 def removeBridge(self, bridge):
     DynamicSourceRoute.addInterfaceTracking(bridge)
     ifdown(bridge.name)
     self._removeSourceRoute(bridge)
     execCmd([constants.EXT_BRCTL, 'delbr', bridge.name])
     self.configApplier.removeBridge(bridge.name)
     if bridge.port:
         bridge.port.remove()
예제 #8
0
    def process_IN_CLOSE_WRITE_filePath(self, sourceRouteFilePath):
        logging.debug("Responding to DHCP response in %s" %
                      sourceRouteFilePath)
        with open(sourceRouteFilePath, 'r') as sourceRouteFile:
            sourceRouteContents = sourceRouteFile.read().split()
            action = sourceRouteContents[0]
            device = sourceRouteContents[-1]
            sourceRoute = DynamicSourceRoute(device, configurator)

            if sourceRoute.isVDSMInterface():
                if action == 'configure':
                    ip = sourceRouteContents[1]
                    mask = sourceRouteContents[2]
                    gateway = sourceRouteContents[3]
                    sourceRoute.configure(ip, mask, gateway)
                else:
                    sourceRoute.remove()
            else:
                logging.info("interface %s is not a libvirt interface" %
                             sourceRoute.device)

            DynamicSourceRoute.removeInterfaceTracking(device)

        os.remove(sourceRouteFilePath)
예제 #9
0
    def process_IN_CLOSE_WRITE_filePath(self, sourceRouteFilePath):
        logging.debug("Responding to DHCP response in %s" %
                      sourceRouteFilePath)
        with open(sourceRouteFilePath, 'r') as sourceRouteFile:
            sourceRouteContents = sourceRouteFile.read().split()
            action = sourceRouteContents[0]
            device = sourceRouteContents[-1]
            sourceRoute = DynamicSourceRoute(device, configurator)

            if sourceRoute.isVDSMInterface():
                if action == 'configure':
                    ip = sourceRouteContents[1]
                    mask = sourceRouteContents[2]
                    gateway = sourceRouteContents[3]
                    sourceRoute.configure(ip, mask, gateway)
                else:
                    sourceRoute.remove()
            else:
                logging.info("interface %s is not a libvirt interface" %
                             sourceRoute.device)

            DynamicSourceRoute.removeInterfaceTracking(device)

        os.remove(sourceRouteFilePath)
예제 #10
0
파일: ifcfg.py 프로젝트: therealmik/vdsm
 def removeVlan(self, vlan):
     DynamicSourceRoute.addInterfaceTracking(vlan)
     ifdown(vlan.name)
     self._removeSourceRoute(vlan)
     self.configApplier.removeVlan(vlan.name)
     vlan.device.remove()
예제 #11
0
파일: ifcfg.py 프로젝트: rexhsu/vdsm-ubuntu
 def removeVlan(self, vlan):
     DynamicSourceRoute.addInterfaceTracking(vlan)
     ifdown(vlan.name)
     self._removeSourceRoute(vlan)
     self.configApplier.removeVlan(vlan.name)
     vlan.device.remove()