コード例 #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
ファイル: ifcfg.py プロジェクト: edwardbadboy/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)
コード例 #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
ファイル: __init__.py プロジェクト: edwardbadboy/vdsm-ubuntu
 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
ファイル: ifcfg.py プロジェクト: int64ago-public/vdsm
 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()