From 6cfa06691ed7106f2d8179d27b1541ba6e756cb2 Mon Sep 17 00:00:00 2001 From: Vicente Cheng Date: Fri, 27 Sep 2024 09:12:01 +0800 Subject: [PATCH] scanner: correct the autoProvision mechanism - we should not set both `Spec.Filesystem.Provisioned` and `Spec.Provision` or the remove operation would be blocked if we only change one of these to false. This is a side-effect that comes from 1877a4ef1743e4bb01b81179aacfe5b32da059ed. For now, we will remove one of these two fields to ensure the delete operation work. We still need mutator to help convert these two fields. Signed-off-by: Vicente Cheng (cherry picked from commit d5b7347189fcf0b7d65bf8d844dc570c1c3bbb7b) --- pkg/controller/blockdevice/controller.go | 1 - pkg/controller/blockdevice/scanner.go | 1 - 2 files changed, 2 deletions(-) diff --git a/pkg/controller/blockdevice/controller.go b/pkg/controller/blockdevice/controller.go index 3040d04d..f06e3c79 100644 --- a/pkg/controller/blockdevice/controller.go +++ b/pkg/controller/blockdevice/controller.go @@ -316,7 +316,6 @@ func (c *Controller) updateDeviceStatus(device *diskv1.BlockDevice, devPath stri logrus.Infof("Auto provisioning block device %s", device.Name) device.Spec.FileSystem.ForceFormatted = true device.Spec.FileSystem.Provisioned = true - device.Spec.Provision = true } return nil } diff --git a/pkg/controller/blockdevice/scanner.go b/pkg/controller/blockdevice/scanner.go index 10d1a7b9..bc625c21 100644 --- a/pkg/controller/blockdevice/scanner.go +++ b/pkg/controller/blockdevice/scanner.go @@ -292,7 +292,6 @@ func (s *Scanner) SaveBlockDevice(bd *diskv1.BlockDevice, autoProvisioned bool) if autoProvisioned { bd.Spec.FileSystem.ForceFormatted = true bd.Spec.FileSystem.Provisioned = true - bd.Spec.Provision = true } logrus.Infof("Add new block device %s with device: %s", bd.Name, bd.Spec.DevPath) return s.Blockdevices.Create(bd)