handle file missing for nvme multipath
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
parent
a3df4bcca0
commit
a9e5ff07d6
|
|
@ -29,6 +29,9 @@ class NVMEoF {
|
||||||
nvmeof.logger = nvmeof.options.logger;
|
nvmeof.logger = nvmeof.options.logger;
|
||||||
} else {
|
} else {
|
||||||
nvmeof.logger = console;
|
nvmeof.logger = console;
|
||||||
|
console.verbose = function() {
|
||||||
|
console.log(...arguments);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -273,11 +276,33 @@ class NVMEoF {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async pathExists(path) {
|
||||||
|
const nvmeof = this;
|
||||||
|
try {
|
||||||
|
await nvmeof.exec("stat", [
|
||||||
|
path,
|
||||||
|
]);
|
||||||
|
return true;
|
||||||
|
} catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async nativeMultipathEnabled() {
|
async nativeMultipathEnabled() {
|
||||||
const nvmeof = this;
|
const nvmeof = this;
|
||||||
let result = await nvmeof.exec("cat", [
|
let result;
|
||||||
"/sys/module/nvme_core/parameters/multipath",
|
|
||||||
]);
|
try {
|
||||||
|
result = await nvmeof.exec("cat", [
|
||||||
|
"/sys/module/nvme_core/parameters/multipath",
|
||||||
|
]);
|
||||||
|
} catch (err) {
|
||||||
|
if (err.code == 1 && err.stderr.includes("No such file or directory")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
return result.stdout.trim() == "Y";
|
return result.stdout.trim() == "Y";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue