Пример #1
0
    def start(self, status):
        # Running the network script will spawn another process, which takes
        # the status fd with it unless we set FD_CLOEXEC.  Failing to do this
        # causes the read in SrvDaemon to hang even when we have written here.
        if status:
            fcntl.fcntl(status, fcntl.F_SETFD, fcntl.FD_CLOEXEC)

        Vifctl.network('start')
        threads = []
        for server in self.servers:
            thread = Thread(target=server.run)
            thread.start()
            threads.append(thread)

        # check for when all threads have initialized themselves and then
        # close the status pipe

        threads_left = True
        while threads_left:
            threads_left = False

            for server in self.servers:
                if not server.ready:
                    threads_left = True
                    break

            if threads_left:
                time.sleep(.5)

        if status:
            status.write('0')
            status.close()

        for t in threads:
            t.join()
Пример #2
0
    def start(self, status):
        # Running the network script will spawn another process, which takes
        # the status fd with it unless we set FD_CLOEXEC.  Failing to do this
        # causes the read in SrvDaemon to hang even when we have written here.
        if status:
            fcntl.fcntl(status, fcntl.F_SETFD, fcntl.FD_CLOEXEC)
        
        Vifctl.network('start')
        threads = []
        for server in self.servers:
            thread = Thread(target=server.run)
            thread.start()
            threads.append(thread)


        # check for when all threads have initialized themselves and then
        # close the status pipe

        threads_left = True
        while threads_left:
            threads_left = False

            for server in self.servers:
                if not server.ready:
                    threads_left = True
                    break

            if threads_left:
                time.sleep(.5)

        if status:
            status.write('0')
            status.close()

        for t in threads:
            t.join()
Пример #3
0
import os
import re
from xen.xend import uuid as genuuid
from xen.xend import XendAPIStore
from xen.xend.XendBase import XendBase
from xen.xend.XendPIFMetrics import XendPIFMetrics
from xen.xend.XendError import *
from xen.xend import Vifctl

log = logging.getLogger("xend.XendPIF")
log.setLevel(logging.TRACE)

MAC_RE = re.compile(':'.join(['[0-9a-f]{2}'] * 6))
IP_IFACE_RE = re.compile(r'^\d+: (\w+):.*mtu (\d+) .* link/\w+ ([0-9a-f:]+)')

Vifctl.network('start')


def linux_phy_to_virt(pif_name):
    return 'eth' + re.sub(r'^[a-z]+', '', pif_name)


def linux_get_phy_ifaces():
    """Returns a list of physical interfaces.

    Identifies PIFs as those that have a interface name starting with
    'peth'.

    See /etc/xen/scripts/network-bridge for how the devices are renamed.

    @rtype: array of 3-element tuple (name, mtu, mac)
Пример #4
0
import re
from xen.xend import uuid as genuuid
from xen.xend import XendAPIStore
from xen.xend.XendBase import XendBase
from xen.xend.XendPIFMetrics import XendPIFMetrics
from xen.xend.XendError import *
from xen.xend import Vifctl

log = logging.getLogger("xend.XendPIF")
log.setLevel(logging.TRACE)

MAC_RE = re.compile(':'.join(['[0-9a-f]{2}'] * 6))
IP_IFACE_RE = re.compile(r'^\d+: (\w+):.*mtu (\d+) .* link/\w+ ([0-9a-f:]+)')


Vifctl.network('start')

def linux_phy_to_virt(pif_name):
    return 'eth' + re.sub(r'^[a-z]+', '', pif_name)

def linux_get_phy_ifaces():
    """Returns a list of physical interfaces.

    Identifies PIFs as those that have a interface name starting with
    'peth'.

    See /etc/xen/scripts/network-bridge for how the devices are renamed.

    @rtype: array of 3-element tuple (name, mtu, mac)
    """
    
Пример #5
0
import re
from xen.xend import uuid as genuuid
from xen.xend import XendAPIStore
from xen.xend.XendBase import XendBase
from xen.xend.XendPIFMetrics import XendPIFMetrics
from xen.xend.XendError import *
from xen.xend import Vifctl

log = logging.getLogger("xend.XendPIF")
log.setLevel(logging.TRACE)

MAC_RE = re.compile(":".join(["[0-9a-f]{2}"] * 6))
IP_IFACE_RE = re.compile(r"^\d+: (\w+):.*mtu (\d+) .* link/\w+ ([0-9a-f:]+)")


Vifctl.network("start")


def linux_phy_to_virt(pif_name):
    return "eth" + re.sub(r"^[a-z]+", "", pif_name)


def linux_get_phy_ifaces():
    """Returns a list of physical interfaces.

    Identifies PIFs as those that have a interface name starting with
    'peth'.

    See /etc/xen/scripts/network-bridge for how the devices are renamed.

    @rtype: array of 3-element tuple (name, mtu, mac)