From 629017bb197bcda31ac129fb712ba3c6917b100b Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Thu, 30 May 2019 22:01:25 -0400 Subject: [PATCH] When you change the storage driver we ignore the storage-options The storage driver and the storage options in storage.conf should match, but if you change the storage driver via the command line then we need to nil out the default storage options from storage.conf. If the user wants to change the storage driver and use storage options, they need to specify them on the command line. Signed-off-by: Daniel J Walsh --- cmd/podman/libpodruntime/runtime.go | 3 +++ libpod/container_internal.go | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/podman/libpodruntime/runtime.go b/cmd/podman/libpodruntime/runtime.go index 898c81515a..d83a71250a 100644 --- a/cmd/podman/libpodruntime/runtime.go +++ b/cmd/podman/libpodruntime/runtime.go @@ -67,7 +67,10 @@ func getRuntime(ctx context.Context, c *cliconfig.PodmanCommand, renumber bool, if c.Flags().Changed("storage-driver") { storageSet = true storageOpts.GraphDriverName = c.GlobalFlags.StorageDriver + // Overriding the default storage driver caused GraphDriverOptions from storage.conf to be ignored + storageOpts.GraphDriverOptions = []string{} } + // This should always be checked after storage-driver is checked if len(c.GlobalFlags.StorageOpts) > 0 { storageSet = true storageOpts.GraphDriverOptions = c.GlobalFlags.StorageOpts diff --git a/libpod/container_internal.go b/libpod/container_internal.go index c0b5e4302a..9245a8840a 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -360,7 +360,8 @@ func (c *Container) setupStorage(ctx context.Context) error { } return false } - defOptions, err := storage.GetDefaultMountOptions() + + defOptions, err := storage.GetMountOptions(c.runtime.store.GraphDriverName(), c.runtime.store.GraphOptions()) if err != nil { return errors.Wrapf(err, "error getting default mount options") }