[CSI] Idempotence of CreateVolume with unknown-size volumes

14 views
Skip to first unread message

Nicolas Trangez

unread,
May 5, 2020, 5:26:42 AM5/5/20
to container-storage-...@googlegroups.com
All,

The CSI spec requires `CreateVolume` requests on a `ControllerService`
to be idempotent [1]:

> This operation MUST be idempotent. If a volume corresponding to the
> specified volume name already exists, is accessible from
> accessibility_requirements, and is compatible with the specified
> capacity_range, volume_capabilities and parameters in the
> CreateVolumeRequest, the Plugin MUST reply 0 OK with the
> corresponding CreateVolumeResponse.

The part about 'compatible capacity_range' is interesting in the case
where a driver uses capacity '0' for created volumes, which is valid:

> The capacity of the volume in bytes. This field is OPTIONAL. If not
> set (value of 0), it indicates that the capacity of the volume is
> unknown (e.g., NFS share).
> The value of this field MUST NOT be negative.

As such, if a volume is created with capacity request N, and the driver
returns a capacity of 0 in the `CreateVolume` response, then later on a
`CreateVolume` request comes in with the same `name`, compatible
`volume_capabilities` and compatible `parameters` but a different
capacity request (either lower or higher than N), is the driver allowed
to ignore this requested capacity (any 'new' volume would have capacity
0 anyway) and treat the operation as a no-op?

There's a bug report[2] for a test in csi-sanity [3] which asserts that
a `CreateVolume` of same name etc. but different capacity range fails
with `ALREADY_EXISTS`, which seems to be along the lines of 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.

However, as outlined above, volumes of infinite size may need to be
handled somewhat different.

I created a PR for csi-sanity [4] to handle this corner-case, but
wanted to get community input as to whether my interpretation of the
spec is correct, and maybe this should be further clarified in the
document.

Regards,

Nicolas

[1]
https://github.com/container-storage-interface/spec/blob/87a27a2496565857ed564284eaa762587feb9453/spec.md#createvolume
[2] https://github.com/kubernetes-csi/csi-test/issues/94
[3]
https://github.com/kubernetes-csi/csi-test/blob/99b7db913362368d25246ab05261ca14e92c6534/pkg/sanity/controller.go#L559
[4] https://github.com/kubernetes-csi/csi-test/pull/263

Saad Ali

unread,
May 11, 2020, 7:00:50 PM5/11/20
to Nicolas Trangez, container-storage-interface-community
That is a good question. The spec is likely underspecified there. Worth discussing at the next CSI meeting if you want to add it to the agenda?

--
You received this message because you are subscribed to the Google Groups "container-storage-interface-community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to container-storage-interf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/container-storage-interface-community/4a721036db9442d42dc6c7416dc1431381290772.camel%40scality.com.
Reply all
Reply to author
Forward
0 new messages