feat(xo-server/delta NG): mark successfully exported snapshots (#3485)
Allows runs after failure/interruption to be deltas. Also, allows some schedules to only do rolling snapshots without breaking the exports. Thanks a lot to @Samuel-BF for PR #3466.
This commit is contained in:
parent
fa88e1789c
commit
bdefd0bcd8
@ -12,6 +12,7 @@
|
|||||||
### Bug fixes
|
### Bug fixes
|
||||||
|
|
||||||
- [Backup NG] Fix `Cannot read property 'uuid' of undefined` when a disk is removed from a VM to backup (PR [#3479](https://github.com/vatesfr/xen-orchestra/pull/3479))
|
- [Backup NG] Fix `Cannot read property 'uuid' of undefined` when a disk is removed from a VM to backup (PR [#3479](https://github.com/vatesfr/xen-orchestra/pull/3479))
|
||||||
|
- [Backup NG] Fix unexpected full after failure, interruption or basic rolling snapshot (PR [#3485](https://github.com/vatesfr/xen-orchestra/pull/3485))
|
||||||
|
|
||||||
### Released packages
|
### Released packages
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import { basename, dirname } from 'path'
|
|||||||
import { NULL_REF } from 'xen-api'
|
import { NULL_REF } from 'xen-api'
|
||||||
import {
|
import {
|
||||||
countBy,
|
countBy,
|
||||||
|
findLast,
|
||||||
flatMap,
|
flatMap,
|
||||||
forOwn,
|
forOwn,
|
||||||
groupBy,
|
groupBy,
|
||||||
@ -770,6 +771,7 @@ export default class BackupNg {
|
|||||||
},
|
},
|
||||||
xapi._updateObjectMapProperty(vm, 'other_config', {
|
xapi._updateObjectMapProperty(vm, 'other_config', {
|
||||||
'xo:backup:datetime': null,
|
'xo:backup:datetime': null,
|
||||||
|
'xo:backup:exported': null,
|
||||||
'xo:backup:job': null,
|
'xo:backup:job': null,
|
||||||
'xo:backup:schedule': null,
|
'xo:backup:schedule': null,
|
||||||
'xo:backup:vm': null,
|
'xo:backup:vm': null,
|
||||||
@ -890,7 +892,19 @@ export default class BackupNg {
|
|||||||
|
|
||||||
snapshot = await xapi.barrier(snapshot.$ref)
|
snapshot = await xapi.barrier(snapshot.$ref)
|
||||||
|
|
||||||
let baseSnapshot = mode === 'delta' ? last(snapshots) : undefined
|
let baseSnapshot
|
||||||
|
if (mode === 'delta') {
|
||||||
|
baseSnapshot = findLast(
|
||||||
|
snapshots,
|
||||||
|
_ => 'xo:backup:exported' in _.other_config
|
||||||
|
)
|
||||||
|
|
||||||
|
// JFT 2018-10-02: support previous snapshots which did not have this
|
||||||
|
// entry, can be removed after 2018-12.
|
||||||
|
if (baseSnapshot === undefined) {
|
||||||
|
baseSnapshot = last(snapshots)
|
||||||
|
}
|
||||||
|
}
|
||||||
snapshots.push(snapshot)
|
snapshots.push(snapshot)
|
||||||
|
|
||||||
// snapshots to delete due to the snapshot retention settings
|
// snapshots to delete due to the snapshot retention settings
|
||||||
@ -1447,6 +1461,17 @@ export default class BackupNg {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error(`no exporter for backup mode ${mode}`)
|
throw new Error(`no exporter for backup mode ${mode}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await wrapTask(
|
||||||
|
{
|
||||||
|
logger,
|
||||||
|
message: 'set snapshot.other_config[xo:backup:exported]',
|
||||||
|
parentId: taskId,
|
||||||
|
},
|
||||||
|
xapi._updateObjectMapProperty(snapshot, 'other_config', {
|
||||||
|
'xo:backup:exported': 'true',
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async _deleteDeltaVmBackups (
|
async _deleteDeltaVmBackups (
|
||||||
|
Loading…
Reference in New Issue
Block a user