Skip to content

Commit 8bfac41

Browse files
committed
Add document for identifying interface via PCI address
Signed-off-by: Gris Ge <fge@redhat.com>
1 parent 10dc2a7 commit 8bfac41

File tree

3 files changed

+102
-2
lines changed

3 files changed

+102
-2
lines changed

devel/yaml_api.md

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* [Profile Name](#profile-name)
1111
* [Interface Identifier](#interface-identifier)
1212
* [MAC Address](#mac-address)
13+
* [PCI Address](#pci-address)
1314
* [Permanent MAC Address](#permanent-mac-address)
1415
* [MTU](#mtu)
1516
* [Minimum MTU](#minimum-mtu)
@@ -70,7 +71,8 @@
7071
* [Linux Virtual Ethernet(veth) Interface](#linux-virtual-ethernetveth-interface)
7172
* [IPsec Encryption](#ipsec-encryption)
7273
* [Loopback Interface](#loopback-interface)
73-
* [IPvLAN Interface](#ipvlan-interface)
74+
* [IPVLAN Interface](#ipvlan-interface)
75+
* [HSR/PRP Interface](#hsrprp-interface)
7476
* [Routes](#routes)
7577
* [Route Rules](#route-rules)
7678
* [DNS Resolver](#dns-resolver)
@@ -165,6 +167,7 @@ interfaces:
165167
state: up
166168
mac-address: 1C:FF:EE:DD:3B:D3
167169
permanent-mac-address: 1C:FF:EE:DD:BB:D3
170+
pci-address: 0000:07:00.0
168171
mtu: 1500
169172
min-mtu: 256
170173
max-mtu: 2304
@@ -250,6 +253,8 @@ configurations. The valid values are:
250253
holding the specified interface name.
251254
* `mac-address`: Specified configuration is applied to interface holding
252255
the specified MAC address.
256+
* `pci-address`: Specified configuration is applied to interface holding
257+
the specified PCI address.
253258

254259
#### MAC Address
255260

@@ -272,6 +277,56 @@ For applying or generating configurations:
272277
* `identifier: mac-address`, interface holding the specified MAC address
273278
will be used instead of interface name.
274279

280+
Example on matching interface by MAC address:
281+
282+
```yml
283+
---
284+
interfaces:
285+
- name: wan0
286+
type: ethernet
287+
state: up
288+
identifier: mac-address
289+
mac-address: 00:23:45:67:89:1a
290+
ipv4:
291+
enabled: true
292+
dhcp: true
293+
ipv6:
294+
enabled: true
295+
dhcp: true
296+
autoconf: true
297+
```
298+
299+
#### PCI Address
300+
301+
New since 2.2.47.
302+
303+
The `pci-address` property holds the PCI address of this interface.
304+
305+
When showing, nmstate will use format like `0000:07:00.0`.
306+
When applying, nmstate accept format like `07:00.0` with domain set to 0.
307+
308+
When using with `identifier: pci-address`, desired state will be applied to
309+
interface holding specified PCI address instead of desired interface name.
310+
311+
Example on matching interface by PCI address:
312+
313+
```yml
314+
---
315+
interfaces:
316+
- name: wan0
317+
type: ethernet
318+
state: up
319+
identifier: pci-address
320+
pci-address: 0000:07:00.0
321+
ipv4:
322+
enabled: true
323+
dhcp: true
324+
ipv6:
325+
enabled: true
326+
dhcp: true
327+
autoconf: true
328+
```
329+
275330
#### Permanent MAC Address
276331

277332
The `permanent-mac-address` property holds the MAC addresses stored in
@@ -1590,7 +1645,7 @@ Use `state: absent` will revert loopback interface back to kernel defaults.
15901645
Even desired state does not have `127.0.0.1/8` or `::1/128`, nmstate will
15911646
still include those two IPs to loopback interface.
15921647

1593-
### IPvLAN Interface
1648+
### IPVLAN Interface
15941649

15951650
New feature in 2.2.38
15961651

@@ -1623,6 +1678,18 @@ The `ipvlan` section contains these options:
16231678
* `vepa`: Boolean. When enabled, traffic will be forwarded through a central
16241679
switch, helping improve network management and reduce broadcast traffic.
16251680

1681+
### HSR/PRP Interface
1682+
1683+
New feature since 2.2.22
1684+
1685+
HSR (High Availability Seamless Redundancy) and PRP (Parallel Redundancy
1686+
Protocol) interface are treat as `type: hsr`.
1687+
1688+
Example YAML for you to create a HSR interface:
1689+
1690+
```yml
1691+
```
1692+
16261693
## Routes
16271694

16281695
The `routes` top section of network state contains two type routes:

features/pci_identifier.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## Matching Interface using PCI address
2+
3+
New feature in nmstate 2.2.47.
4+
5+
When identifier been set to `pci-address`, nmstate will not use
6+
`interface.name` for NIC matching but use the `interface.pci-address`,
7+
The `interface.name` will be used for `profile-name` when storing the
8+
network configuration in backend.
9+
10+
The `profile-name` will be hide if it is equal to interface name.
11+
12+
Example on creating MAC based profile:
13+
14+
```yml
15+
---
16+
interfaces:
17+
- name: wan0
18+
type: ethernet
19+
state: up
20+
identifier: pci-address
21+
pci-address: 0000:07:00.0
22+
ipv4:
23+
enabled: true
24+
dhcp: true
25+
ipv6:
26+
enabled: true
27+
dhcp: true
28+
autoconf: true
29+
```
30+
31+
Above profile could be delete by `state:absent` using `name: wan0` or its real
32+
interface name.

index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ NetworkManager acts as the main (and currently the only) provider supported.
3232
- [Conditional compiling](./features/conditional_compile.md)
3333
- [Refer SR-IOV VF via PF name and VF ID](./features/iface_vf_id.md)
3434
- [Refer Interface using MAC Address](./features/mac_identifier.md)
35+
- [Refer Interface using PCI Address](./features/pci_identifier.md)
3536
- [IPsec](./features/ipsec.md)
3637
- [DNS](./features/dns.md)
3738

0 commit comments

Comments
 (0)