diff --git a/cmd/gce-pd-csi-driver/main.go b/cmd/gce-pd-csi-driver/main.go index 0cb6baf3e..1bfe843ec 100644 --- a/cmd/gce-pd-csi-driver/main.go +++ b/cmd/gce-pd-csi-driver/main.go @@ -424,11 +424,6 @@ func setupDataCache(ctx context.Context, nodeName string, nodeId string) error { return fmt.Errorf("Failed to Raid local SSDs, unable to setup Data Cache, got error %v", err) } - // Initializing data cache node (VG checks w/ raided lssd) - if err := driver.InitializeDataCacheNode(nodeId); err != nil { - return err - } - klog.V(4).Infof("LSSD caching is setup for the Data Cache enabled node %s", nodeName) return nil } diff --git a/pkg/gce-pd-csi-driver/cache.go b/pkg/gce-pd-csi-driver/cache.go index 32ef0faa0..eaf7692a8 100644 --- a/pkg/gce-pd-csi-driver/cache.go +++ b/pkg/gce-pd-csi-driver/cache.go @@ -71,6 +71,7 @@ func setupCaching(devicePath string, req *csi.NodeStageVolumeRequest, nodeId str if vgExists { // Clean up Volume Group before adding the PD reduceVolumeGroup(volumeGroupName, true) + validateRaidedLSSDinVG(volumeGroupName, raidedLocalSsdPath) } else { err := createVg(volumeGroupName, raidedLocalSsdPath) if err != nil { @@ -581,33 +582,6 @@ func fetchChunkSizeKiB(cacheSize string) (string, error) { return strconv.FormatInt(int64(chunkSize), 10) + "KiB", nil } -func InitializeDataCacheNode(nodeId string) error { - raidedLocalSsdPath, err := fetchRAIDedLocalSsdPath() - if err != nil { - return err - } - volumeGroupName := getVolumeGroupName(nodeId) - - vgExists := checkVgExists(volumeGroupName) - // Check if the required volume group already exists - if vgExists { - // Clean up Volume Group before adding the PD - reduceVolumeGroup(volumeGroupName, true) - - // validate that raidedLSSD is part of VG - err = validateRaidedLSSDinVG(volumeGroupName, raidedLocalSsdPath) - if err != nil { - return fmt.Errorf("failed validate local ssd in vg %v: %v", volumeGroupName, err) - } - } else { - err := createVg(volumeGroupName, raidedLocalSsdPath) - if err != nil { - return err - } - } - return nil -} - func StartWatcher(nodeName string) { dirToWatch := "/dev/" watcher, err := fsnotify.NewWatcher()