-
Notifications
You must be signed in to change notification settings - Fork 146
Closed
Description
If I start a Firecracker instance from snapshot with NewNaiveChrootStrategy with WithSnapshot and WithMemoryBackend option like below,
instance, err := firecracker.NewMachine(ctx, cfg,
firecracker.WithSnapshot("", "snapshot.snapshot",
firecracker.WithMemoryBackend("File",
"snapshot.mem",
),
),
firecracker.WithLogger(log.StandardLogger().WithContext(vmcs.Context)),
)
...
err = instance.Start(ctx)instance.Handlers.FcInit modified by Jailer is overwritten to loadSnapshotHandlerList by opt
func NewMachine(ctx context.Context, cfg Config, opts ...Opt) (*Machine, error) {
...
if cfg.JailerCfg != nil {
m.Handlers.Validation = m.Handlers.Validation.Append(JailerConfigValidationHandler)
if err := jail(ctx, m, &cfg); err != nil {
return nil, err
}
} else {
...
for _, opt := range opts {
opt(m)func WithSnapshot(memFilePath, snapshotPath string, opts ...WithSnapshotOpt) Opt {
return func(m *Machine) {
...
m.Handlers.Validation = loadSnapshotValidationHandlerList
m.Handlers.FcInit = loadSnapshotHandlerList
}
}I did a workaround by manually inserting the handler after NewMachine() is initialized.
Is there any other way to do it the way it is intended?
Metadata
Metadata
Assignees
Labels
No labels