Skip to content

Volume ID and name being mixed up

Nomad CSI volumes have both a name and ID. The ID of a volume must be unique to the cluster, but names are just for display purpose. Therefor names can actually be reused within the cluster.

When a volume is created the controller logs "Creating volume with the name <volume_name>" (source). That's fine, but the log is at least correct that the value being logged is the name of the volume.

One line later the value of "volume_id" is set using the backend create method, which in essence just takes the volume name and uses it as the volume ID.

The problem is that volume names are not required to be unique. It is possible, and not uncommon, to use the same volume name between staging and production namespaces on the same cluster.

There is some slight extra confusion around this because the node.py code has this log:

        self.logger.info(
            f"Received unmount request for {request.volume_id!r} at {request.target_path!r}"
        )

That "volume_id" is actually the CSI volume name. So at an initial glance of this code you would think we are using the CSI volume ID, but that isn't what's happening.

If this is all intentional my apologies. If it isn't, I don't know how you "fix" it without breaking backwards compatibility. :( At the very least it would be good to acknowledge in the docs what's going on.