@@ -16,11 +16,10 @@ import (
16
16
)
17
17
18
18
const (
19
- cacheSuffix = "csi-fast"
20
- mainLvSuffix = "csi-main"
21
- raidedLocalSsdName = "csi-driver-data-cache"
22
- raidMode = "0"
23
- initialRaidedLocalSsdPath = "/dev/md0"
19
+ cacheSuffix = "csi-fast"
20
+ mainLvSuffix = "csi-main"
21
+ raidedLocalSsdName = "csi-driver-data-cache"
22
+ raidMode = "0"
24
23
)
25
24
26
25
func fetchRAIDedLocalSsdPath () (string , error ) {
@@ -253,9 +252,13 @@ func GetDataCacheCountFromNodeLabel(ctx context.Context, nodeName string) (int,
253
252
}
254
253
255
254
func FetchRaidedLssdCountForDatacache () (int , error ) {
255
+ raidedPath , err := fetchRAIDedLocalSsdPath ()
256
+ if err != nil {
257
+ return 0 , err
258
+ }
256
259
args := []string {
257
260
"--detail" ,
258
- initialRaidedLocalSsdPath ,
261
+ raidedPath ,
259
262
}
260
263
info , err := common .RunCommand ("grep" , []string {"Raid Devices" }, "mdadm" , args ... )
261
264
if err != nil {
@@ -358,6 +361,7 @@ func cleanupCache(volumeId string, nodeId string) error {
358
361
// If volume group doesn't exist then there's nothing to uncache
359
362
return nil
360
363
}
364
+ reduceVolumeGroup (volumeGroupName , true )
361
365
mainLvName := getLvName (mainLvSuffix , volumeId )
362
366
args := []string {
363
367
"-an" ,
@@ -431,7 +435,7 @@ func reduceVolumeGroup(volumeGroupName string, force bool) {
431
435
func RaidLocalSsds (availableLssds []string ) error {
432
436
args := []string {
433
437
"--create" ,
434
- initialRaidedLocalSsdPath ,
438
+ raidedLocalSsdName ,
435
439
"--name" ,
436
440
raidedLocalSsdName ,
437
441
"-l" + raidMode ,
0 commit comments