diff --git a/lxd/network/acl/acl_interface.go b/lxd/network/acl/acl_interface.go index 13d329318b4f..33d45c5baa2e 100644 --- a/lxd/network/acl/acl_interface.go +++ b/lxd/network/acl/acl_interface.go @@ -1,6 +1,8 @@ package acl import ( + "context" + "github.com/canonical/lxd/lxd/cluster/request" "github.com/canonical/lxd/lxd/state" "github.com/canonical/lxd/shared/api" @@ -19,7 +21,7 @@ type NetworkACL interface { UsedBy() ([]string, error) // GetLog. - GetLog(clientType request.ClientType) (string, error) + GetLog(ctx context.Context, clientType request.ClientType) (string, error) // Internal validation. validateName(name string) error diff --git a/lxd/network/acl/driver_common.go b/lxd/network/acl/driver_common.go index b36f5d33d12e..f07bc0a17146 100644 --- a/lxd/network/acl/driver_common.go +++ b/lxd/network/acl/driver_common.go @@ -749,7 +749,7 @@ func (d *common) Delete() error { } // GetLog gets the ACL log. -func (d *common) GetLog(clientType request.ClientType) (string, error) { +func (d *common) GetLog(ctx context.Context, clientType request.ClientType) (string, error) { // ACLs aren't specific to a particular network type but the log only works with OVN. var logEntries []string var err error @@ -759,7 +759,7 @@ func (d *common) GetLog(clientType request.ClientType) (string, error) { targetPath, err := os.Readlink("/run/openvswitch") if err == nil && strings.HasSuffix(targetPath, "/microovn/chassis/switch") { prefix := fmt.Sprintf("lxd_acl%d-", d.id) - logEntries, err = ovnParseLogEntriesFromJournald(context.TODO(), "snap.microovn.chassis.service", prefix) + logEntries, err = ovnParseLogEntriesFromJournald(ctx, "snap.microovn.chassis.service", prefix) if err != nil { return "", fmt.Errorf("Failed to get OVN log entries from syslog: %v\n", err) } diff --git a/lxd/network_acls.go b/lxd/network_acls.go index ea446ba2f7cf..d56cabb4a9ba 100644 --- a/lxd/network_acls.go +++ b/lxd/network_acls.go @@ -637,7 +637,7 @@ func networkACLLogGet(d *Daemon, r *http.Request) response.Response { } clientType := clusterRequest.UserAgentClientType(r.Header.Get("User-Agent")) - log, err := netACL.GetLog(clientType) + log, err := netACL.GetLog(r.Context(), clientType) if err != nil { return response.SmartError(err) }