Add remount route for mountlike backup storages
This commit is contained in:
+3
-12
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user