mirror of
https://github.com/containers/podman.git
synced 2025-06-23 02:18:13 +08:00
Merge pull request #10149 from rhatdan/volume
Allow docker volume create API to pass without name
This commit is contained in:
@ -96,12 +96,18 @@ func CreateVolume(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
existingVolume *libpod.Volume
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if len(input.Name) != 0 {
|
||||||
// See if the volume exists already
|
// See if the volume exists already
|
||||||
existingVolume, err := runtime.GetVolume(input.Name)
|
existingVolume, err = runtime.GetVolume(input.Name)
|
||||||
if err != nil && errors.Cause(err) != define.ErrNoSuchVolume {
|
if err != nil && errors.Cause(err) != define.ErrNoSuchVolume {
|
||||||
utils.InternalServerError(w, err)
|
utils.InternalServerError(w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if using the compat layer and the volume already exists, we
|
// if using the compat layer and the volume already exists, we
|
||||||
// must return a 201 with the same information as create
|
// must return a 201 with the same information as create
|
||||||
|
@ -13,6 +13,13 @@ t POST libpod/volumes/create name=foo1 201 \
|
|||||||
.CreatedAt~[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}.* \
|
.CreatedAt~[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}.* \
|
||||||
.Labels={} \
|
.Labels={} \
|
||||||
.Options={}
|
.Options={}
|
||||||
|
t POST volumes/create 201 \
|
||||||
|
.Name~[0-9a-f]\\{64\\}
|
||||||
|
.Driver=local \
|
||||||
|
.Mountpoint=$volumepath/~[0-9a-f]\\{64\\}/_data \
|
||||||
|
.CreatedAt~[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}.* \
|
||||||
|
.Labels={} \
|
||||||
|
.Options={}
|
||||||
t POST libpod/volumes/create 201
|
t POST libpod/volumes/create 201
|
||||||
t POST libpod/volumes/create \
|
t POST libpod/volumes/create \
|
||||||
Name=foo2 \
|
Name=foo2 \
|
||||||
|
Reference in New Issue
Block a user