Skip to content

[design doc] LLDP support#7105

Merged
minglumlu merged 1 commit into
xapi-project:masterfrom
minglumlu:private/mingl/lldp-design
Jun 8, 2026
Merged

[design doc] LLDP support#7105
minglumlu merged 1 commit into
xapi-project:masterfrom
minglumlu:private/mingl/lldp-design

Conversation

@minglumlu

Copy link
Copy Markdown
Member

No description provided.

@minglumlu minglumlu requested a review from psafont June 1, 2026 03:28

@bleader bleader left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds globally good to me, but I don't have the ocaml knowledge to comment on the objects.

See my inline comments for some discussions points on the bigger picture.

Comment thread doc/content/design/lldp.md Outdated
Values:

- `default`: follow `pool.lldp_enabled`
- `enabled`: enable LLDP on the physical NIC of the PIF. Override `pool.lldp_enabled`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"on the physical NIC of the PIF": how will that be handled? PIFs can be a standard network, a vlan network, a bond or a tunnel.

In my mind:

  • standard network is what is described already, nothing to see here
  • VLANs: LLDP is L2, and lives outside the VLAN world, but in XAPI we do have multiple PIFs backed on the same NIC, but wih VLAN, I guess we need to skip them
  • bonds: kind of the same, I think most users need to monitor each link individually and not the bond itself as LLDP is showing the physicality of the devices, but here again we need to skip these PIFs
  • tunnels: I'm not sure if Xen Server uses them, on our side that's an overlay, and shoud probably not be part of the LLDP scope, but again we need to skip them somehow.

@minglumlu minglumlu Jun 2, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature is only for physical PIF. VLAN PIF, bond PIF, tunnel PIF, SR-IOV PIF are skipped, although the data structure is there.
I will state this explicitly here. Thanks.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I think we're aligned that's good to know.

- retrieval of selected received LLDP neighbor fields through `PIF_metrics`
- protection against enabling LLDP by default on NIC drivers known to conflict with storage-related functionality

The implementation uses XAPI for configuration, networkd for per-host application of configuration, and [`lldpd`](https://github.com/lldpd/lldpd) as the LLDP agent in dom0 user space.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we're talking about lldpd specifically but currently XS 8.4 and XCP-ng 8.3 both ship lldpad, but it is unmanaged (in the sense that xapi has nothing to do with it as far as I understand). On our side it is installed, the service runs, but it is not configured to advertise anything and it is up to the administrators to configure it manually (unless I missed something).

My understanding is that there is no package handling lldp on XS9 side as of now. Is the plan to move to lldpd for XS9 only or is that meant to be backported to lcm branch as well? If that's for XS9 only, we could move to lldpd on XCP-ng 9 as well, there is nothing decided as of yet on that front.

If it's meant to be backported, I was about to suggest to have the handling of the actual configuration some kind of abstraction to allow both backend, but it might not be really possible in any way as it seems lldpad seems to be pretty inconvenient to receive advertisements that this design stores in xapi database. In that case we may need to discuss further.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature is going to be in master (XS 9) branch only. One of reasons is just to get the things simpler.

If that's for XS9 only, we could move to lldpd on XCP-ng 9 as well, there is nothing decided as of yet on that front.

It would be great if this could be decided. But it would be fine to have "some kind of abstraction" as well if it would be really needed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's done! We will be going to lldpd for XCP-ng 9, and keep 8.3 as is, so that proposal is all good for me for the grand scheme of things. As I mentionned, I can't talk about the XAPI objects and ocaml as I'm not very well versed in that, I'll see if someone else on our side can have a look as well.

Comment thread doc/content/design/lldp.md Outdated

Default after fresh install: `true`

### `PIF.lldp_status`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word "status" means to me something that reflects some property of the system, but here it is used as a configuration parameter set by the user. Better may be something like lldp_mode, lldp_configuration, or just lldp.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lldp_mode looks better to me 😄

Comment thread doc/content/design/lldp.md Outdated
Comment on lines +106 to +107
- `pool`: the pool reference
- `enabled`: `true` or `false`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I would use self and value as parameter names, like other setters have.

Comment thread doc/content/design/lldp.md Outdated
Comment on lines +120 to +121
- `pif`: the PIF reference;
- `status`: `default`, `enabled`, or `disabled`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here also I'd prefer self and value.

Comment thread doc/content/design/lldp.md Outdated

The following new APIs are added.

### `host.set_lldp_conf`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could avoid adding this and just call PIF.plug from pool.set_lldp_enabled for all attached, physical PIFs in the pool. The PIF.plug call is idempotent, so if nothing else has changed, then it should just update the LLDP config through Interface.make_config. PIF.set_lldp_mode could do the same for individual PIFs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I had a wrong understanding on the ~management_interface:false of Nm.bring_pif_up.
I look at it again. It is harmless even if the PIF is really a management interface.


### Report received LLDP TLVs

networkd periodically queries statistics for individual NICs and writes them to the in-memory file `/dev/shm/network_stats`. The file format is defined in `ocaml/xapi-idl/network/network_stats.ml` and is extended with a new field, `lldp_neighbor`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are other metrics already using this mechanism?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Like carrier, speed, and duplex, etc.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was RRDD protocol version 0

@psafont psafont left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving on behalf of @bleader

@minglumlu

minglumlu commented Jun 5, 2026

Copy link
Copy Markdown
Member Author
  • squash fixups before merge

Signed-off-by: Ming Lu <ming.lu@cloud.com>
@minglumlu minglumlu force-pushed the private/mingl/lldp-design branch from 29fd715 to 4d73459 Compare June 8, 2026 06:42
@minglumlu minglumlu added this pull request to the merge queue Jun 8, 2026
Merged via the queue into xapi-project:master with commit 2501b28 Jun 8, 2026
38 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants