The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3964
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === This is more accurate. Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 396cbb42eb9afdaf1037ce6e323c00cb62608c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Mon, 23 Oct 2017 17:29:31 +0200 Subject: [PATCH] Rename nictype=vfio to nictype=sriov MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is more accurate. Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- doc/api-extensions.md | 2 +- doc/containers.md | 44 ++++++++++++++++++++++---------------------- lxd/api_1.0.go | 2 +- lxd/container.go | 4 ++-- lxd/container_lxc.go | 28 ++++++++++++++-------------- lxd/networks_utils.go | 2 +- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/doc/api-extensions.md b/doc/api-extensions.md index 5f3aa727a..53a29c05e 100644 --- a/doc/api-extensions.md +++ b/doc/api-extensions.md @@ -354,5 +354,5 @@ This adds support for renaming custom storage volumes. ## external\_authentication This adds support for external authentication via Macaroons. -## network\_vfio +## network\_sriov This adds support for SR-IOV enabled network devices. diff --git a/doc/containers.md b/doc/containers.md index b2fa6f8d1..8a86c6f80 100644 --- a/doc/containers.md +++ b/doc/containers.md @@ -67,7 +67,7 @@ volatile.idmap.base | integer | - | The first id in th volatile.idmap.next | string | - | The idmap to use next time the container starts volatile.last\_state.idmap | string | - | Serialized container uid/gid map volatile.last\_state.power | string | - | Container state as of last host shutdown -volatile.\<name\>.host\_name | string | - | Network device name on the host (for nictype=bridged or nictype=p2p, or nictype=vfio) +volatile.\<name\>.host\_name | string | - | Network device name on the host (for nictype=bridged or nictype=p2p, or nictype=sriov) volatile.\<name\>.hwaddr | string | - | Network device MAC address (when no hwaddr property is set on the device itself) volatile.\<name\>.name | string | - | Network device name (when no name propery is set on the device itself) @@ -170,25 +170,25 @@ LXD supports different kind of network devices: - `bridged`: Uses an existing bridge on the host and creates a virtual device pair to connect the host bridge to the container. - `macvlan`: Sets up a new network device based on an existing one but using a different MAC address. - `p2p`: Creates a virtual device pair, putting one side in the container and leaving the other side on the host. - - `vfio`: Passes a virtual function of an SR-IOV enabled physical network device into the container. + - `sriov`: Passes a virtual function of an SR-IOV enabled physical network device into the container. Different network interface types have different additional properties, the current list is: -Key | Type | Default | Required | Used by | API extension | Description -:-- | :-- | :-- | :-- | :-- | :-- | :-- -nictype | string | - | yes | all | - | The device type, one of "bridged", "macvlan", "p2p", "physical", or "vfio" -limits.ingress | string | - | no | bridged, p2p | - | I/O limit in bit/s (supports kbit, Mbit, Gbit suffixes) -limits.egress | string | - | no | bridged, p2p | - | I/O limit in bit/s (supports kbit, Mbit, Gbit suffixes) -limits.max | string | - | no | bridged, p2p | - | Same as modifying both limits.read and limits.write -name | string | kernel assigned | no | all | - | The name of the interface inside the container -host\_name | string | randomly assigned | no | bridged, macvlan, p2p, vfio | - | The name of the interface inside the host -hwaddr | string | randomly assigned | no | all | - | The MAC address of the new interface -mtu | integer | parent MTU | no | all | - | The MTU of the new interface -parent | string | - | yes | bridged, macvlan, physical, vfio | - | The name of the host device or bridge -vlan | integer | - | no | macvlan, physical | network\_vlan, network\_vlan\_physical | The VLAN ID to attach to -ipv4.address | string | - | no | bridged | network | An IPv4 address to assign to the container through DHCP -ipv6.address | string | - | no | bridged | network | An IPv6 address to assign to the container through DHCP -security.mac\_filtering | boolean | false | no | bridged | network | Prevent the container from spoofing another's MAC address +Key | Type | Default | Required | Used by | API extension | Description +:-- | :-- | :-- | :-- | :-- | :-- | :-- +nictype | string | - | yes | all | - | The device type, one of "bridged", "macvlan", "p2p", "physical", or "sriov" +limits.ingress | string | - | no | bridged, p2p | - | I/O limit in bit/s (supports kbit, Mbit, Gbit suffixes) +limits.egress | string | - | no | bridged, p2p | - | I/O limit in bit/s (supports kbit, Mbit, Gbit suffixes) +limits.max | string | - | no | bridged, p2p | - | Same as modifying both limits.read and limits.write +name | string | kernel assigned | no | all | - | The name of the interface inside the container +host\_name | string | randomly assigned | no | bridged, macvlan, p2p, sriov | - | The name of the interface inside the host +hwaddr | string | randomly assigned | no | all | - | The MAC address of the new interface +mtu | integer | parent MTU | no | all | - | The MTU of the new interface +parent | string | - | yes | bridged, macvlan, physical, sriov | - | The name of the host device or bridge +vlan | integer | - | no | macvlan, physical | network\_vlan, network\_vlan\_physical | The VLAN ID to attach to +ipv4.address | string | - | no | bridged | network | An IPv4 address to assign to the container through DHCP +ipv6.address | string | - | no | bridged | network | An IPv6 address to assign to the container through DHCP +security.mac\_filtering | boolean | false | no | bridged | network | Prevent the container from spoofing another's MAC address #### bridged or macvlan for connection to physical network The `bridged` and `macvlan` interface types can both be used to connect @@ -207,25 +207,25 @@ your containers to talk to the host itself. In such case, a bridge is preferable. A bridge will also let you use mac filtering and I/O limits which cannot be applied to a macvlan device. -#### vfio -The `vfio` interface type supports SR-IOV enabled network devices. These +#### SR-IOV +The `sriov` interface type supports SR-IOV enabled network devices. These devices associate a set of virtual functions (VFs) with the single physical function (PF) of the network device. PFs are standard PCIe functions. VFs on the other hand are very lightweight PCIe functions that are optimized for data movement. They come with a limited set of configuration capabilites to prevent changing properties of the PF. Given that VFs appear as regular PCIe devices to the system they can be passed to containers just like a regular physical -device. The `vfio` interface type expects to be passed the name of an SR-IOV +device. The `sriov` interface type expects to be passed the name of an SR-IOV enabled network device on the system via the `parent` property. LXD will then check for any available VFs on the system. By default LXD will allocate the first free VF it finds. If it detects that either none are enabled or all currently enabled VFs are in use it will bump the number of supported VFs to the maximum value and use the first free VF. If all possible VFs are in use or the kernel or card doesn't support incrementing the number of VFs LXD will -return an error. To create a `vfio` network device use: +return an error. To create a `sriov` network device use: ``` -lxc config device add <container> <device-name> nic nictype=vfio parent=<sriov-enabled-device> +lxc config device add <container> <device-name> nic nictype=sriov parent=<sriov-enabled-device> ``` To tell LXD to use a specific unused VF add the `host_name` property and pass diff --git a/lxd/api_1.0.go b/lxd/api_1.0.go index efeeff824..1c5924a05 100644 --- a/lxd/api_1.0.go +++ b/lxd/api_1.0.go @@ -136,7 +136,7 @@ func api10Get(d *Daemon, r *http.Request) Response { "kernel_limits", "storage_api_volume_rename", "macaroon_authentication", - "network_vfio", + "network_sriov", }, APIStatus: "stable", APIVersion: version.APIVersion, diff --git a/lxd/container.go b/lxd/container.go index bfe0f2349..fefa2fbdd 100644 --- a/lxd/container.go +++ b/lxd/container.go @@ -306,11 +306,11 @@ func containerValidDevices(dbObj *sql.DB, devices types.Devices, profile bool, e return fmt.Errorf("Missing nic type") } - if !shared.StringInSlice(m["nictype"], []string{"bridged", "macvlan", "p2p", "physical", "vfio"}) { + if !shared.StringInSlice(m["nictype"], []string{"bridged", "macvlan", "p2p", "physical", "sriov"}) { return fmt.Errorf("Bad nic type: %s", m["nictype"]) } - if shared.StringInSlice(m["nictype"], []string{"bridged", "macvlan", "physical", "vfio"}) && m["parent"] == "" { + if shared.StringInSlice(m["nictype"], []string{"bridged", "macvlan", "physical", "sriov"}) && m["parent"] == "" { return fmt.Errorf("Missing parent for %s type nic", m["nictype"]) } } else if m["type"] == "disk" { diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go index 558ae48d4..0efecaf91 100644 --- a/lxd/container_lxc.go +++ b/lxd/container_lxc.go @@ -1350,7 +1350,7 @@ func (c *containerLXC) initLXC() error { if err != nil { return err } - } else if m["nictype"] == "physical" || m["nictype"] == "vfio" { + } else if m["nictype"] == "physical" || m["nictype"] == "sriov" { err = lxcSetConfigItem(cc, fmt.Sprintf("%s.%d.type", networkKeyPrefix, networkidx), "phys") if err != nil { return err @@ -1377,7 +1377,7 @@ func (c *containerLXC) initLXC() error { if err != nil { return err } - } else if m["nictype"] == "vfio" { + } else if m["nictype"] == "sriov" { err = lxcSetConfigItem(cc, fmt.Sprintf("%s.%d.link", networkKeyPrefix, networkidx), m["host_name"]) if err != nil { return err @@ -1391,7 +1391,7 @@ func (c *containerLXC) initLXC() error { // Host Virtual NIC name vethName := "" - if m["host_name"] != "" && m["nictype"] != "vfio" { + if m["host_name"] != "" && m["nictype"] != "sriov" { vethName = m["host_name"] } else if shared.IsTrue(m["security.mac_filtering"]) { // We need a known device name for MAC filtering @@ -1940,11 +1940,11 @@ func (c *containerLXC) startCommon() (string, error) { } networkidx++ - if m["nictype"] != "vfio" { + if m["nictype"] != "sriov" { continue } - m, err = c.fillVfioNetworkDevice(k, m, reserved) + m, err = c.fillSriovNetworkDevice(k, m, reserved) if err != nil { return "", err } @@ -5923,7 +5923,7 @@ func (c *containerLXC) createNetworkDevice(name string, m types.Device) (string, } } - if m["nictype"] == "vfio" { + if m["nictype"] == "sriov" { dev = m["host_name"] } @@ -6015,13 +6015,13 @@ func (c *containerLXC) createNetworkDevice(name string, m types.Device) (string, return dev, nil } -func (c *containerLXC) fillVfioNetworkDevice(name string, m types.Device, reserved []string) (types.Device, error) { - if m["nictype"] != "vfio" { +func (c *containerLXC) fillSriovNetworkDevice(name string, m types.Device, reserved []string) (types.Device, error) { + if m["nictype"] != "sriov" { return m, nil } if m["parent"] == "" { - return nil, fmt.Errorf("Missing parent for 'vfio' nic '%s'", name) + return nil, fmt.Errorf("Missing parent for 'sriov' nic '%s'", name) } newDevice := types.Device{} @@ -6101,7 +6101,7 @@ func (c *containerLXC) fillVfioNetworkDevice(name string, m types.Device, reserv if nicName == "" { if sriovNum == sriovTotal { - return nil, fmt.Errorf("All virtual functions of vfio device '%s' seem to be in use", m["parent"]) + return nil, fmt.Errorf("All virtual functions of sriov device '%s' seem to be in use", m["parent"]) } // bump the number of VFs to the maximum @@ -6289,7 +6289,7 @@ func (c *containerLXC) fillNetworkDevice(name string, m types.Device) (types.Dev } // Fill in the host name (but don't generate a static one ourselves) - if m["host_name"] == "" && shared.StringInSlice(m["nictype"], []string{"bridged", "p2p", "vfio"}) { + if m["host_name"] == "" && shared.StringInSlice(m["nictype"], []string{"bridged", "p2p", "sriov"}) { configKey := fmt.Sprintf("volatile.%s.host_name", name) newDevice["host_name"] = c.localConfig[configKey] } @@ -6384,7 +6384,7 @@ func (c *containerLXC) insertNetworkDevice(name string, m types.Device) error { } // Fill in some fields from volatile - m, err = c.fillVfioNetworkDevice(name, m, []string{}) + m, err = c.fillSriovNetworkDevice(name, m, []string{}) if err != nil { return nil } @@ -6426,7 +6426,7 @@ func (c *containerLXC) removeNetworkDevice(name string, m types.Device) error { var hostName string if m["nictype"] == "physical" { hostName = m["parent"] - } else if m["nictype"] == "vfio" { + } else if m["nictype"] == "sriov" { hostName = m["host_name"] } else { hostName = deviceNextVeth() @@ -6445,7 +6445,7 @@ func (c *containerLXC) removeNetworkDevice(name string, m types.Device) error { } // If a veth, destroy it - if m["nictype"] != "physical" && m["nictype"] != "vfio" { + if m["nictype"] != "physical" && m["nictype"] != "sriov" { deviceRemoveInterface(hostName) } diff --git a/lxd/networks_utils.go b/lxd/networks_utils.go index 95656ba53..744359bbb 100644 --- a/lxd/networks_utils.go +++ b/lxd/networks_utils.go @@ -104,7 +104,7 @@ func networkIsInUse(c container, name string) bool { continue } - if !shared.StringInSlice(d["nictype"], []string{"bridged", "macvlan", "physical", "vfio"}) { + if !shared.StringInSlice(d["nictype"], []string{"bridged", "macvlan", "physical", "sriov"}) { continue }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel