From fe65f059ab2664b338c8fdcfcabd5112bfdc7e07 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 24 Nov 2023 11:18:48 +0100 Subject: [PATCH] libpod: drop dead code these functions are not used anymore in the codebase, so drop them. [NO NEW TESTS NEEDED] no new functionalities are added Signed-off-by: Giuseppe Scrivano --- libpod/options.go | 9 --------- libpod/runtime.go | 7 ------- pkg/domain/infra/runtime_libpod.go | 21 --------------------- 3 files changed, 37 deletions(-) diff --git a/libpod/options.go b/libpod/options.go index 827852c0b9..83f8afba08 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -365,15 +365,6 @@ func WithTmpDir(dir string) RuntimeOption { } } -// WithNoStore sets a bool on the runtime that we do not need -// any containers storage. -func WithNoStore() RuntimeOption { - return func(rt *Runtime) error { - rt.noStore = true - return nil - } -} - // WithNoPivotRoot sets the runtime to use MS_MOVE instead of PIVOT_ROOT when // starting containers. func WithNoPivotRoot() RuntimeOption { diff --git a/libpod/runtime.go b/libpod/runtime.go index c58b2fb9ec..5130eb6fb5 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -115,8 +115,6 @@ type Runtime struct { // mechanism to read and write even logs eventer events.Eventer - // noStore indicates whether we need to interact with a store or not - noStore bool // secretsManager manages secrets secretsManager *secrets.SecretsManager } @@ -350,9 +348,6 @@ func makeRuntime(runtime *Runtime) (retErr error) { } runtime.conmonPath = cPath - if runtime.noStore && runtime.doReset { - return fmt.Errorf("cannot perform system reset if runtime is not creating a store: %w", define.ErrInvalidArg) - } if runtime.doReset && runtime.doRenumber { return fmt.Errorf("cannot perform system reset while renumbering locks: %w", define.ErrInvalidArg) } @@ -462,8 +457,6 @@ func makeRuntime(runtime *Runtime) (retErr error) { var store storage.Store if needsUserns { logrus.Debug("Not configuring container store") - } else if runtime.noStore { - logrus.Debug("No store required. Not opening container store.") } else if err := runtime.configureStore(); err != nil { // Make a best-effort attempt to clean up if performing a // storage reset. diff --git a/pkg/domain/infra/runtime_libpod.go b/pkg/domain/infra/runtime_libpod.go index 52c882b8b7..d598b1dd39 100644 --- a/pkg/domain/infra/runtime_libpod.go +++ b/pkg/domain/infra/runtime_libpod.go @@ -37,7 +37,6 @@ type engineOpts struct { name string renumber bool migrate bool - noStore bool withFDS bool reset bool config *entities.PodmanConfig @@ -49,7 +48,6 @@ func GetRuntimeMigrate(ctx context.Context, fs *flag.FlagSet, cfg *entities.Podm name: newRuntime, renumber: false, migrate: true, - noStore: false, withFDS: true, reset: false, config: cfg, @@ -61,7 +59,6 @@ func GetRuntimeDisableFDs(ctx context.Context, fs *flag.FlagSet, cfg *entities.P return getRuntime(ctx, fs, &engineOpts{ renumber: false, migrate: false, - noStore: false, withFDS: false, reset: false, config: cfg, @@ -73,7 +70,6 @@ func GetRuntimeRenumber(ctx context.Context, fs *flag.FlagSet, cfg *entities.Pod return getRuntime(ctx, fs, &engineOpts{ renumber: true, migrate: false, - noStore: false, withFDS: true, reset: false, config: cfg, @@ -86,7 +82,6 @@ func GetRuntime(ctx context.Context, flags *flag.FlagSet, cfg *entities.PodmanCo runtimeLib, runtimeErr = getRuntime(ctx, flags, &engineOpts{ renumber: false, migrate: false, - noStore: false, withFDS: true, reset: false, config: cfg, @@ -95,23 +90,10 @@ func GetRuntime(ctx context.Context, flags *flag.FlagSet, cfg *entities.PodmanCo return runtimeLib, runtimeErr } -// GetRuntimeNoStore generates a new libpod runtime configured by command line options -func GetRuntimeNoStore(ctx context.Context, fs *flag.FlagSet, cfg *entities.PodmanConfig) (*libpod.Runtime, error) { - return getRuntime(ctx, fs, &engineOpts{ - renumber: false, - migrate: false, - noStore: true, - withFDS: true, - reset: false, - config: cfg, - }) -} - func GetRuntimeReset(ctx context.Context, fs *flag.FlagSet, cfg *entities.PodmanConfig) (*libpod.Runtime, error) { return getRuntime(ctx, fs, &engineOpts{ renumber: false, migrate: false, - noStore: false, withFDS: true, reset: true, config: cfg, @@ -208,9 +190,6 @@ func getRuntime(ctx context.Context, fs *flag.FlagSet, opts *engineOpts) (*libpo options = append(options, libpod.WithStorageConfig(storageOpts)) } - if !storageSet && opts.noStore { - options = append(options, libpod.WithNoStore()) - } // TODO CLI flags for image config? // TODO CLI flag for signature policy?