return inode info for volume stats
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
parent
7233bde497
commit
b83361535d
|
|
@ -206,9 +206,6 @@ work as soon as kubernetes support is available.
|
||||||
# enable the container feature
|
# enable the container feature
|
||||||
Enable-WindowsOptionalFeature -Online -FeatureName Containers –All
|
Enable-WindowsOptionalFeature -Online -FeatureName Containers –All
|
||||||
|
|
||||||
# create symbolic link due to current limitations in the driver-registrar container
|
|
||||||
New-Item -ItemType SymbolicLink -Path "C:\registration\" -Target "C:\var\lib\kubelet\plugins_registry\"
|
|
||||||
|
|
||||||
# install a HostProcess compatible kubernetes
|
# install a HostProcess compatible kubernetes
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "democratic-csi",
|
"name": "democratic-csi",
|
||||||
"version": "1.7.1",
|
"version": "1.7.2",
|
||||||
"description": "kubernetes csi driver framework",
|
"description": "kubernetes csi driver framework",
|
||||||
"main": "bin/democratic-csi",
|
"main": "bin/democratic-csi",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@grpc/grpc-js": "^1.5.7",
|
"@grpc/grpc-js": "^1.5.7",
|
||||||
"@grpc/proto-loader": "^0.6.0",
|
"@grpc/proto-loader": "^0.6.0",
|
||||||
"@kubernetes/client-node": "^0.16.3",
|
"@kubernetes/client-node": "^0.17.0",
|
||||||
"async-mutex": "^0.3.1",
|
"async-mutex": "^0.3.1",
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
"bunyan": "^1.8.15",
|
"bunyan": "^1.8.15",
|
||||||
|
|
|
||||||
|
|
@ -3026,6 +3026,19 @@ class CsiBaseDriver {
|
||||||
unit: "BYTES",
|
unit: "BYTES",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
try {
|
||||||
|
result = await filesystem.getInodeInfo(device_path);
|
||||||
|
if (result) {
|
||||||
|
res.usage.push({
|
||||||
|
available: result.inodes_free,
|
||||||
|
total: result.inodes_total,
|
||||||
|
used: result.inodes_used,
|
||||||
|
unit: "INODES",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
driver.ctx.logger.debug("failed to retrieve inode info", err);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "block":
|
case "block":
|
||||||
if (!(await filesystem.pathExists(device_path))) {
|
if (!(await filesystem.pathExists(device_path))) {
|
||||||
|
|
|
||||||
|
|
@ -829,6 +829,32 @@ class Filesystem {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getInodeInfo(path) {
|
||||||
|
const filesystem = this;
|
||||||
|
let args = ["-i"];
|
||||||
|
let result;
|
||||||
|
|
||||||
|
args.push(path);
|
||||||
|
|
||||||
|
try {
|
||||||
|
result = await filesystem.exec("df", args);
|
||||||
|
if (result.code == 0) {
|
||||||
|
result = result.stdout.split("\n")[1].replace(/\s\s+/g, " ");
|
||||||
|
let parts = result.split(" ");
|
||||||
|
return {
|
||||||
|
device: parts[0],
|
||||||
|
mount_path: parts[5],
|
||||||
|
inodes_total: parts[1],
|
||||||
|
inodes_used: parts[2],
|
||||||
|
inodes_used_percentage: parts[4].replace(/[^0-9.]/g, ""),
|
||||||
|
inodes_free: parts[3],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {*} path
|
* @param {*} path
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue