CP-312082 Implement APIs for configuration of lldp - #7200
Open
changlei-li wants to merge 6 commits into
Open
Conversation
Add the XAPI database fields and enums for the LLDP feature: - pool.lldp_enabled (bool, DynamicRO): pool-wide LLDP toggle. Fresh-install default is true (set in create_pool_record); the datamodel default_value is false, which is the value applied on update/RPU from a release without LLDP. - pool.lldp_multicast_address (enum lldp_multicast_address, RW): the multicast MAC address group used for LLDP advertising. - PIF.lldp_mode (enum pif_lldp_mode, DynamicRO): per-PIF override of the pool-wide setting (default | enabled | disabled). All existing Db.PIF.create and Db.Pool.create call sites are updated to pass the new fields. Signed-off-by: Changlei Li <changlei.li@citrix.com>
changlei-li
marked this pull request as draft
July 30, 2026 05:32
Add the XenAPI messages and their implementations, forwarding and CLI: - pool.set_lldp_enabled (self, value, force): sets pool.lldp_enabled and, for every managed physical PIF, re-applies the LLDP configuration via PIF.plug, returning a map of PIFs that failed and their error message. When force is false and value already matches the current setting it is a no-op returning an empty map. - PIF.set_lldp_mode (self, value, force): sets PIF.lldp_mode on a managed physical PIF and re-applies via PIF.plug. Non-physical PIFs are rejected with PIF_IS_NOT_PHYSICAL. For bond members, applies lldp config via pluging their bond master PIF. CLI: 'xe pool-set-lldp-enabled', 'xe pif-set-lldp-mode', and read-only param-list fields lldp-enabled, lldp-multicast-address (settable via pool-param-set) and lldp-mode. Signed-off-by: Changlei Li <changlei.li@citrix.com>
When bringing up the NIC of a managed physical PIF, build the networkd LLDP record from the XAPI database and include it in the interface configuration passed to networkd, replacing the previous hard-coded 'lldp = None'. The effective state resolves the configuration matrix: PIF.lldp_mode of enabled/disabled overrides pool.lldp_enabled, and 'enabled' additionally sets 'force' so networkd overrides its NIC-driver blocklist. The chassis id, system name and description are taken from the host, and the multicast address from pool.lldp_multicast_address. Signed-off-by: Changlei Li <changlei.li@citrix.com>
Apply the LLDP change to networkd only for PIFs that are currently attached; an unplugged PIF has its DB value updated and picks up the setting the next time it is brought up. This avoids bringing up interfaces that were deliberately down as a side effect of a pure LLDP configuration change. PIF.set_lldp_mode re-plugs the target (self, or the bond master for a bond member) only if it is currently_attached; pool.set_lldp_enabled re-plugs only currently-attached standalone physical PIFs and bond masters. Signed-off-by: Changlei Li <changlei.li@citrix.com>
changlei-li
force-pushed
the
private/changleli/lldp-apis
branch
from
July 30, 2026 05:42
8523153 to
820ffbd
Compare
'default' is a reserved keyword in C#, which breaks the generated SDK. Rename the pif_lldp_mode enum value to 'inherited' (it means the PIF follows pool.lldp_enabled) and update the field default, descriptions, CLI help accordingly. Signed-off-by: Changlei Li <changlei.li@citrix.com>
Signed-off-by: Changlei Li <changlei.li@citrix.com>
changlei-li
force-pushed
the
private/changleli/lldp-apis
branch
from
July 30, 2026 06:25
820ffbd to
af088e5
Compare
Contributor
Author
|
Self test:
|
changlei-li
marked this pull request as ready for review
July 30, 2026 07:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Design doc: https://github.com/xapi-project/xen-api/blob/master/doc/content/design/lldp.md
New fileds:
pool.lldp_enabled
pool.lldp_multicast_address (RW)
pif.lldp_mode
APIs:
pool.set_lldp_enabled
PIF.set_lldp_mode
CLI:
xe pool-set-lldp-enabled
xe pif-set-lldp-mode