-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,11 +71,19 @@ func WithSnapshot(memFilePath, snapshotPath string, opts ...WithSnapshotOpt) Opt | |
| opt(&m.Cfg.Snapshot) | ||
| } | ||
|
|
||
| m.Handlers.Validation = loadSnapshotValidationHandlerList | ||
| m.Handlers.FcInit = loadSnapshotHandlerList | ||
| m.Handlers.Validation = m.Handlers.Validation.Append(LoadSnapshotConfigValidationHandler) | ||
| m.Handlers.FcInit = modifyHandlersForLoadSnapshot(m.Handlers.FcInit) | ||
| } | ||
| } | ||
|
|
||
| func modifyHandlersForLoadSnapshot(l HandlerList) HandlerList { | ||
| for _, h := range loadSnapshotRemoveHandlerList { | ||
| l = l.Remove(h.Name) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| } | ||
| l = l.Append(LoadSnapshotHandler) | ||
| return l | ||
| } | ||
|
|
||
| // WithMemoryBackend sets the memory backend to the given type, using the given | ||
| // backing file path (a regular file for "File" type, or a UFFD socket path for | ||
| // "Uffd" type). | ||
|
|
||
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?