diff options
Diffstat (limited to 'runsc')
-rw-r--r-- | runsc/boot/boot_state_autogen.go | 27 | ||||
-rw-r--r-- | runsc/cmd/statefile.go | 12 |
2 files changed, 29 insertions, 10 deletions
diff --git a/runsc/boot/boot_state_autogen.go b/runsc/boot/boot_state_autogen.go index 167d1cf02..d025a2a1a 100644 --- a/runsc/boot/boot_state_autogen.go +++ b/runsc/boot/boot_state_autogen.go @@ -6,19 +6,32 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *sandboxNetstackCreator) StateTypeName() string { + return "runsc/boot.sandboxNetstackCreator" +} + +func (x *sandboxNetstackCreator) StateFields() []string { + return []string{ + "clock", + "uniqueID", + } +} + func (x *sandboxNetstackCreator) beforeSave() {} -func (x *sandboxNetstackCreator) save(m state.Map) { + +func (x *sandboxNetstackCreator) StateSave(m state.Sink) { x.beforeSave() - m.Save("clock", &x.clock) - m.Save("uniqueID", &x.uniqueID) + m.Save(0, &x.clock) + m.Save(1, &x.uniqueID) } func (x *sandboxNetstackCreator) afterLoad() {} -func (x *sandboxNetstackCreator) load(m state.Map) { - m.Load("clock", &x.clock) - m.Load("uniqueID", &x.uniqueID) + +func (x *sandboxNetstackCreator) StateLoad(m state.Source) { + m.Load(0, &x.clock) + m.Load(1, &x.uniqueID) } func init() { - state.Register("runsc/boot.sandboxNetstackCreator", (*sandboxNetstackCreator)(nil), state.Fns{Save: (*sandboxNetstackCreator).save, Load: (*sandboxNetstackCreator).load}) + state.Register((*sandboxNetstackCreator)(nil)) } diff --git a/runsc/cmd/statefile.go b/runsc/cmd/statefile.go index e6f1907da..daed9e728 100644 --- a/runsc/cmd/statefile.go +++ b/runsc/cmd/statefile.go @@ -20,7 +20,7 @@ import ( "os" "github.com/google/subcommands" - "gvisor.dev/gvisor/pkg/state" + "gvisor.dev/gvisor/pkg/state/pretty" "gvisor.dev/gvisor/pkg/state/statefile" "gvisor.dev/gvisor/runsc/flag" ) @@ -105,8 +105,14 @@ func (s *Statefile) Execute(_ context.Context, f *flag.FlagSet, args ...interfac if err != nil { Fatalf("error parsing statefile: %v", err) } - if err := state.PrettyPrint(output, rc, s.html); err != nil { - Fatalf("error printing state: %v", err) + if s.html { + if err := pretty.PrintHTML(output, rc); err != nil { + Fatalf("error printing state: %v", err) + } + } else { + if err := pretty.PrintText(output, rc); err != nil { + Fatalf("error printing state: %v", err) + } } return subcommands.ExitSuccess } |