def newveth(self, ifindex = None, ifname = None, net = None):
        self.lock.acquire()
        try:
            if ifindex is None:
                ifindex = self.newifindex()
            if ifname is None:
                ifname = "eth%d" % ifindex
            sessionid = self.session.shortsessionid()
            try:
                suffix = '%x.%s.%s' % (self.objid, ifindex, sessionid)
            except __HOLE__:
                suffix = '%s.%s.%s' % (self.objid, ifindex, sessionid)
            localname = 'veth' + suffix
            if len(localname) >= 16:
                raise ValueError, "interface local name '%s' too long" % \
                        localname
            name = localname + 'p'
            if len(name) >= 16:
                raise ValueError, "interface name '%s' too long" % name
            ifclass = VEth
            veth = ifclass(node = self, name = name, localname = localname,
                           mtu = 1500, net = net, start = self.up)
            if self.up:
                check_call([IP_BIN, "link", "set", veth.name,
                            "netns", str(self.pid)])
                self.cmd([IP_BIN, "link", "set", veth.name, "name", ifname])
            veth.name = ifname
            try:
                self.addnetif(veth, ifindex)
            except:
                veth.shutdown()
                del veth
                raise
            return ifindex
        finally:
            self.lock.release()
dataset/ETHPy150Open coreemu/core/daemon/core/netns/vnode.py/SimpleLxcNode.newveth