fix(backups/MixinBackupWriter): clean VM dir after backup
Otherwise, it might trigger a chain reaction which will force all VDIs to be fully exported: 1. a single VDI chain is corrupted 2. it gets removed 3. the linked backups are removed 4. all other VDIs are now unused and are removed as well 5. all VDIs must now be fully exported
This commit is contained in:
@@ -15,21 +15,18 @@ exports.MixinBackupWriter = (BaseClass = Object) =>
|
||||
}
|
||||
|
||||
async beforeBackup() {
|
||||
const adapter = this._adapter
|
||||
const vmBackupDir = getVmBackupDir(this._backup.vm.uuid)
|
||||
this._lock = await this._adapter.handler.lock(getVmBackupDir(this._backup.vm.uuid))
|
||||
}
|
||||
|
||||
async afterBackup() {
|
||||
await this._lock.dispose()
|
||||
|
||||
try {
|
||||
await adapter.cleanVm(getVmBackupDir(this._backup.vm.uuid), { remove: true, merge: true, onLog: warn })
|
||||
await this._adapter.cleanVm(getVmBackupDir(this._backup.vm.uuid), { remove: true, merge: true, onLog: warn })
|
||||
} catch (error) {
|
||||
if (error?.code !== 'ENOENT') {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
this._lock = await adapter.handler.lock(vmBackupDir)
|
||||
}
|
||||
|
||||
async afterBackup() {
|
||||
await this._lock.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user