diff --git a/pkg/mgmt/volume/start.go b/pkg/mgmt/volume/start.go index c4fdef72..e57a149f 100644 --- a/pkg/mgmt/volume/start.go +++ b/pkg/mgmt/volume/start.go @@ -74,7 +74,7 @@ func Start(controllerMtx *sync.RWMutex, stopCh <-chan struct{}) error { go VolInformerFactory.Start(stopCh) klog.Info("Starting Lvm volume controller") // Threadiness defines the number of workers to be launched in Run function - return controller.Run(2, stopCh) + return controller.Run(1, stopCh) } // GetClusterConfig return the config for k8s. diff --git a/pkg/mgmt/volume/volume.go b/pkg/mgmt/volume/volume.go index 877b79fd..ed23594f 100644 --- a/pkg/mgmt/volume/volume.go +++ b/pkg/mgmt/volume/volume.go @@ -259,9 +259,9 @@ func (c *VolController) getVgPriorityList(vol *apis.LVMVolume) ([]apis.VolumeGro filteredVgs = append(filteredVgs, vg) } - // prioritize the volume group having less free space available. + // prioritize the volume group having most free space available. sort.SliceStable(filteredVgs, func(i, j int) bool { - return filteredVgs[i].Free.Cmp(filteredVgs[j].Free) < 0 + return filteredVgs[i].Free.Cmp(filteredVgs[j].Free) > 0 }) return filteredVgs, nil }