mirror of
https://github.com/containers/podman.git
synced 2025-06-23 02:18:13 +08:00
Merge pull request #20768 from giuseppe/drop-dead-code
libpod: drop dead code
This commit is contained in:
@ -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
|
// WithNoPivotRoot sets the runtime to use MS_MOVE instead of PIVOT_ROOT when
|
||||||
// starting containers.
|
// starting containers.
|
||||||
func WithNoPivotRoot() RuntimeOption {
|
func WithNoPivotRoot() RuntimeOption {
|
||||||
|
@ -115,8 +115,6 @@ type Runtime struct {
|
|||||||
// mechanism to read and write even logs
|
// mechanism to read and write even logs
|
||||||
eventer events.Eventer
|
eventer events.Eventer
|
||||||
|
|
||||||
// noStore indicates whether we need to interact with a store or not
|
|
||||||
noStore bool
|
|
||||||
// secretsManager manages secrets
|
// secretsManager manages secrets
|
||||||
secretsManager *secrets.SecretsManager
|
secretsManager *secrets.SecretsManager
|
||||||
}
|
}
|
||||||
@ -350,9 +348,6 @@ func makeRuntime(runtime *Runtime) (retErr error) {
|
|||||||
}
|
}
|
||||||
runtime.conmonPath = cPath
|
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 {
|
if runtime.doReset && runtime.doRenumber {
|
||||||
return fmt.Errorf("cannot perform system reset while renumbering locks: %w", define.ErrInvalidArg)
|
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
|
var store storage.Store
|
||||||
if needsUserns {
|
if needsUserns {
|
||||||
logrus.Debug("Not configuring container store")
|
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 {
|
} else if err := runtime.configureStore(); err != nil {
|
||||||
// Make a best-effort attempt to clean up if performing a
|
// Make a best-effort attempt to clean up if performing a
|
||||||
// storage reset.
|
// storage reset.
|
||||||
|
@ -37,7 +37,6 @@ type engineOpts struct {
|
|||||||
name string
|
name string
|
||||||
renumber bool
|
renumber bool
|
||||||
migrate bool
|
migrate bool
|
||||||
noStore bool
|
|
||||||
withFDS bool
|
withFDS bool
|
||||||
reset bool
|
reset bool
|
||||||
config *entities.PodmanConfig
|
config *entities.PodmanConfig
|
||||||
@ -49,7 +48,6 @@ func GetRuntimeMigrate(ctx context.Context, fs *flag.FlagSet, cfg *entities.Podm
|
|||||||
name: newRuntime,
|
name: newRuntime,
|
||||||
renumber: false,
|
renumber: false,
|
||||||
migrate: true,
|
migrate: true,
|
||||||
noStore: false,
|
|
||||||
withFDS: true,
|
withFDS: true,
|
||||||
reset: false,
|
reset: false,
|
||||||
config: cfg,
|
config: cfg,
|
||||||
@ -61,7 +59,6 @@ func GetRuntimeDisableFDs(ctx context.Context, fs *flag.FlagSet, cfg *entities.P
|
|||||||
return getRuntime(ctx, fs, &engineOpts{
|
return getRuntime(ctx, fs, &engineOpts{
|
||||||
renumber: false,
|
renumber: false,
|
||||||
migrate: false,
|
migrate: false,
|
||||||
noStore: false,
|
|
||||||
withFDS: false,
|
withFDS: false,
|
||||||
reset: false,
|
reset: false,
|
||||||
config: cfg,
|
config: cfg,
|
||||||
@ -73,7 +70,6 @@ func GetRuntimeRenumber(ctx context.Context, fs *flag.FlagSet, cfg *entities.Pod
|
|||||||
return getRuntime(ctx, fs, &engineOpts{
|
return getRuntime(ctx, fs, &engineOpts{
|
||||||
renumber: true,
|
renumber: true,
|
||||||
migrate: false,
|
migrate: false,
|
||||||
noStore: false,
|
|
||||||
withFDS: true,
|
withFDS: true,
|
||||||
reset: false,
|
reset: false,
|
||||||
config: cfg,
|
config: cfg,
|
||||||
@ -86,7 +82,6 @@ func GetRuntime(ctx context.Context, flags *flag.FlagSet, cfg *entities.PodmanCo
|
|||||||
runtimeLib, runtimeErr = getRuntime(ctx, flags, &engineOpts{
|
runtimeLib, runtimeErr = getRuntime(ctx, flags, &engineOpts{
|
||||||
renumber: false,
|
renumber: false,
|
||||||
migrate: false,
|
migrate: false,
|
||||||
noStore: false,
|
|
||||||
withFDS: true,
|
withFDS: true,
|
||||||
reset: false,
|
reset: false,
|
||||||
config: cfg,
|
config: cfg,
|
||||||
@ -95,23 +90,10 @@ func GetRuntime(ctx context.Context, flags *flag.FlagSet, cfg *entities.PodmanCo
|
|||||||
return runtimeLib, runtimeErr
|
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) {
|
func GetRuntimeReset(ctx context.Context, fs *flag.FlagSet, cfg *entities.PodmanConfig) (*libpod.Runtime, error) {
|
||||||
return getRuntime(ctx, fs, &engineOpts{
|
return getRuntime(ctx, fs, &engineOpts{
|
||||||
renumber: false,
|
renumber: false,
|
||||||
migrate: false,
|
migrate: false,
|
||||||
noStore: false,
|
|
||||||
withFDS: true,
|
withFDS: true,
|
||||||
reset: true,
|
reset: true,
|
||||||
config: cfg,
|
config: cfg,
|
||||||
@ -208,9 +190,6 @@ func getRuntime(ctx context.Context, fs *flag.FlagSet, opts *engineOpts) (*libpo
|
|||||||
options = append(options, libpod.WithStorageConfig(storageOpts))
|
options = append(options, libpod.WithStorageConfig(storageOpts))
|
||||||
}
|
}
|
||||||
|
|
||||||
if !storageSet && opts.noStore {
|
|
||||||
options = append(options, libpod.WithNoStore())
|
|
||||||
}
|
|
||||||
// TODO CLI flags for image config?
|
// TODO CLI flags for image config?
|
||||||
// TODO CLI flag for signature policy?
|
// TODO CLI flag for signature policy?
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user