Skip to content

Commit

Permalink
sanity: volumes of zero capacity can be recreated
Browse files Browse the repository at this point in the history
In general, when creating a volume of some requested capacity using
`CreateVolume`, then re-running the RPC with the same name but different
capacity request, this ought to fail with `ALREADY_EXISTS` (according to
the spec). However, when the reported capacity of a volume equals zero,
the volume capacity is unknown (again according to the spec). As such,
when issueing another `CreateVolume` call using the same name but a
different requested capacity, this should not necessarily fail, since a
volume whose size is (theoretically) unlimited is compatible with *any*
requested capacity.

This is in line with the spec:

> Indicates that a volume corresponding to the specified volume name
> already exists but is incompatible with the specified capacity_range,
> volume_capabilities or parameters.

Given this, the relevant test is updated to *skip* when the capacity as
returned by the first `CreateVolume` call equals zero.

See: kubernetes-csi#94
See: kubernetes-csi#94 (comment)
See: https://github.com/container-storage-interface/spec/blob/e129a75169c13bade7c7336afe21f259740ba679/spec.md#createvolume-errors
  • Loading branch information
NicolasT committed Apr 28, 2020
1 parent b91f254 commit 6f14812
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/sanity/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,11 @@ var _ = DescribeSanity("Controller Service [Controller Server]", func(sc *TestCo
Expect(vol1.GetVolume()).NotTo(BeNil())
Expect(vol1.GetVolume().GetVolumeId()).NotTo(BeEmpty())
cl.RegisterVolume(name, VolumeInfo{VolumeID: vol1.GetVolume().GetVolumeId()})

if vol1.GetVolume().GetCapacityBytes() == 0 {
Skip("Reported volume capacity is 0, no conflict expected")
}

size2 := 2 * TestVolumeSize(sc)

_, err = c.CreateVolume(
Expand Down

0 comments on commit 6f14812

Please sign in to comment.