From 23d84ae32c003f66b2e343425622bb02eabf3dd6 Mon Sep 17 00:00:00 2001 From: John Cho Date: Sat, 5 Jul 2025 00:15:08 -0700 Subject: [PATCH 1/2] Remove FSS cnsmgr-suspend-create-volume --- manifests/guestcluster/1.33/pvcsi.yaml | 1 - manifests/supervisorcluster/1.32/cns-csi.yaml | 1 - pkg/common/unittestcommon/utils.go | 1 - .../k8sorchestrator/k8sorchestrator.go | 1 - pkg/csi/service/common/constants.go | 2 -- pkg/csi/service/common/vsphereutil.go | 29 +++++++------------ pkg/csi/service/vanilla/controller.go | 14 ++++----- pkg/csi/service/wcp/controller.go | 7 ++--- pkg/syncer/storagepool/migrationController.go | 5 +--- 9 files changed, 19 insertions(+), 42 deletions(-) diff --git a/manifests/guestcluster/1.33/pvcsi.yaml b/manifests/guestcluster/1.33/pvcsi.yaml index 79060adf97..264540370f 100644 --- a/manifests/guestcluster/1.33/pvcsi.yaml +++ b/manifests/guestcluster/1.33/pvcsi.yaml @@ -665,7 +665,6 @@ data: "csi-sv-feature-states-replication": "false" # Do not enable for guest cluster, Refer PR#2386 for details "block-volume-snapshot": "true" "tkgs-ha": "true" - "cnsmgr-suspend-create-volume": "true" "csi-windows-support": "true" "workload-domain-isolation": "true" "sv-pvc-snapshot-protection-finalizer": "false" diff --git a/manifests/supervisorcluster/1.32/cns-csi.yaml b/manifests/supervisorcluster/1.32/cns-csi.yaml index c06babb04d..304cdc9e9c 100644 --- a/manifests/supervisorcluster/1.32/cns-csi.yaml +++ b/manifests/supervisorcluster/1.32/cns-csi.yaml @@ -558,7 +558,6 @@ data: "block-volume-snapshot": "true" "tkgs-ha": "true" "list-volumes": "true" - "cnsmgr-suspend-create-volume": "true" "storage-quota-m2": "true" "vdpp-on-stretched-supervisor": "true" "cns-unregister-volume": "false" diff --git a/pkg/common/unittestcommon/utils.go b/pkg/common/unittestcommon/utils.go index 9b496c0dc9..51953f2e76 100644 --- a/pkg/common/unittestcommon/utils.go +++ b/pkg/common/unittestcommon/utils.go @@ -71,7 +71,6 @@ func GetFakeContainerOrchestratorInterface(orchestratorType int) (commonco.COCom "csi-windows-support": "true", "use-csinode-id": "true", "pv-to-backingdiskobjectid-mapping": "false", - "cnsmgr-suspend-create-volume": "true", "topology-preferential-datastores": "true", "multi-vcenter-csi-topology": "true", "listview-tasks": "true", diff --git a/pkg/csi/service/common/commonco/k8sorchestrator/k8sorchestrator.go b/pkg/csi/service/common/commonco/k8sorchestrator/k8sorchestrator.go index 734e7d1e7b..eac570f69f 100644 --- a/pkg/csi/service/common/commonco/k8sorchestrator/k8sorchestrator.go +++ b/pkg/csi/service/common/commonco/k8sorchestrator/k8sorchestrator.go @@ -394,7 +394,6 @@ func getReleasedVanillaFSS() map[string]struct{} { common.BlockVolumeSnapshot: {}, common.CSIWindowsSupport: {}, common.ListVolumes: {}, - common.CnsMgrSuspendCreateVolume: {}, common.TopologyPreferentialDatastores: {}, common.MultiVCenterCSITopology: {}, common.CSIInternalGeneratedClusterID: {}, diff --git a/pkg/csi/service/common/constants.go b/pkg/csi/service/common/constants.go index cf4c266b85..5561be110f 100644 --- a/pkg/csi/service/common/constants.go +++ b/pkg/csi/service/common/constants.go @@ -406,8 +406,6 @@ const ( ListVolumes = "list-volumes" // PVtoBackingDiskObjectIdMapping is the feature to support pv to backingDiskObjectId mapping on vSphere CSI driver. PVtoBackingDiskObjectIdMapping = "pv-to-backingdiskobjectid-mapping" - // Block Create Volume for datastores that are in suspended mode - CnsMgrSuspendCreateVolume = "cnsmgr-suspend-create-volume" // TopologyPreferentialDatastores is the feature gate for preferential // datastore deployment in topology aware environments. TopologyPreferentialDatastores = "topology-preferential-datastores" diff --git a/pkg/csi/service/common/vsphereutil.go b/pkg/csi/service/common/vsphereutil.go index eb5784c6af..28138416e0 100644 --- a/pkg/csi/service/common/vsphereutil.go +++ b/pkg/csi/service/common/vsphereutil.go @@ -55,7 +55,6 @@ type VanillaCreateBlockVolParamsForMultiVC struct { // CreateBlockVolumeOptions defines the FSS required to create a block volume. type CreateBlockVolumeOptions struct { - FilterSuspendedDatastores, UseSupervisorId, IsVdppOnStretchedSvFssEnabled bool IsByokEnabled bool @@ -101,7 +100,6 @@ func CreateBlockVolumeUtil( var clusterMorefs []vim25types.ManagedObjectReference var datastoreInfoList []*vsphere.DatastoreInfo - var containerClusterArray []cnstypes.CnsContainerCluster clusterID := manager.CnsConfig.Global.ClusterID if opts.UseSupervisorId { @@ -146,12 +144,10 @@ func CreateBlockVolumeUtil( createSpec.ActiveClusters = clusterMorefs } else { var datastores []vim25types.ManagedObjectReference - if opts.FilterSuspendedDatastores { - sharedDatastores, err = vsphere.FilterSuspendedDatastores(ctx, sharedDatastores) - if err != nil { - log.Errorf("Error occurred while filter suspended datastores, err: %+v", err) - return nil, csifault.CSIInternalFault, err - } + sharedDatastores, err = vsphere.FilterSuspendedDatastores(ctx, sharedDatastores) + if err != nil { + log.Errorf("Error occurred while filter suspended datastores, err: %+v", err) + return nil, csifault.CSIInternalFault, err } var datastoreObj *vsphere.Datastore @@ -177,7 +173,7 @@ func CreateBlockVolumeUtil( continue } - if opts.FilterSuspendedDatastores && vsphere.IsVolumeCreationSuspended(ctx, datastoreInfoObj) { + if vsphere.IsVolumeCreationSuspended(ctx, datastoreInfoObj) { continue } datastoreObj = datastoreInfoObj.Datastore @@ -223,7 +219,7 @@ func CreateBlockVolumeUtil( continue } - if opts.FilterSuspendedDatastores && vsphere.IsVolumeCreationSuspended(ctx, datastoreInfoObj) { + if vsphere.IsVolumeCreationSuspended(ctx, datastoreInfoObj) { continue } datastoreObj = datastoreInfoObj.Datastore @@ -585,7 +581,7 @@ func CreateBlockVolumeUtilForMultiVC(ctx context.Context, reqParams interface{}, func CreateFileVolumeUtil(ctx context.Context, clusterFlavor cnstypes.CnsClusterFlavor, vc *vsphere.VirtualCenter, volumeManager cnsvolume.Manager, cnsConfig *config.Config, spec *CreateVolumeSpec, datastores []*vsphere.DatastoreInfo, vSphereClusterMorefs []string, - filterSuspendedDatastores, useSupervisorId bool, extraParams interface{}) ( + useSupervisorId bool, extraParams interface{}) ( *cnsvolume.CnsVolumeInfo, string, error) { log := logger.GetLogger(ctx) var err error @@ -600,15 +596,12 @@ func CreateFileVolumeUtil(ctx context.Context, clusterFlavor cnstypes.CnsCluster return nil, csifault.CSIInternalFault, err } } - var datastoreMorefs []vim25types.ManagedObjectReference if len(datastores) != 0 { - if filterSuspendedDatastores { - datastores, err = vsphere.FilterSuspendedDatastores(ctx, datastores) - if err != nil { - log.Errorf("Error occurred while filter suspended datastores, err: %+v", err) - return nil, csifault.CSIInternalFault, err - } + datastores, err = vsphere.FilterSuspendedDatastores(ctx, datastores) + if err != nil { + log.Errorf("Error occurred while filter suspended datastores, err: %+v", err) + return nil, csifault.CSIInternalFault, err } if spec.ScParams.DatastoreURL == "" { datastoreMorefs = getDatastoreMoRefs(datastores) diff --git a/pkg/csi/service/vanilla/controller.go b/pkg/csi/service/vanilla/controller.go index 191fae303b..3fe8184f3f 100644 --- a/pkg/csi/service/vanilla/controller.go +++ b/pkg/csi/service/vanilla/controller.go @@ -91,7 +91,7 @@ var ( // The following variables hold feature states for multi-vcenter-csi-topology, CSI Migration // and authorisation check. - multivCenterCSITopologyEnabled, csiMigrationEnabled, filterSuspendedDatastores, + multivCenterCSITopologyEnabled, csiMigrationEnabled, isTopologyAwareFileVolumeEnabled, isCSITransactionSupportEnabled bool // variables for list volumes @@ -132,8 +132,6 @@ func (c *controller) Init(config *cnsconfig.Config, version string) error { multivCenterCSITopologyEnabled = commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.MultiVCenterCSITopology) csiMigrationEnabled = commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.CSIMigration) - filterSuspendedDatastores = commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, - common.CnsMgrSuspendCreateVolume) isTopologyAwareFileVolumeEnabled = commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.TopologyAwareFileVolume) isCSITransactionSupportEnabled = commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.CSITranSactionSupport) @@ -782,9 +780,7 @@ func (c *controller) createBlockVolume(ctx context.Context, req *csi.CreateVolum volumeInfo, faultType, err = common.CreateBlockVolumeUtil(ctx, cnstypes.CnsClusterFlavorVanilla, c.manager, &createVolumeSpec, sharedDatastores, []string{}, - common.CreateBlockVolumeOptions{ - FilterSuspendedDatastores: filterSuspendedDatastores, - }, + common.CreateBlockVolumeOptions{}, nil) if err != nil { return nil, faultType, logger.LogNewErrorCodef(log, codes.Internal, @@ -1909,7 +1905,7 @@ func (c *controller) createFileVolume(ctx context.Context, req *csi.CreateVolume // moving unto next VC. Need to throw a custom error for such scenarios. volumeInfo, faultType, err = common.CreateFileVolumeUtil(ctx, cnstypes.CnsClusterFlavorVanilla, vcenter, c.managers.VolumeManagers[vcHost], c.managers.CnsConfig, &createVolumeSpec, - fsEnabledCandidateDatastores, []string{}, filterSuspendedDatastores, false, nil) + fsEnabledCandidateDatastores, []string{}, false, nil) if err != nil { log.Error(err) combinedErrMssgs = append(combinedErrMssgs, err.Error()) @@ -1967,7 +1963,7 @@ func (c *controller) createFileVolume(ctx context.Context, req *csi.CreateVolume } volumeInfo, faultType, err = common.CreateFileVolumeUtil(ctx, cnstypes.CnsClusterFlavorVanilla, vcenter, c.managers.VolumeManagers[vcHost], c.managers.CnsConfig, &createVolumeSpec, - filteredDatastores, []string{}, filterSuspendedDatastores, false, nil) + filteredDatastores, []string{}, false, nil) if err != nil { return nil, faultType, logger.LogNewErrorCodef(log, codes.Internal, "failed to create volume. Error: %+v", err) @@ -1981,7 +1977,7 @@ func (c *controller) createFileVolume(ctx context.Context, req *csi.CreateVolume } volumeInfo, faultType, err = common.CreateFileVolumeUtil(ctx, cnstypes.CnsClusterFlavorVanilla, vcenter, c.manager.VolumeManager, c.manager.CnsConfig, &createVolumeSpec, - filteredDatastores, []string{}, filterSuspendedDatastores, false, nil) + filteredDatastores, []string{}, false, nil) if err != nil { return nil, faultType, logger.LogNewErrorCodef(log, codes.Internal, "failed to create volume. Error: %+v", err) diff --git a/pkg/csi/service/wcp/controller.go b/pkg/csi/service/wcp/controller.go index 9a81194981..92b7d558ba 100644 --- a/pkg/csi/service/wcp/controller.go +++ b/pkg/csi/service/wcp/controller.go @@ -507,7 +507,6 @@ func (c *controller) createBlockVolume(ctx context.Context, req *csi.CreateVolum } // Fetch the accessibility requirements from the request. topologyRequirement = req.GetAccessibilityRequirements() - filterSuspendedDatastores := commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.CnsMgrSuspendCreateVolume) isTKGSHAEnabled := commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.TKGsHA) isCSITransactionSupportEnabled := commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.CSITranSactionSupport) isMultipleClustersPerVsphereZoneEnabled := commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, @@ -804,7 +803,6 @@ func (c *controller) createBlockVolume(ctx context.Context, req *csi.CreateVolum volFromSnapshotOnTargetDs := commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.VolFromSnapshotOnTargetDs) createVolumeOpts := common.CreateBlockVolumeOptions{ - FilterSuspendedDatastores: filterSuspendedDatastores, UseSupervisorId: isTKGSHAEnabled, IsVdppOnStretchedSvFssEnabled: isVdppOnStretchedSVEnabled, IsByokEnabled: isByokEnabled, @@ -1328,7 +1326,6 @@ func (c *controller) createFileVolume(ctx context.Context, req *csi.CreateVolume VolumeType: common.FileVolumeType, } - filterSuspendedDatastores := commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.CnsMgrSuspendCreateVolume) isTKGSHAEnabled := commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.TKGsHA) topoSegToDatastoresMap := make(map[string][]*cnsvsphere.DatastoreInfo) @@ -1469,7 +1466,7 @@ func (c *controller) createFileVolume(ctx context.Context, req *csi.CreateVolume if isPodVMOnStretchSupervisorFSSEnabled { volumeInfo, faultType, err = common.CreateFileVolumeUtil(ctx, cnstypes.CnsClusterFlavorWorkload, vc, c.manager.VolumeManager, c.manager.CnsConfig, &createVolumeSpec, candidateDatastores, vSphereClusterMorefs, - filterSuspendedDatastores, isTKGSHAEnabled, &cnsvolume.CreateVolumeExtraParams{ + isTKGSHAEnabled, &cnsvolume.CreateVolumeExtraParams{ VolSizeBytes: volSizeBytes, StorageClassName: req.Parameters[common.AttributeStorageClassName], Namespace: req.Parameters[common.AttributePvcNamespace], @@ -1479,7 +1476,7 @@ func (c *controller) createFileVolume(ctx context.Context, req *csi.CreateVolume } else { volumeInfo, faultType, err = common.CreateFileVolumeUtil(ctx, cnstypes.CnsClusterFlavorWorkload, vc, c.manager.VolumeManager, c.manager.CnsConfig, &createVolumeSpec, candidateDatastores, []string{}, - filterSuspendedDatastores, isTKGSHAEnabled, nil) + isTKGSHAEnabled, nil) } if err != nil { return nil, faultType, logger.LogNewErrorCodef(log, codes.Internal, diff --git a/pkg/syncer/storagepool/migrationController.go b/pkg/syncer/storagepool/migrationController.go index bc15f408c8..0e3e9f1b2b 100644 --- a/pkg/syncer/storagepool/migrationController.go +++ b/pkg/syncer/storagepool/migrationController.go @@ -36,8 +36,6 @@ import ( "sigs.k8s.io/vsphere-csi-driver/v3/pkg/common/cns-lib/volume" cnsvsphere "sigs.k8s.io/vsphere-csi-driver/v3/pkg/common/cns-lib/vsphere" "sigs.k8s.io/vsphere-csi-driver/v3/pkg/common/config" - "sigs.k8s.io/vsphere-csi-driver/v3/pkg/csi/service/common" - "sigs.k8s.io/vsphere-csi-driver/v3/pkg/csi/service/common/commonco" "sigs.k8s.io/vsphere-csi-driver/v3/pkg/csi/service/logger" "sigs.k8s.io/vsphere-csi-driver/v3/pkg/syncer/k8scloudoperator" ) @@ -79,8 +77,7 @@ func (m *migrationController) relocateCNSVolume(ctx context.Context, volumeID st return fmt.Errorf("failed to get datastore corresponding to URL %v", datastoreURL) } - filterSuspendedDatastores := commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.CnsMgrSuspendCreateVolume) - if filterSuspendedDatastores && cnsvsphere.IsVolumeCreationSuspended(ctx, dsInfo) { + if cnsvsphere.IsVolumeCreationSuspended(ctx, dsInfo) { return fmt.Errorf("datastore corresponding to URL %v is suspended and not available for relocating volumes", datastoreURL) } From 6256e50a3e301bc0a1705ecf489e1b98bafc555f Mon Sep 17 00:00:00 2001 From: John Cho Date: Thu, 31 Jul 2025 01:41:17 -0700 Subject: [PATCH 2/2] Remove fss from 3 most recent manifests --- manifests/guestcluster/1.32/pvcsi.yaml | 1 - manifests/guestcluster/1.34/pvcsi.yaml | 1 - manifests/supervisorcluster/1.30/cns-csi.yaml | 1 - manifests/supervisorcluster/1.31/cns-csi.yaml | 1 - 4 files changed, 4 deletions(-) diff --git a/manifests/guestcluster/1.32/pvcsi.yaml b/manifests/guestcluster/1.32/pvcsi.yaml index 3dd00ec3c8..95f17b1efd 100644 --- a/manifests/guestcluster/1.32/pvcsi.yaml +++ b/manifests/guestcluster/1.32/pvcsi.yaml @@ -685,7 +685,6 @@ data: "csi-sv-feature-states-replication": "false" # Do not enable for guest cluster, Refer PR#2386 for details "block-volume-snapshot": "true" "tkgs-ha": "true" - "cnsmgr-suspend-create-volume": "true" "csi-windows-support": "true" "workload-domain-isolation": "true" "sv-pvc-snapshot-protection-finalizer": "false" diff --git a/manifests/guestcluster/1.34/pvcsi.yaml b/manifests/guestcluster/1.34/pvcsi.yaml index 644d1b6d92..cfb21cd110 100644 --- a/manifests/guestcluster/1.34/pvcsi.yaml +++ b/manifests/guestcluster/1.34/pvcsi.yaml @@ -730,7 +730,6 @@ data: "csi-sv-feature-states-replication": "false" # Do not enable for guest cluster, Refer PR#2386 for details "block-volume-snapshot": "true" "tkgs-ha": "true" - "cnsmgr-suspend-create-volume": "true" "csi-windows-support": "true" "workload-domain-isolation": "true" "sv-pvc-snapshot-protection-finalizer": "false" diff --git a/manifests/supervisorcluster/1.30/cns-csi.yaml b/manifests/supervisorcluster/1.30/cns-csi.yaml index 262ed6d41b..3722ef47b6 100644 --- a/manifests/supervisorcluster/1.30/cns-csi.yaml +++ b/manifests/supervisorcluster/1.30/cns-csi.yaml @@ -559,7 +559,6 @@ data: "block-volume-snapshot": "true" "tkgs-ha": "true" "list-volumes": "true" - "cnsmgr-suspend-create-volume": "true" "storage-quota-m2": "true" "vdpp-on-stretched-supervisor": "true" "cns-unregister-volume": "false" diff --git a/manifests/supervisorcluster/1.31/cns-csi.yaml b/manifests/supervisorcluster/1.31/cns-csi.yaml index 5a0cabcfec..8d7be6dea2 100644 --- a/manifests/supervisorcluster/1.31/cns-csi.yaml +++ b/manifests/supervisorcluster/1.31/cns-csi.yaml @@ -559,7 +559,6 @@ data: "block-volume-snapshot": "true" "tkgs-ha": "true" "list-volumes": "true" - "cnsmgr-suspend-create-volume": "true" "storage-quota-m2": "true" "vdpp-on-stretched-supervisor": "true" "cns-unregister-volume": "false"