From 6d4899745c43bb43c03dcb1114513f370996d757 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Tue, 9 Mar 2021 11:06:21 +0100 Subject: options: append CLI graph driver options if --storage-opt are specified on the CLI append them after what is specified in the configuration files instead of overriding it. Closes: https://github.com/containers/podman/issues/9657 [NO TESTS NEEDED] Signed-off-by: Giuseppe Scrivano --- libpod/options.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libpod') diff --git a/libpod/options.go b/libpod/options.go index 6344e1acc..48888a2f2 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -64,15 +64,22 @@ func WithStorageConfig(config storage.StoreOptions) RuntimeOption { setField = true } + graphDriverChanged := false if config.GraphDriverName != "" { rt.storageConfig.GraphDriverName = config.GraphDriverName rt.storageSet.GraphDriverNameSet = true setField = true + graphDriverChanged = true } if config.GraphDriverOptions != nil { - rt.storageConfig.GraphDriverOptions = make([]string, len(config.GraphDriverOptions)) - copy(rt.storageConfig.GraphDriverOptions, config.GraphDriverOptions) + if graphDriverChanged { + rt.storageConfig.GraphDriverOptions = make([]string, len(config.GraphDriverOptions)) + copy(rt.storageConfig.GraphDriverOptions, config.GraphDriverOptions) + } else { + // append new options after what is specified in the config files + rt.storageConfig.GraphDriverOptions = append(rt.storageConfig.GraphDriverOptions, config.GraphDriverOptions...) + } setField = true } -- cgit v1.2.3-54-g00ecf