Skip to content

Commit 263167a

Browse files
committed
Moving VG creation to Node Stage Volume to fix duplicate bugs during node reboot.
1 parent 0be5a10 commit 263167a

File tree

2 files changed

+1
-32
lines changed

2 files changed

+1
-32
lines changed

cmd/gce-pd-csi-driver/main.go

-5
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,6 @@ func setupDataCache(ctx context.Context, nodeName string, nodeId string) error {
424424
return fmt.Errorf("Failed to Raid local SSDs, unable to setup Data Cache, got error %v", err)
425425
}
426426

427-
// Initializing data cache node (VG checks w/ raided lssd)
428-
if err := driver.InitializeDataCacheNode(nodeId); err != nil {
429-
return err
430-
}
431-
432427
klog.V(4).Infof("LSSD caching is setup for the Data Cache enabled node %s", nodeName)
433428
return nil
434429
}

pkg/gce-pd-csi-driver/cache.go

+1-27
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ func setupCaching(devicePath string, req *csi.NodeStageVolumeRequest, nodeId str
7171
if vgExists {
7272
// Clean up Volume Group before adding the PD
7373
reduceVolumeGroup(volumeGroupName, true)
74+
validateRaidedLSSDinVG(volumeGroupName, raidedLocalSsdPath)
7475
} else {
7576
err := createVg(volumeGroupName, raidedLocalSsdPath)
7677
if err != nil {
@@ -581,33 +582,6 @@ func fetchChunkSizeKiB(cacheSize string) (string, error) {
581582
return strconv.FormatInt(int64(chunkSize), 10) + "KiB", nil
582583
}
583584

584-
func InitializeDataCacheNode(nodeId string) error {
585-
raidedLocalSsdPath, err := fetchRAIDedLocalSsdPath()
586-
if err != nil {
587-
return err
588-
}
589-
volumeGroupName := getVolumeGroupName(nodeId)
590-
591-
vgExists := checkVgExists(volumeGroupName)
592-
// Check if the required volume group already exists
593-
if vgExists {
594-
// Clean up Volume Group before adding the PD
595-
reduceVolumeGroup(volumeGroupName, true)
596-
597-
// validate that raidedLSSD is part of VG
598-
err = validateRaidedLSSDinVG(volumeGroupName, raidedLocalSsdPath)
599-
if err != nil {
600-
return fmt.Errorf("failed validate local ssd in vg %v: %v", volumeGroupName, err)
601-
}
602-
} else {
603-
err := createVg(volumeGroupName, raidedLocalSsdPath)
604-
if err != nil {
605-
return err
606-
}
607-
}
608-
return nil
609-
}
610-
611585
func StartWatcher(nodeName string) {
612586
dirToWatch := "/dev/"
613587
watcher, err := fsnotify.NewWatcher()

0 commit comments

Comments
 (0)