zoukankan      html  css  js  c++  java
  • kata createEndpoint

    {
    
    “device”:”tap1”,
    
    “name”:”eth1”,
    
    “IPAddresses”:[{“address”:”172.17.1.10”,”mask”:”24”}],
    
    “mtu”:1300,
    
    “hwAddr”:”02:42:20:6f:a2:80”
    
    “vhostUserSocket”:”/usr/local/var/run/openvswitch/vhost-user1”
    
    }
    root@ubuntu:# cat kata_add_tap.json
    {
    "device": "veth-test",
    "name": "eth-test",
    "IPAddresses": [
    {
    "address": "172.17.0.3",
    "mask": "16"
    }
    ],
    "hwAddr":"02:42:20:6f:a3:69",
    "mtu": 1500
    }
    root@ubuntu:# kata-runtime kata-network add-iface d5f9427e83fd374e12125fb442942931fdf08c949f68e9c027592d048526b0cb kata_add_tap.json
    null
    Unsupported network interface:
            // tap interface/bridge if it is.
            isPhysical, err := isPhysicalIface(netInfo.Iface.Name)
            if err != nil {
                    return nil, err
            }
    
            if isPhysical {
                    networkLogger().WithField("interface", netInfo.Iface.Name).Info("Physical network interface found")
                    endpoint, err = createPhysicalEndpoint(netInfo)
            } else {
                    var socketPath string
    
                    // Check if this is a dummy interface which has a vhost-user socket associated with it
                    socketPath, err = vhostUserSocketPath(netInfo)
                    if err != nil {
                            return nil, err
                    }
                    networkLogger().WithField("interface", netInfo.Iface.Name).WithField("Type", netInfo.Iface.Type).Info("network info")
                    networkLogger().WithField("addr", netInfo.Iface.HardwareAddr).Info("network info")
    
                    if socketPath != "" {
                            networkLogger().WithField("interface", netInfo.Iface.Name).Info("VhostUser network interface found")
                            endpoint, err = createVhostUserEndpoint(netInfo, socketPath)
                    } else if netInfo.Iface.Type == "macvlan" {
                            networkLogger().Infof("macvlan interface found")
                            endpoint, err = createBridgedMacvlanNetworkEndpoint(idx, netInfo.Iface.Name, model)
                    } else if netInfo.Iface.Type == "macvtap" {
                            networkLogger().Infof("macvtap interface found")
                            endpoint, err = createMacvtapNetworkEndpoint(netInfo)
                    } else if netInfo.Iface.Type == "tap" {
                            networkLogger().Info("tap interface found")
                            endpoint, err = createTapNetworkEndpoint(idx, netInfo.Iface.Name)
                    } else if netInfo.Iface.Type == "tuntap" {
                            if link != nil {
                                    switch link.(*netlink.Tuntap).Mode {
                                    case 0:
                                            // mount /sys/class/net to get links
                                            return nil, fmt.Errorf("Network device mode not determined correctly. Mount sysfs in caller")
                                    case 1:
                                            return nil, fmt.Errorf("tun networking device not yet supported")
                                    case 2:
                                            networkLogger().Info("tuntap tap interface found")
                                            endpoint, err = createTuntapNetworkEndpoint(idx, netInfo.Iface.Name, netInfo.Iface.HardwareAddr, model)
                                    default:
                                            return nil, fmt.Errorf("tuntap network %v mode unsupported", link.(*netlink.Tuntap).Mode)
                                    }
                            }
                    } else if netInfo.Iface.Type == "veth" {
                            endpoint, err = createVethNetworkEndpoint(idx, netInfo.Iface.Name, model)
                    } else if netInfo.Iface.Type == "ipvlan" {
                            endpoint, err = createIPVlanNetworkEndpoint(idx, netInfo.Iface.Name)
                    } else {
                            return nil, fmt.Errorf("Unsupported network interface: %s", netInfo.Iface.Type)
                    }
            }
    
            return endpoint, err
    }
  • 相关阅读:
    归并排序(Merge Sort)
    AtCoder AGC035D Add and Remove (状压DP)
    AtCoder AGC034D Manhattan Max Matching (费用流)
    AtCoder AGC033F Adding Edges (图论)
    AtCoder AGC031F Walk on Graph (图论、数论)
    AtCoder AGC031E Snuke the Phantom Thief (费用流)
    AtCoder AGC029F Construction of a Tree (二分图匹配)
    AtCoder AGC029E Wandering TKHS
    AtCoder AGC039F Min Product Sum (容斥原理、组合计数、DP)
    AtCoder AGC035E Develop (DP、图论、计数)
  • 原文地址:https://www.cnblogs.com/dream397/p/14041286.html
Copyright © 2011-2022 走看看