Files
cozystack/packages/system/linstor/Makefile
Aleksei Sviridkin d28834231c fix(vm-disk)!: refuse a golden-image clone CDI would leave unbound
When CDI clones a golden image into a StorageClass other than the one
the golden PVC lives in, its csi-clone path, and its snapshot path once
it gets a VolumeSnapshotClass of the provisioner, check the two classes
for a common driver, a matching volume mode and room to expand, and
never compare the class names. A target class of the same provisioner
therefore gets no host-assisted fallback and the clone is left to the
CSI driver. LINSTOR creates that clone next to the source data, so on a
target class that does not allow remote volume access from every node,
such as a node-local one, the temporary clone PVC stays unbound with
nothing surfaced to the user.

Refuse such a disk at render time, mirroring the planner's inputs: the
CDI override or the target StorageProfile's strategy, the snapshot class
CDI would pick, the golden's driver as its PV records it, the target's
provisioner, the volume modes and the target's expansion setting, and
refuse only a LINSTOR target whose remote access policy, parsed the way
linstor-csi parses it, is not plainly "from anywhere". A snapshot class
both StorageProfiles name but that does not exist is refused as well,
because CDI then fails to plan the clone instead of falling back. An
empty storageClass is resolved the way CDI resolves it for a kubevirt
DataVolume. A disk whose DataVolume or PVC already exists is exempt,
since CDI can garbage-collect a completed DataVolume. Combinations that
fall back to a host-assisted copy, targets reachable from any node, and
anything else the lookups cannot find still render.

This changes behaviour for a new disk in a LINSTOR class without remote
access from every node, and for one whose StorageProfiles name a
snapshot class that does not exist: both rendered before and are refused
now. The way out is the golden image's class, or the copy clone
strategy.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-10-10 21:16:11 +03:00

45 lines
1.7 KiB
Makefile

export NAME=linstor
export NAMESPACE=cozy-$(NAME)
include ../../../hack/common-envs.mk
include ../../../hack/package.mk
LINSTOR_VERSION ?= 1.33.3
# The golden-image clone guard in packages/apps/vm-disk/templates/dv.yaml
# reads allowRemoteVolumeAccess and layerList the way this release does and
# has to be re-checked against the new one.
LINSTOR_CSI_VERSION ?= v1.11.2
test:
helm unittest .
python3 -m unittest discover -s tests -p 'test_*.py' -v
image: image-piraeus-server image-linstor-csi
image-piraeus-server:
docker buildx build images/piraeus-server \
--build-arg LINSTOR_VERSION=$(LINSTOR_VERSION) \
--build-arg K8S_AWAIT_ELECTION_VERSION=v0.4.2 \
$(call image-tags,piraeus-server,$(LINSTOR_VERSION)) \
$(call cache-args,piraeus-server) \
--metadata-file images/piraeus-server.json \
$(BUILDX_ARGS)
REPOSITORY="$(REGISTRY)/piraeus-server" \
yq -i '.piraeusServer.image.repository = strenv(REPOSITORY)' values.yaml
TAG="$(IMAGE_TAG)@$$(yq e '."containerimage.digest"' images/piraeus-server.json -o json -r)" \
yq -i '.piraeusServer.image.tag = strenv(TAG)' values.yaml
rm -f images/piraeus-server.json
image-linstor-csi:
docker buildx build images/linstor-csi \
--build-arg VERSION=$(LINSTOR_CSI_VERSION) \
$(call image-tags,linstor-csi,$(LINSTOR_CSI_VERSION)) \
$(call cache-args,linstor-csi) \
--metadata-file images/linstor-csi.json \
$(BUILDX_ARGS)
REPOSITORY="$(REGISTRY)/linstor-csi" \
yq -i '.linstorCSI.image.repository = strenv(REPOSITORY)' values.yaml
TAG="$(IMAGE_TAG)@$$(yq e '."containerimage.digest"' images/linstor-csi.json -o json -r)" \
yq -i '.linstorCSI.image.tag = strenv(TAG)' values.yaml
rm -f images/linstor-csi.json