Skip to content

Commit

Permalink
Add read/write lock in the fault handler (#4309)
Browse files Browse the repository at this point in the history
* Add read/write lock in the fault injection handler

* Remove ENI ID which is used for RWMutex

* Add a comment
  • Loading branch information
xxx0624 authored Sep 5, 2024
1 parent 67ff392 commit 9ddccf9
Show file tree
Hide file tree
Showing 8 changed files with 336 additions and 130 deletions.
5 changes: 1 addition & 4 deletions agent/handlers/task_server_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,7 @@ func registerFaultHandlers(
agentState *v4.TMDSAgentState,
metricsFactory metrics.EntryFactory,
) {
handler := fault.FaultHandler{
AgentState: agentState,
MetricsFactory: metricsFactory,
}
handler := fault.New(agentState, metricsFactory)

if muxRouter == nil {
return
Expand Down
7 changes: 6 additions & 1 deletion agent/handlers/v4/tmdsstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ func (s *TMDSAgentState) getTaskMetadata(v3EndpointID string, includeTags bool)
Path: task.GetNetworkNamespace(),
NetworkInterfaces: []*tmdsv4.NetworkInterface{
{
DeviceName: "",
// TODO: fetch the correct device name.
// We are exposing this information via AgentState to facilitate the fault injection
// handler to start/stop/check network faults.
// Use 'eth0'(a fake value) for existing fault injection related unit tests for now and
// it will be updated in the future.
DeviceName: "eth0",
},
},
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9ddccf9

Please sign in to comment.