Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing incomplete execution of the configuration issue #521

Merged
merged 4 commits into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions bpfprogs/nfconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"container/list"
"context"
"encoding/json"
"errors"
"fmt"
"net"
"os"
Expand All @@ -20,9 +21,10 @@ import (

"github.com/cilium/ebpf"
"github.com/cilium/ebpf/link"
"github.com/prometheus/client_golang/prometheus"

"github.com/l3af-project/l3afd/v2/config"
"github.com/l3af-project/l3afd/v2/models"
"github.com/prometheus/client_golang/prometheus"

"github.com/rs/zerolog/log"
)
Expand Down Expand Up @@ -759,13 +761,13 @@ func (c *NFConfigs) Deploy(ifaceName, HostName string, bpfProgs *models.BPFProgr

// DeployeBPFPrograms - Starts eBPF programs on the node if they are not running
func (c *NFConfigs) DeployeBPFPrograms(bpfProgs []models.L3afBPFPrograms) error {
var combinedError error

for _, bpfProg := range bpfProgs {
if err := c.Deploy(bpfProg.Iface, bpfProg.HostName, bpfProg.BpfPrograms); err != nil {
if err := c.SaveConfigsToConfigStore(); err != nil {
return fmt.Errorf("deploy eBPF Programs failed to save configs %w", err)
}
return fmt.Errorf("failed to deploy BPF program on iface %s with error: %w", bpfProg.Iface, err)
combinedError = errors.Join(combinedError, fmt.Errorf("failed to deploy BPF program on iface %s with error: %w", bpfProg.Iface, err))
}

if len(c.Ifaces) == 0 {
c.Ifaces = map[string]string{bpfProg.Iface: bpfProg.Iface}
} else {
Expand All @@ -777,9 +779,9 @@ func (c *NFConfigs) DeployeBPFPrograms(bpfProgs []models.L3afBPFPrograms) error
log.Warn().Err(err).Msgf("Remove missing interfaces and BPF programs in the config failed with error ")
}
if err := c.SaveConfigsToConfigStore(); err != nil {
return fmt.Errorf("deploy eBPF Programs failed to save configs %w", err)
combinedError = errors.Join(combinedError, fmt.Errorf("deploy eBPF Programs failed to save configs %w", err))
}
return nil
return combinedError
}

// SaveConfigsToConfigStore - Writes configs to persistent store
Expand Down
Loading