logs: use context logger in client-common driver
This commit is contained in:
parent
eb2b357fb7
commit
64b4583eed
|
|
@ -158,7 +158,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
|
|
||||||
assertCapabilities(callContext, capabilities) {
|
assertCapabilities(callContext, capabilities) {
|
||||||
const driver = this;
|
const driver = this;
|
||||||
this.ctx.logger.verbose("validating capabilities: %j", capabilities);
|
callContext.logger.verbose("validating capabilities: %j", capabilities);
|
||||||
|
|
||||||
let message = null;
|
let message = null;
|
||||||
let fs_types = driver.getFsTypes();
|
let fs_types = driver.getFsTypes();
|
||||||
|
|
@ -661,7 +661,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
driver.ctx.logger.debug(
|
callContext.logger.debug(
|
||||||
"controller volume source path: %s",
|
"controller volume source path: %s",
|
||||||
source_path
|
source_path
|
||||||
);
|
);
|
||||||
|
|
@ -740,7 +740,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// must be available when adverstising CLONE_VOLUME
|
// must be available when advertising CLONE_VOLUME
|
||||||
// create snapshot first, then clone
|
// create snapshot first, then clone
|
||||||
case "volume":
|
case "volume":
|
||||||
source_path = driver.getControllerVolumePath(
|
source_path = driver.getControllerVolumePath(
|
||||||
|
|
@ -754,7 +754,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
driver.ctx.logger.debug(
|
callContext.logger.debug(
|
||||||
"controller volume source path: %s",
|
"controller volume source path: %s",
|
||||||
source_path
|
source_path
|
||||||
);
|
);
|
||||||
|
|
@ -770,7 +770,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
|
|
||||||
// set mode
|
// set mode
|
||||||
if (this.options[config_key].dirPermissionsMode) {
|
if (this.options[config_key].dirPermissionsMode) {
|
||||||
driver.ctx.logger.verbose(
|
callContext.logger.verbose(
|
||||||
"setting dir mode to: %s on dir: %s",
|
"setting dir mode to: %s on dir: %s",
|
||||||
this.options[config_key].dirPermissionsMode,
|
this.options[config_key].dirPermissionsMode,
|
||||||
volume_path
|
volume_path
|
||||||
|
|
@ -783,14 +783,14 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
this.options[config_key].dirPermissionsUser ||
|
this.options[config_key].dirPermissionsUser ||
|
||||||
this.options[config_key].dirPermissionsGroup
|
this.options[config_key].dirPermissionsGroup
|
||||||
) {
|
) {
|
||||||
driver.ctx.logger.verbose(
|
callContext.logger.verbose(
|
||||||
"setting ownership to: %s:%s on dir: %s",
|
"setting ownership to: %s:%s on dir: %s",
|
||||||
this.options[config_key].dirPermissionsUser,
|
this.options[config_key].dirPermissionsUser,
|
||||||
this.options[config_key].dirPermissionsGroup,
|
this.options[config_key].dirPermissionsGroup,
|
||||||
volume_path
|
volume_path
|
||||||
);
|
);
|
||||||
if (this.getNodeIsWindows()) {
|
if (this.getNodeIsWindows()) {
|
||||||
driver.ctx.logger.warn("chown not implemented on windows");
|
callContext.logger.warn("chown not implemented on windows");
|
||||||
} else {
|
} else {
|
||||||
await driver.exec("chown", [
|
await driver.exec("chown", [
|
||||||
(this.options[config_key].dirPermissionsUser
|
(this.options[config_key].dirPermissionsUser
|
||||||
|
|
@ -1003,7 +1003,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
driver.ctx.logger.verbose("requested snapshot name: %s", name);
|
callContext.logger.verbose("requested snapshot name: %s", name);
|
||||||
|
|
||||||
let invalid_chars;
|
let invalid_chars;
|
||||||
invalid_chars = name.match(/[^a-z0-9_\-:.+]+/gi);
|
invalid_chars = name.match(/[^a-z0-9_\-:.+]+/gi);
|
||||||
|
|
@ -1020,7 +1020,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
// https://stackoverflow.com/questions/32106243/regex-to-remove-all-non-alpha-numeric-and-replace-spaces-with/32106277
|
// https://stackoverflow.com/questions/32106243/regex-to-remove-all-non-alpha-numeric-and-replace-spaces-with/32106277
|
||||||
name = name.replace(/[^a-z0-9_\-:.+]+/gi, "");
|
name = name.replace(/[^a-z0-9_\-:.+]+/gi, "");
|
||||||
|
|
||||||
driver.ctx.logger.verbose("cleansed snapshot name: %s", name);
|
callContext.logger.verbose("cleansed snapshot name: %s", name);
|
||||||
const volume_path = driver.getControllerVolumePath(source_volume_id);
|
const volume_path = driver.getControllerVolumePath(source_volume_id);
|
||||||
//const volume_path = "/home/thansen/beets/";
|
//const volume_path = "/home/thansen/beets/";
|
||||||
//const volume_path = "/var/lib/docker/";
|
//const volume_path = "/var/lib/docker/";
|
||||||
|
|
@ -1044,11 +1044,11 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
await driver.cloneDir(volume_path, snapshot_path).finally(() => {
|
await driver.cloneDir(volume_path, snapshot_path).finally(() => {
|
||||||
SNAPSHOTS_CUT_IN_FLIGHT.delete(name);
|
SNAPSHOTS_CUT_IN_FLIGHT.delete(name);
|
||||||
});
|
});
|
||||||
driver.ctx.logger.info(
|
callContext.logger.info(
|
||||||
`filecopy backup finished: snapshot_id=${snapshot_id}, path=${volume_path}`
|
`filecopy backup finished: snapshot_id=${snapshot_id}, path=${volume_path}`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
driver.ctx.logger.debug(
|
callContext.logger.debug(
|
||||||
`filecopy backup already cut: ${snapshot_id}`
|
`filecopy backup already cut: ${snapshot_id}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -1099,7 +1099,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
if (response.length > 0) {
|
if (response.length > 0) {
|
||||||
snapshot_exists = true;
|
snapshot_exists = true;
|
||||||
const snapshot = response[response.length - 1];
|
const snapshot = response[response.length - 1];
|
||||||
driver.ctx.logger.debug(
|
callContext.logger.debug(
|
||||||
`restic backup already cut: ${snapshot.id}`
|
`restic backup already cut: ${snapshot.id}`
|
||||||
);
|
);
|
||||||
const stats = await restic.stats([snapshot.id]);
|
const stats = await restic.stats([snapshot.id]);
|
||||||
|
|
@ -1136,7 +1136,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
return message.message_type == "summary";
|
return message.message_type == "summary";
|
||||||
});
|
});
|
||||||
snapshot_id = summary.snapshot_id;
|
snapshot_id = summary.snapshot_id;
|
||||||
driver.ctx.logger.info(
|
callContext.logger.info(
|
||||||
`restic backup finished: snapshot_id=${snapshot_id}, path=${volume_path}, total_duration=${
|
`restic backup finished: snapshot_id=${snapshot_id}, path=${volume_path}, total_duration=${
|
||||||
summary.total_duration | 0
|
summary.total_duration | 0
|
||||||
}s`
|
}s`
|
||||||
|
|
@ -1194,7 +1194,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
snapshot_id = snapshot.id;
|
snapshot_id = snapshot.id;
|
||||||
driver.ctx.logger.info(
|
callContext.logger.info(
|
||||||
`restic backup successfully applied additional tags: new_snapshot_id=${snapshot_id}, original_snapshot_id=${original_snapshot_id} path=${volume_path}`
|
`restic backup successfully applied additional tags: new_snapshot_id=${snapshot_id}, original_snapshot_id=${original_snapshot_id} path=${volume_path}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -1233,7 +1233,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
if (response.length > 0) {
|
if (response.length > 0) {
|
||||||
snapshot_exists = true;
|
snapshot_exists = true;
|
||||||
const snapshot = response[response.length - 1];
|
const snapshot = response[response.length - 1];
|
||||||
driver.ctx.logger.debug(
|
callContext.logger.debug(
|
||||||
`kopia snapshot already cut: ${snapshot.id}`
|
`kopia snapshot already cut: ${snapshot.id}`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1262,7 +1262,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
1000;
|
1000;
|
||||||
size_bytes = response.rootEntry.summ.size;
|
size_bytes = response.rootEntry.summ.size;
|
||||||
|
|
||||||
driver.ctx.logger.info(
|
callContext.logger.info(
|
||||||
`kopia backup finished: snapshot_id=${snapshot_id}, path=${volume_path}, total_duration=${
|
`kopia backup finished: snapshot_id=${snapshot_id}, path=${volume_path}, total_duration=${
|
||||||
total_duration | 0
|
total_duration | 0
|
||||||
}s`
|
}s`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue