Skip to content

Moving VG creation to Node Stage Volume to fix duplicate bugs during node reboot #2015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions cmd/gce-pd-csi-driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
28 changes: 1 addition & 27 deletions pkg/gce-pd-csi-driver/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()
Expand Down