implement gate logic to prevent nvmet commands until we are sure the config has been loaded

Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
Travis Glenn Hansen 2023-01-13 11:24:11 -07:00
parent 43284bb5a2
commit 10af6c639b
4 changed files with 32 additions and 8 deletions

View File

@ -56,3 +56,6 @@ which nvmetcli &>/dev/null || {
cd "${SCRIPTDIR}"
nvmetcli restore "${NVMETCONFIG}"
touch /var/run/nvmet-config-loaded
chmod +r /var/run/nvmet-config-loaded

14
package-lock.json generated
View File

@ -9,7 +9,7 @@
"version": "1.8.0",
"license": "MIT",
"dependencies": {
"@grpc/grpc-js": "^1.7.3",
"@grpc/grpc-js": "^1.8.4",
"@grpc/proto-loader": "^0.7.0",
"@kubernetes/client-node": "^0.18.0",
"async-mutex": "^0.4.0",
@ -74,9 +74,9 @@
}
},
"node_modules/@grpc/grpc-js": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.7.3.tgz",
"integrity": "sha512-H9l79u4kJ2PVSxUNA08HMYAnUBLj9v6KjYQ7SQ71hOZcEXhShE/y5iQCesP8+6/Ik/7i2O0a10bPquIcYfufog==",
"version": "1.8.4",
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.8.4.tgz",
"integrity": "sha512-oaETBotls7FTBpySg5dhyUCyXSxSeCMmkBBXHXG1iw57MiNoB6D7VRhkrXYbwyHM3Q3Afjp4KlsBX0Zb+ELZXw==",
"dependencies": {
"@grpc/proto-loader": "^0.7.0",
"@types/node": ">=12.12.47"
@ -2955,9 +2955,9 @@
}
},
"@grpc/grpc-js": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.7.3.tgz",
"integrity": "sha512-H9l79u4kJ2PVSxUNA08HMYAnUBLj9v6KjYQ7SQ71hOZcEXhShE/y5iQCesP8+6/Ik/7i2O0a10bPquIcYfufog==",
"version": "1.8.4",
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.8.4.tgz",
"integrity": "sha512-oaETBotls7FTBpySg5dhyUCyXSxSeCMmkBBXHXG1iw57MiNoB6D7VRhkrXYbwyHM3Q3Afjp4KlsBX0Zb+ELZXw==",
"requires": {
"@grpc/proto-loader": "^0.7.0",
"@types/node": ">=12.12.47"

View File

@ -18,7 +18,7 @@
"url": "https://github.com/democratic-csi/democratic-csi.git"
},
"dependencies": {
"@grpc/grpc-js": "^1.7.3",
"@grpc/grpc-js": "^1.8.4",
"@grpc/proto-loader": "^0.7.0",
"@kubernetes/client-node": "^0.18.0",
"async-mutex": "^0.4.0",

View File

@ -897,6 +897,27 @@ save_config filename=${this.options.nvmeof.shareStrategySpdkCli.configPath}
const execClient = this.getExecClient();
const driver = this;
if (
_.get(
this.options,
"nvmeof.shareStrategyNvmetCli.configIsImportedFilePath"
)
) {
try {
let response = await execClient.exec(
execClient.buildCommand("test", [
"-f",
_.get(
this.options,
"nvmeof.shareStrategyNvmetCli.configIsImportedFilePath"
),
])
);
} catch (err) {
throw new Error("nvmet has not been fully configured");
}
}
data = data.trim();
let command = "sh";