-
Notifications
You must be signed in to change notification settings - Fork 145
Do not overwrite handlers in LoadSnapshot #630
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
Do not overwrite handlers in LoadSnapshot #630
Conversation
|
|
||
| func modifyHandlersForLoadSnapshot(l HandlerList) HandlerList { | ||
| for _, h := range loadSnapshotRemoveHandlerList { | ||
| l = l.Remove(h.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Remove handle the case when h.Name is not present in the Handler list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems it should return the same HandlerList: https://github.com/firecracker-microvm/firecracker-go-sdk/blob/main/handlers.go#L448
| LoadSnapshotHandler, | ||
| AddVsocksHandler, | ||
| ) | ||
| var loadSnapshotRemoveHandlerList = []Handler{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a comment here for future reference on why we need to have a filter list?
0a2e6de to
d0d94d9
Compare
As LoadSnapshot requires only a subset of the default handlers, it was implemented by assigning the FcInit handlers to a smaller list of handlers. However, this meant that it would overwrite the FcInit handlers given by the jailer. This PR fixes this behavior by just removing the unnecessary handlers, instead of overwriting them entirely. Signed-off-by: David Son <[email protected]>
d0d94d9 to
f599c51
Compare
Issue #, if available:
Closes #627
Description of changes:
As LoadSnapshot requires only a subset of the default handlers, it was implemented by assigning the FcInit handlers to a smaller list of handlers. However, this meant that it would overwrite the FcInit handlers given by the jailer. This PR fixes this behavior by just removing the unnecessary handlers, instead of overwriting them entirely.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.