Skip to content

Commit

Permalink
Change to enable volume name can be customized.
Browse files Browse the repository at this point in the history
Signed-off-by: Liping Xue <lipingxue@gmail.com>

Change to enable volume name can be customized.

Remove unused debug info.
  • Loading branch information
lipingxue committed Jul 6, 2017
1 parent 298d486 commit 57a44fc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
9 changes: 5 additions & 4 deletions cli/compose/convert/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,18 @@ func convertVolumeToMount(
return result, errors.Errorf("undefined volume %q", volume.Source)
}

if stackVolume.External.External && stackVolume.External.Name != "" {
return result, errors.Errorf("cannot specify external volume name %q", stackVolume.External.Name)
}
result.Source = namespace.Scope(volume.Source)
result.VolumeOptions = &mount.VolumeOptions{}

if volume.Volume != nil {
result.VolumeOptions.NoCopy = volume.Volume.NoCopy
}

// External named volumes
if stackVolume.External.External {
result.Source = stackVolume.External.Name
return result, nil
if stackVolume.Name != "" {
result.Source = stackVolume.Name
}

result.VolumeOptions.Labels = AddStackLabel(namespace, stackVolume.Labels)
Expand Down
2 changes: 1 addition & 1 deletion cli/compose/schema/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cli/compose/schema/data/config_schema_v3.3.json
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@
"id": "#/definitions/volume",
"type": ["object", "null"],
"properties": {
"name": {"type": "string"},
"driver": {"type": "string"},
"driver_opts": {
"type": "object",
Expand Down
1 change: 1 addition & 0 deletions cli/compose/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ type IPAMPool struct {

// VolumeConfig for a volume
type VolumeConfig struct {
Name string
Driver string
DriverOpts map[string]string `mapstructure:"driver_opts"`
External External
Expand Down

0 comments on commit 57a44fc

Please sign in to comment.