diff --git a/src/vm/man/vmadm.8.md b/src/vm/man/vmadm.8.md index 058f5f2d9..f5e5dd706 100644 --- a/src/vm/man/vmadm.8.md +++ b/src/vm/man/vmadm.8.md @@ -1739,6 +1739,35 @@ tab-complete UUIDs rather than having to type them out for every command. create: yes update yes (requires zone stop/boot) + nics.*.pci_slot: + + Specifies the virtual PCI slot that this NIC will occupy. Bhyve places + each NIC into a PCI slot that is identified by the PCI bus, device, and + function (BDF). The slot may be specified as <bus>:<device>:<function> + ("0:10:0"), <device>:<function> ("10:0") or <device> ("10"). If a bus + is not specified, 0 is used. Multiple NIC instances may be grouped + together on the same device by specifying different function values + for each NIC (e.g. "0:10:0", "0:10:1"). + + Per the PCI specification legal values for bus, device and function are: + + bus: 0 - 255, inclusive + device: 0 - 31, inclusive + function: 0 - 7, inclusive + + All functions on devices 0, 6, 30, and 31 on bus 0 are reserved. By + default, NICs do not include a `pci_slot` property. Instead, each + NIC instance is allocated its own function on the reserved bus 0, + device 6 virtual PCI slot. This property is generally only required + when it is necessary to have more than 8 NICs in a single bhyve VM. + + type: string (<bus>:<device>:<function>, <device>:function, or <device>) + vmtype: bhyve + listable: yes + create: yes + update: yes (special, see description in 'update' section above) + default: no + nics.*.primary This option selects which NIC's default gateway and nameserver values diff --git a/src/vm/node_modules/VM.js b/src/vm/node_modules/VM.js index 0eec0dacf..35ba8db1c 100644 --- a/src/vm/node_modules/VM.js +++ b/src/vm/node_modules/VM.js @@ -6431,6 +6431,11 @@ function buildNicZonecfg(vmobj, payload, log) + nic.allowed_dhcp_cids.join(',') + '")\n'; } + if (nic.hasOwnProperty('pci_slot')) { + zfs = zcfg + 'add property (name=pci-slot, value="' + + nic.pci_slot + '")\n'; + } + for (var prop in nicProperties) { prop = nicProperties[prop]; if (nic.hasOwnProperty(prop)) { diff --git a/src/vm/node_modules/proptable.js b/src/vm/node_modules/proptable.js index 37b75cc09..20a4cf202 100644 --- a/src/vm/node_modules/proptable.js +++ b/src/vm/node_modules/proptable.js @@ -20,7 +20,7 @@ * * CDDL HEADER END * - * Copyright 2020, Joyent, Inc. + * Copyright 2020 Joyent, Inc. * */ @@ -1472,6 +1472,15 @@ exports.properties = { }, updatable: true, zonexml: 'zone.network.global-nic' + }, 'nics.*.pci_slot': { + payload: { + allowed: { + 'bhyve': ['add', 'update'] + }, + type: 'string' + }, + updatable: true, + zonexml: 'zone.device.net-attr.pci-slot' }, 'nics.*.primary': { loadValueTranslator: 'utils.fixBoolean', payload: {