Fix pulse-sensor-proxy pvecm errors in LXC containers (related to #600)

When pulse-sensor-proxy runs inside an LXC container on a Proxmox host,
pvecm status fails with "ipcc_send_rec[1] failed: Unknown error -1"
because the container can't access the host's corosync IPC socket.

This caused repeated warnings every few seconds even though the proxy
can function correctly by discovering local host addresses.

Extended the standalone node detection to recognize "ipcc_send_rec"
errors as indicating an LXC container deployment and gracefully fall
back to local address discovery instead of logging warnings.
This commit is contained in:
rcourtman 2025-11-11 23:04:36 +00:00
parent 515987cc8b
commit 68049e0fb3

View file

@ -572,13 +572,17 @@ func discoverClusterNodes() ([]string, error) {
err := cmd.Run()
// pvecm status exits with code 2 on standalone nodes (not in a cluster)
// Treat this as a valid case and discover local host addresses
// Also handle LXC containers where pvecm can't access corosync IPC
// Treat these as valid cases and discover local host addresses
if err != nil {
stderrStr := stderr.String()
// Check if this is the "not part of a cluster" error
// Check if this is a standalone node or LXC container
// - "does not exist" or "not part of a cluster": standalone node
// - "ipcc_send_rec": running in LXC container without corosync access
if strings.Contains(stderrStr, "does not exist") ||
strings.Contains(stderrStr, "not part of a cluster") {
log.Info().Msg("Standalone Proxmox node detected (not in cluster) - discovering local host addresses")
strings.Contains(stderrStr, "not part of a cluster") ||
strings.Contains(stderrStr, "ipcc_send_rec") {
log.Info().Msg("Standalone Proxmox node or LXC container detected - discovering local host addresses")
return discoverLocalHostAddresses()
}
// For other errors, fail