Repository: kubernetes-sigs/vsphere-csi-driver
Pull request #3210: WCP test fix
Author: login: kavyashree-r
Labels: name: size/L
description: Denotes a PR that changes 100-499 lines, ignoring generated files.
name: approved
description: Indicates a PR has been approved by an approver from all required OWNERS files.
name: lgtm
description: "Looks good to me", indicates that a PR is ready to be merged.
name: cncf-cla: yes
description: Indicates the PR's author has signed the CNCF CLA.
Created: 2025-03-07T07:33:12Z | Merged: 2025-03-11T12:17:46Z

<!-- Thanks for sending a pull request! -->

**What this PR does / why we need it**:

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Testing done**:
Yes

https://gist.github.com/kavyashree-r/494d0253d13a2740301c18e08ab535c9



Diff:
diff --git a/tests/e2e/csi_snapshot_basic.go b/tests/e2e/csi_snapshot_basic.go
index c442480902..4b7035c43f 100644
--- a/tests/e2e/csi_snapshot_basic.go
+++ b/tests/e2e/csi_snapshot_basic.go
@@ -77,7 +77,7 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
 		labelsMap                  map[string]string
 		scName                     string
 		volHandle                  string
-		isStorageQuotaFSSEnabled   bool
+		isQuotaValidationSupported bool
 	)
 
 	ginkgo.BeforeEach(func() {
@@ -205,9 +205,10 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
 			pandoraSyncWaitTime = defaultPandoraSyncWaitTime
 		}
 
-		//Remove this code once the FSS is enabled
 		vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
-		isStorageQuotaFSSEnabled = isFssEnabled(ctx, vcAddress, "STORAGE_QUOTA_M2")
+		//if isQuotaValidationSupported is true then quotaValidation is considered in tests
+		vcVersion = getVCversion(ctx, vcAddress)
+		isQuotaValidationSupported = isVersionGreaterOrEqual(vcVersion, quotaSupportedVCVersion)
 	})
 
 	ginkgo.AfterEach(func() {
@@ -291,7 +292,7 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
 			gomega.Expect(err).NotTo(gomega.HaveOccurred())
 		}()
 
-		if isStorageQuotaFSSEnabled && supervisorCluster {
+		if isQuotaValidationSupported && supervisorCluster {
 			totalQuotaUsedBefore, _, storagePolicyQuotaBefore, _, storagePolicyUsageBefore, _ =
 				getStoragePolicyUsedAndReservedQuotaDetails(ctx, restConfig,
 					storageclass.Name, namespace, snapshotUsage, snapshotExtensionName)
@@ -358,7 +359,7 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
 
 		snapshotSize := getAggregatedSnapshotCapacityInMb(e2eVSphere, volHandle)
 
-		if isStorageQuotaFSSEnabled && supervisorCluster {
+		if isQuotaValidationSupported && supervisorCluster {
 			totalQuotaUsedAfter, storagePolicyQuotaAfter, storagePolicyUsageAfter =
 				validateQuotaUsageAfterResourceCreation(ctx, restConfig,
 					storageclass.Name, namespace, snapshotUsage, snapshotExtensionName,
@@ -372,7 +373,7 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
 			volumeSnapshot, pandoraSyncWaitTime, volHandle, snapshotId, true)
 		gomega.Expect(err).NotTo(gomega.HaveOccurred())
 
-		if isStorageQuotaFSSEnabled && supervisorCluster {
+		if isQuotaValidationSupported && supervisorCluster {
 			validateQuotaUsageAfterCleanUp(ctx, restConfig, storageclass.Name, namespace, snapshotUsage,
 				snapshotExtensionName, snapshotSize, totalQuotaUsedAfter, storagePolicyQuotaAfter,
 				storagePolicyUsageAfter)
@@ -1600,7 +1601,7 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
 			gomega.Expect(err).NotTo(gomega.HaveOccurred())
 		}()
 
-		if isStorageQuotaFSSEnabled && supervisorCluster {
+		if isQuotaValidationSupported && supervisorCluster {
 			totalQuotaUsedBefore, _, storagePolicyQuotaBefore, _, storagePolicyUsageBefore, _ =
 				getStoragePolicyUsedAndReservedQuotaDetails(ctx, restConfig,
 					storageclass.Name, namespace, snapshotUsage, snapshotExtensionName)
@@ -1641,7 +1642,7 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
 
 		snapshotSize := getAggregatedSnapshotCapacityInMb(e2eVSphere, volHandle)
 
-		if isStorageQuotaFSSEnabled && supervisorCluster {
+		if isQuotaValidationSupported && supervisorCluster {
 			validateQuotaUsageAfterResourceCreation(ctx, restConfig,
 				storageclass.Name, namespace, snapshotUsage, snapshotExtensionName,
 				snapshotSize, totalQuotaUsedBefore, storagePolicyQuotaBefore,
@@ -1676,7 +1677,7 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
 			scName = storagePolicyName2
 			storageclass1, err = client.StorageV1().StorageClasses().Get(ctx, scName, metav1.GetOptions{})
 
-			if isStorageQuotaFSSEnabled && supervisorCluster {
+			if isQuotaValidationSupported && supervisorCluster {
 				// setting resource quota for storage policy tagged to supervisor namespace
 				setStoragePolicyQuota(ctx, restConfig, storagePolicyName2, namespace, rqLimit)
 			}
@@ -2438,7 +2439,7 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
 			gomega.Expect(err).NotTo(gomega.HaveOccurred())
 		}
 
-		if isStorageQuotaFSSEnabled && supervisorCluster {
+		if isQuotaValidationSupported && supervisorCluster {
 			totalQuotaUsedBefore, _, storagePolicyQuotaBefore, _, storagePolicyUsageBefore, _ =
 				getStoragePolicyUsedAndReservedQuotaDetails(ctx, restConfig,
 					storageclass.Name, namespace, snapshotUsage, snapshotExtensionName)
@@ -2506,7 +2507,7 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
 		framework.Logf("snapshotSize1  + snapshotSize2 = snapshotSize, %d + %d = %d",
 			snapshotSize1, snapshotSize2, snapshotSize)
 
-		if isStorageQuotaFSSEnabled && supervisorCluster {
+		if isQuotaValidationSupported && supervisorCluster {
 			totalQuotaUsedAfter, storagePolicyQuotaAfter, storagePolicyUsageAfter =
 				validateQuotaUsageAfterResourceCreation(ctx, restConfig,
 					storageclass.Name, namespace, snapshotUsage, snapshotExtensionName,
@@ -2566,7 +2567,7 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
 			volumeSnapshot2, pandoraSyncWaitTime, volHandle2, snapshotId2, true)
 		gomega.Expect(err).NotTo(gomega.HaveOccurred())
 
-		if isStorageQuotaFSSEnabled && supervisorCluster {
+		if isQuotaValidationSupported && supervisorCluster {
 			validateQuotaUsageAfterCleanUp(ctx, restConfig, storageclass.Name, namespace, snapshotUsage,
 				snapshotExtensionName, snapshotSize, totalQuotaUsedAfter, storagePolicyQuotaAfter,
 				storagePolicyUsageAfter)
@@ -3680,7 +3681,7 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
 			gomega.Expect(err).NotTo(gomega.HaveOccurred())
 		}()
 
-		if isStorageQuotaFSSEnabled && supervisorCluster {
+		if isQuotaValidationSupported && supervisorCluster {
 			totalQuotaUsedBefore, _, storagePolicyQuotaBefore, _, storagePolicyUsageBefore, _ =
 				getStoragePolicyUsedAndReservedQuotaDetails(ctx, restConfig,
 					storageclass.Name, namespace, snapshotUsage, snapshotExtensionName)
@@ -3721,7 +3722,7 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
 
 		snapshotSize := getAggregatedSnapshotCapacityInMb(e2eVSphere, volHandle)
 
-		if isStorageQuotaFSSEnabled && supervisorCluster {
+		if isQuotaValidationSupported && supervisorCluster {
 			totalQuotaUsedAfter, storagePolicyQuotaAfter, storagePolicyUsageAfter =
 				validateQuotaUsageAfterResourceCreation(ctx, restConfig,
 					storageclass.Name, namespace, snapshotUsage, snapshotExtensionName,
@@ -3786,7 +3787,7 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
 			volumeSnapshot, pandoraSyncWaitTime, volHandle, snapshotId, false)
 		gomega.Expect(err).NotTo(gomega.HaveOccurred())
 
-		if isStorageQuotaFSSEnabled && supervisorCluster {
+		if isQuotaValidationSupported && supervisorCluster {
 			validateQuotaUsageAfterCleanUp(ctx, restConfig, storageclass.Name, namespace, snapshotUsage,
 				snapshotExtensionName, snapshotSize, totalQuotaUsedAfter, storagePolicyQuotaAfter,
 				storagePolicyUsageAfter)
diff --git a/tests/e2e/csi_static_provisioning_basic.go b/tests/e2e/csi_static_provisioning_basic.go
index b5424a5022..42cd69bbf6 100644
--- a/tests/e2e/csi_static_provisioning_basic.go
+++ b/tests/e2e/csi_static_provisioning_basic.go
@@ -79,7 +79,7 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
 		ctx                        context.Context
 		nonSharedDatastoreURL      string
 		fullSyncWaitTime           int
-		isStorageQuotaFSSEnabled   bool
+		isQuotaValidationSupported bool
 	)
 
 	ginkgo.BeforeEach(func() {
@@ -144,9 +144,11 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
 		} else {
 			fullSyncWaitTime = defaultFullSyncWaitTime
 		}
-		//Remove this code once the FSS is enabled
+
 		vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
-		isStorageQuotaFSSEnabled = isFssEnabled(ctx, vcAddress, "STORAGE_QUOTA_M2")
+		//if isQuotaValidationSupported is true then quotaValidation is considered in tests
+		vcVersion = getVCversion(ctx, vcAddress)
+		isQuotaValidationSupported = isVersionGreaterOrEqual(vcVersion, quotaSupportedVCVersion)
 
 	})
 
@@ -219,7 +221,7 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
 		}
 		framework.Logf("storageclass name :%s", storageclass.GetName())
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			ginkgo.By("create resource quota")
 			setStoragePolicyQuota(ctx, restConfig, storagePolicyName, namespace, rqLimit)
 		}
@@ -892,7 +894,7 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
 
 		restConfig, storageclass, profileID := staticProvisioningPreSetUpUtil(ctx)
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			totalQuotaUsedBefore, _, storagePolicyQuotaBefore, _, storagePolicyUsageBefore, _ =
 				getStoragePolicyUsedAndReservedQuotaDetails(ctx, restConfig,
 					storageclass.Name, namespace, pvcUsage, volExtensionName)
@@ -922,7 +924,7 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
 		pv := getPvFromClaim(client, namespace, pvcName)
 		verifyBidirectionalReferenceOfPVandPVC(ctx, client, pvc, pv, fcdID)
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			totalQuotaUsedAfter, storagePolicyQuotaAfter, storagePolicyUsageAfter =
 				validateQuotaUsageAfterResourceCreation(ctx, restConfig,
 					storageclass.Name, namespace, pvcUsage, volExtensionName,
@@ -960,7 +962,7 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
 		defer func() {
 			testCleanUpUtil(ctx, restConfig, cnsRegisterVolume, namespace, pvc.Name, pv.Name)
 
-			if isStorageQuotaFSSEnabled {
+			if isQuotaValidationSupported {
 				validateQuotaUsageAfterCleanUp(ctx, restConfig, storageclass.Name, namespace, pvcUsage,
 					volExtensionName, diskSizeInMb, totalQuotaUsedAfter, storagePolicyQuotaAfter,
 					storagePolicyUsageAfter)
@@ -1001,7 +1003,7 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
 
 		restConfig, _, profileID := staticProvisioningPreSetUpUtil(ctx)
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			totalQuotaUsedBefore, _, storagePolicyQuotaBefore, _, storagePolicyUsageBefore, _ =
 				getStoragePolicyUsedAndReservedQuotaDetails(ctx, restConfig,
 					storagePolicyName, namespace, pvcUsage, volExtensionName)
@@ -1055,7 +1057,7 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
 		_, err = e2eVSphere.getVMByUUID(ctx, vmUUID)
 		gomega.Expect(err).NotTo(gomega.HaveOccurred())
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			totalQuotaUsedAfter, storagePolicyQuotaAfter, storagePolicyUsageAfter =
 				validateQuotaUsageAfterResourceCreation(ctx, restConfig,
 					storagePolicyName, namespace, pvcUsage, volExtensionName,
@@ -1076,7 +1078,7 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
 				vmUUID, pv.Spec.CSI.VolumeHandle))
 		defer func() {
 			testCleanUpUtil(ctx, restConfig, cnsRegisterVolume, namespace, pvc.Name, pv.Name)
-			if isStorageQuotaFSSEnabled {
+			if isQuotaValidationSupported {
 				validateQuotaUsageAfterCleanUp(ctx, restConfig, storagePolicyName, namespace, pvcUsage,
 					volExtensionName, diskSizeInMb, totalQuotaUsedAfter, storagePolicyQuotaAfter,
 					storagePolicyUsageAfter)
diff --git a/tests/e2e/e2e_common.go b/tests/e2e/e2e_common.go
index 18db4137bb..29572b2a51 100644
--- a/tests/e2e/e2e_common.go
+++ b/tests/e2e/e2e_common.go
@@ -271,6 +271,7 @@ const (
 	storageQuotaWebhookPrefix                = "storage-quota-webhook"
 	envStoragePolicyNameForVsanNfsDatastores = "STORAGE_POLICY_FOR_VSAN_NFS_DATASTORES"
 	devopsKubeConf                           = "DEV_OPS_USER_KUBECONFIG"
+	quotaSupportedVCVersion                  = "9.0.0"
 )
 
 /*
diff --git a/tests/e2e/statefulsets.go b/tests/e2e/statefulsets.go
index f86fa7ab86..aba2b6598b 100644
--- a/tests/e2e/statefulsets.go
+++ b/tests/e2e/statefulsets.go
@@ -68,20 +68,20 @@ var _ = ginkgo.Describe("statefulset", func() {
 	f := framework.NewDefaultFramework("e2e-vsphere-statefulset")
 	f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
 	var (
-		namespace                string
-		client                   clientset.Interface
-		storagePolicyName        string
-		scParameters             map[string]string
-		storageClassName         string
-		zonalPolicy              string
-		zonalWffcPolicy          string
-		categories               []string
-		labels_ns                map[string]string
-		allowedTopologyHAMap     map[string][]string
-		nodeList                 *v1.NodeList
-		stsReplicas              int32
-		allowedTopologies        []v1.TopologySelectorLabelRequirement
-		isStorageQuotaFSSEnabled bool
+		namespace                  string
+		client                     clientset.Interface
+		storagePolicyName          string
+		scParameters               map[string]string
+		storageClassName           string
+		zonalPolicy                string
+		zonalWffcPolicy            string
+		categories                 []string
+		labels_ns                  map[string]string
+		allowedTopologyHAMap       map[string][]string
+		nodeList                   *v1.NodeList
+		stsReplicas                int32
+		allowedTopologies          []v1.TopologySelectorLabelRequirement
+		isQuotaValidationSupported bool
 	)
 
 	ginkgo.BeforeEach(func() {
@@ -129,10 +129,10 @@ var _ = ginkgo.Describe("statefulset", func() {
 			nodeList, err = fnodes.GetReadySchedulableNodes(ctx, client)
 			framework.ExpectNoError(err, "Unable to find ready and schedulable Node")
 		}
-		//Remove this code once the FSS is enabled
 		vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
-		isStorageQuotaFSSEnabled = isFssEnabled(ctx, vcAddress, "STORAGE_QUOTA_M2")
-
+		//if isQuotaValidationSupported is true then quotaValidation is considered in tests
+		vcVersion = getVCversion(ctx, vcAddress)
+		isQuotaValidationSupported = isVersionGreaterOrEqual(vcVersion, quotaSupportedVCVersion)
 	})
 
 	ginkgo.AfterEach(func() {
@@ -194,7 +194,7 @@ var _ = ginkgo.Describe("statefulset", func() {
 		}
 
 		restConfig := getRestConfigClient()
-		if supervisorCluster && isStorageQuotaFSSEnabled {
+		if supervisorCluster && isQuotaValidationSupported {
 			totalQuotaUsedBefore, _, storagePolicyQuotaBefore, _, storagePolicyUsageBefore, _ =
 				getStoragePolicyUsedAndReservedQuotaDetails(ctx, restConfig,
 					storagePolicyName, namespace, pvcUsage, volExtensionName)
@@ -250,7 +250,7 @@ var _ = ginkgo.Describe("statefulset", func() {
 			}
 		}
 
-		if supervisorCluster && isStorageQuotaFSSEnabled {
+		if supervisorCluster && isQuotaValidationSupported {
 			validateQuotaUsageAfterResourceCreation(ctx, restConfig,
 				storagePolicyName, namespace, pvcUsage, volExtensionName,
 				diskSize1Gi*3, totalQuotaUsedBefore, storagePolicyQuotaBefore,
diff --git a/tests/e2e/tkgs_ha.go b/tests/e2e/tkgs_ha.go
index 9c801d4fda..999f94bb47 100644
--- a/tests/e2e/tkgs_ha.go
+++ b/tests/e2e/tkgs_ha.go
@@ -71,7 +71,7 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 		labels_ns                  map[string]string
 		isVcRebooted               bool
 		vcAddress                  string
-		isStorageQuotaFSSEnabled   bool
+		isQuotaValidationSupported bool
 	)
 	ginkgo.BeforeEach(func() {
 		client = f.ClientSet
@@ -142,9 +142,10 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 		} else {
 			pandoraSyncWaitTime = defaultPandoraSyncWaitTime
 		}
-		//Remove this code once the FSS is enabled
 		vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
-		isStorageQuotaFSSEnabled = isFssEnabled(ctx, vcAddress, "STORAGE_QUOTA_M2")
+		//if isQuotaValidationSupported is true then quotaValidation is considered in tests
+		vcVersion = getVCversion(ctx, vcAddress)
+		isQuotaValidationSupported = isVersionGreaterOrEqual(vcVersion, quotaSupportedVCVersion)
 
 	})
 
@@ -216,7 +217,7 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 			gomega.Expect(err).NotTo(gomega.HaveOccurred())
 		}
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			totalQuotaUsedBefore, _, storagePolicyQuotaBefore, _, storagePolicyUsageBefore, _ =
 				getStoragePolicyUsedAndReservedQuotaDetails(ctx, restConfig,
 					storageclass.Name, namespace, pvcUsage, volExtensionName)
@@ -237,7 +238,7 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 		svcPVCName := pv.Spec.CSI.VolumeHandle
 		svcPVC := getPVCFromSupervisorCluster(svcPVCName)
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			_, storagePolicyQuotaAfter, storagePolicyUsageAfter =
 				validateQuotaUsageAfterResourceCreation(ctx, restConfig,
 					storageclass.Name, namespace, pvcUsage, volExtensionName,
@@ -298,7 +299,7 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 			pvclaim, volHandle, diskSize, false)
 		gomega.Expect(err).NotTo(gomega.HaveOccurred())
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			tqAfterSanpshot, _, _, _, _, _ =
 				getStoragePolicyUsedAndReservedQuotaDetails(ctx, restConfig,
 					storageclass.Name, namespace, snapshotUsage, snapshotExtensionName)
@@ -356,7 +357,7 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 			volumeSnapshot, pandoraSyncWaitTime, volHandle, dynamicSnapshotId, true)
 		gomega.Expect(err).NotTo(gomega.HaveOccurred())
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			validateQuotaUsageAfterCleanUp(ctx, restConfig, storageclass.Name, namespace, pvcUsage,
 				volExtensionName, diskSizeInMb, tqAfterSanpshot, storagePolicyQuotaAfter,
 				storagePolicyUsageAfter)
@@ -414,7 +415,7 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 			deleteService(namespace, client, service)
 		}()
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			totalQuotaUsedBefore, _, storagePolicyQuotaBefore, _, storagePolicyUsageBefore, _ =
 				getStoragePolicyUsedAndReservedQuotaDetails(ctx, restConfig,
 					zonalPolicy, namespace, pvcUsage, volExtensionName)
@@ -430,7 +431,7 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 		CreateStatefulSet(namespace, statefulset, client)
 		replicas := *(statefulset.Spec.Replicas)
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			totalQuotaUsedAfter, storagePolicyQuotaAfter, storagePolicyUsageAfter =
 				validateQuotaUsageAfterResourceCreation(ctx, restConfig,
 					storageclass.Name, namespace, pvcUsage, volExtensionName,
@@ -457,7 +458,7 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 						"kubernetes", volumeHandle))
 			}
 
-			if isStorageQuotaFSSEnabled {
+			if isQuotaValidationSupported {
 				validateQuotaUsageAfterCleanUp(ctx, restConfig, storageclass.Name, namespace, pvcUsage,
 					volExtensionName, diskSizeInMb*3, totalQuotaUsedAfter, storagePolicyQuotaAfter,
 					storagePolicyUsageAfter)
@@ -660,7 +661,7 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 		svcPVCName := pv.Spec.CSI.VolumeHandle
 		svcPVC := getPVCFromSupervisorCluster(svcPVCName)
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			totalQuotaUsedBefore, _, storagePolicyQuotaBefore, _, storagePolicyUsageBefore, _ =
 				getStoragePolicyUsedAndReservedQuotaDetails(ctx, restConfig,
 					storageclass.Name, namespace, pvcUsage, volExtensionName)
@@ -710,7 +711,7 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 
 		verifyOnlineVolumeExpansionOnGc(client, namespace, svcPVCName, volHandle, pvclaim, pod, f)
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			totalquotaUsedAfterExpansion, _ := getTotalQuotaConsumedByStoragePolicy(ctx, restConfig,
 				storageclass.Name, svNamespace)
 			framework.Logf("totalquotaUsedAfterExpansion :%v", totalquotaUsedAfterExpansion)
@@ -789,7 +790,7 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 		svcPVCName := pv.Spec.CSI.VolumeHandle
 		svcPVC := getPVCFromSupervisorCluster(svcPVCName)
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			totalQuotaUsedBefore, _, storagePolicyQuotaBefore, _, storagePolicyUsageBefore, _ =
 				getStoragePolicyUsedAndReservedQuotaDetails(ctx, restConfig,
 					storageclass.Name, namespace, pvcUsage, volExtensionName)
@@ -839,7 +840,7 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 
 		verifyOfflineVolumeExpansionOnGc(ctx, client, pvclaim, svcPVCName, namespace, volHandle, pod, pv, f)
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			totalquotaUsedAfterExpansion, _ := getTotalQuotaConsumedByStoragePolicy(ctx, restConfig,
 				storageclass.Name, svNamespace)
 			framework.Logf("totalquotaUsedAfterExpansion :%v", totalquotaUsedAfterExpansion)
@@ -919,7 +920,7 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 			gomega.Expect(err).NotTo(gomega.HaveOccurred())
 		}
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			totalQuotaUsedBefore, _, storagePolicyQuotaBefore, _, storagePolicyUsageBefore, _ =
 				getStoragePolicyUsedAndReservedQuotaDetails(ctx, restConfig,
 					storageclass.Name, namespace, pvcUsage, volExtensionName)
@@ -1017,7 +1018,7 @@ var _ = ginkgo.Describe("[csi-tkgs-ha] Tkgs-HA-SanityTests", func() {
 					staticPv.Spec.CSI.VolumeHandle, pod.Spec.NodeName))
 		}()
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			validateQuotaUsageAfterResourceCreation(ctx, restConfig,
 				storageclass.Name, namespace, pvcUsage, volExtensionName,
 				diskSizeInMb, totalQuotaUsedBefore, storagePolicyQuotaBefore,
diff --git a/tests/e2e/util.go b/tests/e2e/util.go
index cd8ea9b185..25c4a42bf5 100644
--- a/tests/e2e/util.go
+++ b/tests/e2e/util.go
@@ -32,6 +32,7 @@ import (
 	"os/exec"
 	"path/filepath"
 	"reflect"
+	"regexp"
 	"sort"
 	"strconv"
 	"strings"
@@ -108,6 +109,7 @@ var (
 	pvZone                 string
 	pvRegion               string
 	vmIp2MoMap             map[string]vim25types.ManagedObjectReference
+	vcVersion              string
 )
 
 type TKGCluster struct {
@@ -1457,23 +1459,6 @@ func invokeVCenterServiceControl(ctx context.Context, command, service, host str
 	return nil
 }
 
-/*
-isFssEnabled invokes the given command to check if vCenter has a particular FSS enabled or not
-*/
-func isFssEnabled(ctx context.Context, host, fss string) bool {
-	sshCmd := fmt.Sprintf("python /usr/sbin/feature-state-wrapper.py %s", fss)
-	framework.Logf("Checking if fss is enabled on vCenter host %v", host)
-	result, err := fssh.SSH(ctx, sshCmd, host, framework.TestContext.Provider)
-	fssh.LogResult(result)
-	if err == nil && result.Code == 0 {
-		return strings.TrimSpace(result.Stdout) == "enabled"
-	} else {
-		ginkgo.By(fmt.Sprintf("couldn't execute command: %s on vCenter host: %v", sshCmd, err))
-		gomega.Expect(err).NotTo(gomega.HaveOccurred())
-	}
-	return false
-}
-
 // waitVCenterServiceToBeInState invokes the status check for the given service and waits
 // via service-control on the given vCenter host over SSH.
 func waitVCenterServiceToBeInState(ctx context.Context, serviceName string, host string, state string) error {
@@ -7441,3 +7426,48 @@ func expandVolumeInParallel(client clientset.Interface, pvclaims []*v1.Persisten
 		}
 	}
 }
+
+/*
+getVCversion returns the VC version
+*/
+func getVCversion(ctx context.Context, vcAddress string) string {
+	if vcVersion == "" {
+		sshCmd := "vpxd -v"
+		framework.Logf("Checking if fss is enabled on vCenter host %v", vcAddress)
+		result, err := fssh.SSH(ctx, sshCmd, vcAddress, framework.TestContext.Provider)
+		fssh.LogResult(result)
+		if err == nil && result.Code == 0 {
+			vcVersion = strings.TrimSpace(result.Stdout)
+		} else {
+			ginkgo.By(fmt.Sprintf("couldn't execute command: %s on vCenter host: %v", sshCmd, err))
+			gomega.Expect(err).NotTo(gomega.HaveOccurred())
+		}
+		// Regex to find version in the format X.Y.Z
+		re := regexp.MustCompile(`\d+\.\d+\.\d+`)
+		vcVersion = re.FindString(vcVersion)
+	}
+	framework.Logf("vcVersion %s", vcVersion)
+	return vcVersion
+}
+
+/*
+isVersionGreaterOrEqual returns true if presentVersion is equal to or greater than expectedVCversion
+*/
+func isVersionGreaterOrEqual(presentVersion, expectedVCversion string) bool {
+	// Split the version strings by dot
+	v1Parts := strings.Split(presentVersion, ".")
+	v2Parts := strings.Split(expectedVCversion, ".")
+
+	// Compare parts
+	for i := 0; i < len(v1Parts); i++ {
+		v1, _ := strconv.Atoi(v1Parts[i]) // Convert each part to integer
+		v2, _ := strconv.Atoi(v2Parts[i])
+
+		if v1 > v2 {
+			return true
+		} else if v1 < v2 {
+			return false
+		}
+	}
+	return true // If all parts are equal, the versions are equal
+}
diff --git a/tests/e2e/vmservice_vm.go b/tests/e2e/vmservice_vm.go
index dae5093a5f..59d269ad71 100644
--- a/tests/e2e/vmservice_vm.go
+++ b/tests/e2e/vmservice_vm.go
@@ -67,7 +67,7 @@ var _ bool = ginkgo.Describe("[vmsvc] vm service with csi vol tests", func() {
 		isVsanHealthServiceStopped bool
 		isSPSserviceStopped        bool
 		vcAddress                  string
-		isStorageQuotaFSSEnabled   bool
+		isQuotaValidationSupported bool
 		defaultDatastore           *object.Datastore
 	)
 
@@ -129,9 +129,10 @@ var _ bool = ginkgo.Describe("[vmsvc] vm service with csi vol tests", func() {
 		vmi = waitNGetVmiForImageName(ctx, vmopC, vmImageName)
 		gomega.Expect(vmi).NotTo(gomega.BeEmpty())
 
-		//Remove this code once the FSS is enabled
 		vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
-		isStorageQuotaFSSEnabled = isFssEnabled(ctx, vcAddress, "STORAGE_QUOTA_M2")
+		//if isQuotaValidationSupported is true then quotaValidation is considered in tests
+		vcVersion = getVCversion(ctx, vcAddress)
+		isQuotaValidationSupported = isVersionGreaterOrEqual(vcVersion, quotaSupportedVCVersion)
 
 		var datacenters []string
 		datastoreURL = GetAndExpectStringEnvVar(envSharedDatastoreURL)
@@ -1428,7 +1429,7 @@ var _ bool = ginkgo.Describe("[vmsvc] vm service with csi vol tests", func() {
 		time.Sleep(1 * time.Minute)
 		setStoragePolicyQuota(ctx, restConfig, storagePolicyName, namespace, rqLimit)
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 			totalQuotaUsedBefore, _, storagePolicyQuotaBefore, _, storagePolicyUsageBefore, _ =
 				getStoragePolicyUsedAndReservedQuotaDetails(ctx, restConfig,
 					storagePolicyName, namespace, pvcUsage, volExtensionName)
@@ -1460,7 +1461,7 @@ var _ bool = ginkgo.Describe("[vmsvc] vm service with csi vol tests", func() {
 		pv := getPvFromClaim(client, namespace, pvcName)
 		verifyBidirectionalReferenceOfPVandPVC(ctx, client, pvc, pv, fcdID)
 
-		if isStorageQuotaFSSEnabled {
+		if isQuotaValidationSupported {
 
 			validateQuotaUsageAfterResourceCreation(ctx, restConfig,
 				storagePolicyName, namespace, pvcUsage, volExtensionName,


Reviews:
user: login: rajguptavm
body: /approve
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-11T06:00:10Z
user: login: kavyashree-r
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-11T06:00:32Z
user: login: ravikumarkp7
body: LGTM
state: APPROVED
author_association: NONE
submitted_at: 2025-03-11T10:56:35Z

Review comments:
diff_hunk: @@ -7441,3 +7426,63 @@ func expandVolumeInParallel(client clientset.Interface, pvclaims []*v1.Persisten
 		}
 	}
 }
+
+/*
+getVCversion returns the VC version
+*/
+func getVCversion(ctx context.Context, vcAddress string) string {
+	if vcVersion == "" {
+		sshCmd := "vpxd -v"
+		framework.Logf("Checking if fss is enabled on vCenter host %v", vcAddress)
+		result, err := fssh.SSH(ctx, sshCmd, vcAddress, framework.TestContext.Provider)
+		fssh.LogResult(result)
+		if err == nil && result.Code == 0 {
+			vcVersion = strings.TrimSpace(result.Stdout)
+		} else {
+			ginkgo.By(fmt.Sprintf("couldn't execute command: %s on vCenter host: %v", sshCmd, err))
+			gomega.Expect(err).NotTo(gomega.HaveOccurred())
+		}
+		// Regex to find version in the format X.X.X
path: tests/e2e/util.go
user: login: rajguptavm
body: remove this additional commented code
created_at: 2025-03-11T05:51:45Z
author_association: CONTRIBUTOR
diff_hunk: @@ -7441,3 +7426,63 @@ func expandVolumeInParallel(client clientset.Interface, pvclaims []*v1.Persisten
 		}
 	}
 }
+
+/*
+getVCversion returns the VC version
+*/
+func getVCversion(ctx context.Context, vcAddress string) string {
+	if vcVersion == "" {
+		sshCmd := "vpxd -v"
+		framework.Logf("Checking if fss is enabled on vCenter host %v", vcAddress)
+		result, err := fssh.SSH(ctx, sshCmd, vcAddress, framework.TestContext.Provider)
+		fssh.LogResult(result)
+		if err == nil && result.Code == 0 {
+			vcVersion = strings.TrimSpace(result.Stdout)
+		} else {
+			ginkgo.By(fmt.Sprintf("couldn't execute command: %s on vCenter host: %v", sshCmd, err))
+			gomega.Expect(err).NotTo(gomega.HaveOccurred())
+		}
+		// Regex to find version in the format X.X.X
path: tests/e2e/util.go
user: login: kavyashree-r
body: done
created_at: 2025-03-11T06:00:32Z
author_association: CONTRIBUTOR

PR comments:
user: login: sipriyaa
created_at: 2025-03-11T12:00:57Z
body: /approve
/lgtm
author_association: CONTRIBUTOR
user: login: k8s-ci-robot
created_at: 2025-03-11T12:01:06Z
body: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/vsphere-csi-driver/pull/3210#" title="Author self-approved">kavyashree-r</a>*, *<a href="https://github.com/kubernetes-sigs/vsphere-csi-driver/pull/3210#pullrequestreview-2672924518" title="Approved">rajguptavm</a>*, *<a href="https://github.com/kubernetes-sigs/vsphere-csi-driver/pull/3210#pullrequestreview-2673926489" title="Approved">ravikumarkp7</a>*, *<a href="https://github.com/kubernetes-sigs/vsphere-csi-driver/pull/3210#issuecomment-2713909435" title="LGTM">sipriyaa</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fvsphere-csi-driver).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[tests/e2e/OWNERS](https://github.com/kubernetes-sigs/vsphere-csi-driver/blob/master/tests/e2e/OWNERS)~~ [kavyashree-r,sipriyaa]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
author_association: CONTRIBUTOR