Add remount route for mountlike backup storages

This commit is contained in:
Johannes Zellner
2021-10-11 17:45:35 +02:00
parent 9eed3af8b6
commit d1a7172895
10 changed files with 91 additions and 12 deletions
+3 -12
View File
@@ -383,15 +383,6 @@ function mountOptionsChanged(currentConfig, backupConfig) {
|| !_.isEqual(currentConfig.mountOptions, backupConfig.mountOptions);
}
function mountObject(backupConfig) {
return {
name: 'backup',
hostPath: backupConfig.mountPoint,
mountType: backupConfig.provider,
mountOptions: backupConfig.mountOptions
};
}
async function setBackupConfig(backupConfig) {
assert.strictEqual(typeof backupConfig, 'object');
@@ -404,13 +395,13 @@ async function setBackupConfig(backupConfig) {
let error = mounts.validateMountOptions(backupConfig.provider, backupConfig.mountOptions);
if (error) throw error;
[error] = await safe(mounts.tryAddMount(mountObject(backupConfig), { timeout: 10 })); // 10 seconds
[error] = await safe(mounts.tryAddMount(mounts.mountObjectFromBackupConfig(backupConfig), { timeout: 10 })); // 10 seconds
if (error) {
if (mounts.isMountProvider(oldConfig.provider)) { // put back the old mount configuration
debug('setBackupConfig: rolling back to previous mount configuration');
await safe(mounts.tryAddMount(mountObject(oldConfig), { timeout: 10 }));
await safe(mounts.tryAddMount(mounts.mountObjectFromBackupConfig(oldConfig), { timeout: 10 }));
}
throw error;
@@ -435,7 +426,7 @@ async function setBackupConfig(backupConfig) {
if (mounts.isMountProvider(oldConfig.provider) && !mounts.isMountProvider(backupConfig.provider)) {
debug('setBackupConfig: removing old backup mount point');
await safe(mounts.removeMount(mountObject(oldConfig)));
await safe(mounts.removeMount(mounts.mountObjectFromBackupConfig(oldConfig)));
}
notifyChange(exports.BACKUP_CONFIG_KEY, backupConfig);