update devcontainer image, enhance contributing guide, and implement mutex for PCS commands

This commit is contained in:
Michel Peterson
2026-01-04 08:53:55 +00:00
parent 822889ed1d
commit 00c025df8e
4 changed files with 31 additions and 18 deletions
+3 -1
View File
@@ -3,7 +3,9 @@
{
"name": "democratic-csi",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm",
// regarding versioning the first number is the devcontainer image version,
// the second is the Node.js version, and the third is the OS version.
"image": "mcr.microsoft.com/devcontainers/typescript-node:4-20-bookworm",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
+4
View File
@@ -62,6 +62,10 @@ cd ~/democratic-csi
./hack/run.sh -c ./hack/config.yaml
```
>![Note]
> For running tests with democratic-csi the authentication needs to be disabled, as
> it always initiates connections to the share without authentication.
##### Keeping Files in Sync
Use these methods to keep your local files synchronized with the Vagrant VM:
Vendored
+3
View File
@@ -18,6 +18,9 @@ Vagrant.configure("2") do |config|
end
config.vm.provision "shell", inline: <<-SHELL
# force version 20.x of nodejs
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get update -y
# for building dependecies and executing node
+21 -17
View File
@@ -20,6 +20,7 @@ class ControllerZfsGenericDriver extends ControllerZfsBaseDriver {
this.targetCliMutex = new Mutex();
this.nvmetCliMutex = new Mutex();
this.spdkCliMutex = new Mutex();
this.pcsMutex = new Mutex();
}
getExecClient() {
@@ -1000,24 +1001,27 @@ save_config filename=${this.options.nvmeof.shareStrategySpdkCli.configPath}
let options = {
pty: true,
};
let response = await execClient.exec(
execClient.buildCommand(command, args),
options
);
driver.ctx.logger.verbose(
"pcs response: " + JSON.stringify(response)
);
// Handle idempotence for create commands
if (response.code == 1 && response.stdout.includes("already exists")) {
driver.ctx.logger.verbose("pcs resource already exists, ignoring error (setting response.code=0)");
response.code = 0;
}
if (response.code != 0) {
throw response;
}
return response;
return driver.pcsMutex.runExclusive(async () => {
let response = await execClient.exec(
execClient.buildCommand(command, args),
options
);
driver.ctx.logger.verbose(
"pcs response: " + JSON.stringify(response)
);
// Handle idempotence for create commands
if (response.code == 1 && response.stdout.includes("already exists")) {
driver.ctx.logger.verbose("pcs resource already exists, ignoring error (setting response.code=0)");
response.code = 0;
}
if (response.code != 0) {
throw response;
}
return response;
});
}
async targetCliCommand(data) {