Skip to content

Commit

Permalink
Merge pull request #6390 from stgraber/storage
Browse files Browse the repository at this point in the history
lxd/storage: Fix custom volume with underscores
  • Loading branch information
Christian Brauner committed Nov 4, 2019
2 parents 586ed15 + a7e28cb commit 6c4f775
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lxd/storage/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ func volIDFuncMake(state *state.State, poolID int64) func(volType drivers.Volume
// encoding format, so if there is no underscore in the volume name then we assume
// the project is default.
project := "default"
volParts := strings.SplitN(volName, "_", 2)
if len(volParts) > 1 {
project = volParts[0]
volName = volParts[1]
if volType == drivers.VolumeTypeContainer || volType == drivers.VolumeTypeVM {
volParts := strings.SplitN(volName, "_", 2)
if len(volParts) > 1 {
project = volParts[0]
volName = volParts[1]
}
}

volID, _, err := state.Cluster.StoragePoolNodeVolumeGetTypeByProject(project, volName, volTypeID, poolID)
Expand Down

0 comments on commit 6c4f775

Please sign in to comment.