Skip to content

CP-315389: Stop lldpd when the last interface leaves the LLDP scope - #7376

Open
changlei-li wants to merge 2 commits into
xapi-project:masterfrom
changlei-li:private/changleli/lldp-stop-when-no-nic
Open

changlei-li wants to merge 2 commits into
xapi-project:masterfrom
changlei-li:private/changleli/lldp-stop-when-no-nic

Conversation

@changlei-li

Copy link
Copy Markdown
Member

networkd started lldpd on the first LLDP-enabled interface but only stopped it on shutdown, so with LLDP disabled on every interface lldpd kept running and kept serving the LLDP-MIB over SNMP.
Move starting lldpd, applying the settings and enabling or disabling the port from set_conf into Scope.add and Scope.remove, so they run under the same lock as the scope change. Then stop lldpd when the last interface is removed from the scope; the next interface added starts it again.

networkd started lldpd on the first LLDP-enabled interface but only
stopped it on shutdown, so with LLDP disabled on every interface lldpd
kept running and kept serving the LLDP-MIB over SNMP.

Move starting lldpd, applying the settings and enabling or disabling
the port from set_conf into Scope.add and Scope.remove, so they run
under the same lock as the scope change. Then stop lldpd when the last
interface is removed from the scope; the next interface added starts it
again.

Signed-off-by: Changlei Li <changlei.li@citrix.com>
When no interface has LLDP enabled, lldpd is not running, so pushing
the management address fails with "Service not running" each time the
address changes. This is expected, so only warn when an interface is in
the LLDP scope.

Signed-off-by: Changlei Li <changlei.li@citrix.com>
@changlei-li

Copy link
Copy Markdown
Member Author

Manual test:

[root@nkg-dt17 ~]# xe pool-set-lldp-enabled value=true
[root@nkg-dt17 ~]# systemctl status lldpd | grep Active
     Active: active (running) since Thu 2026-11-05 03:11:10 UTC; 24s ago
[root@nkg-dt17 ~]# xe pool-set-lldp-enabled value=false
[root@nkg-dt17 ~]# systemctl status lldpd | grep Active
     Active: inactive (dead)

Auto tests:
Passed networking-lldp and bst+bvt test suite

This branch has not been deployed

No deployments
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.

1 participant