only return 1 branch for rand/eprand policies

This commit is contained in:
Antonio SJ Musumeci 2019-09-07 17:23:48 -04:00
parent 6b3f703ba9
commit 0fffabfbe3
4 changed files with 22 additions and 14 deletions

View file

@ -25,17 +25,20 @@ using std::string;
using std::vector;
int
Policy::Func::rand(const Category::Enum::Type type,
Policy::Func::rand(const Category::Enum::Type type_,
const Branches &branches_,
const char *fusepath,
const uint64_t minfreespace,
vector<const string*> &paths)
const char *fusepath_,
const uint64_t minfreespace_,
vector<const string*> &paths_)
{
int rv;
rv = Policy::Func::all(type,branches_,fusepath,minfreespace,paths);
rv = Policy::Func::all(type_,branches_,fusepath_,minfreespace_,paths_);
if(rv == 0)
std::random_shuffle(paths.begin(),paths.end());
{
std::random_shuffle(paths_.begin(),paths_.end());
paths_.resize(1);
}
return rv;
}