feat(backups/writers#beforeBackup): continue interrupted merges
This commit is contained in:
parent
5517305973
commit
db75568905
@ -55,6 +55,11 @@ exports.DeltaBackupWriter = class DeltaBackupWriter extends MixinBackupWriter(Ab
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async beforeBackup() {
|
||||||
|
await super.beforeBackup()
|
||||||
|
return this._cleanVm({ merge: true })
|
||||||
|
}
|
||||||
|
|
||||||
prepare({ isFull }) {
|
prepare({ isFull }) {
|
||||||
// create the task related to this export and ensure all methods are called in this context
|
// create the task related to this export and ensure all methods are called in this context
|
||||||
const task = new Task({
|
const task = new Task({
|
||||||
|
@ -14,6 +14,12 @@ exports.MixinBackupWriter = (BaseClass = Object) =>
|
|||||||
this._lock = undefined
|
this._lock = undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_cleanVm(options) {
|
||||||
|
return this._adapter
|
||||||
|
.cleanVm(getVmBackupDir(this._backup.vm.uuid), { ...options, onLog: warn, lock: false })
|
||||||
|
.catch(warn)
|
||||||
|
}
|
||||||
|
|
||||||
async beforeBackup() {
|
async beforeBackup() {
|
||||||
const { handler } = this._adapter
|
const { handler } = this._adapter
|
||||||
const vmBackupDir = getVmBackupDir(this._backup.vm.uuid)
|
const vmBackupDir = getVmBackupDir(this._backup.vm.uuid)
|
||||||
@ -22,14 +28,7 @@ exports.MixinBackupWriter = (BaseClass = Object) =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
async afterBackup() {
|
async afterBackup() {
|
||||||
|
await this._cleanVm({ remove: true, merge: true })
|
||||||
await this._lock.dispose()
|
await this._lock.dispose()
|
||||||
|
|
||||||
try {
|
|
||||||
await this._adapter.cleanVm(getVmBackupDir(this._backup.vm.uuid), { remove: true, merge: true, onLog: warn })
|
|
||||||
} catch (error) {
|
|
||||||
if (error?.code !== 'ENOENT') {
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user