Skip to content

Commit

Permalink
options: append CLI graph driver options
Browse files Browse the repository at this point in the history
if --storage-opt are specified on the CLI append them after what is
specified in the configuration files instead of overriding it.

Closes: containers#9657

[NO TESTS NEEDED]

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Mar 9, 2021
1 parent 789d579 commit 6d48997
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions libpod/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 6d48997

Please sign in to comment.