fix(XoBackups#deltaCopyVm): do not always delete base (#599)

Only when there are no VMs with the TAG_SOURCE_VM for this source VM.
This commit is contained in:
Julien Fontanet 2017-09-04 16:03:15 +02:00 committed by GitHub
parent cb4276a2ee
commit 06ad1dcb02

View File

@ -445,7 +445,9 @@ export default class {
obj.$type === 'vm' &&
obj.other_config[TAG_SOURCE_VM] === uuid
)
const n = toRemove.length - retention + 1 // take into account the future copy
const { length } = toRemove
const deleteBase = length === 0 // old replications are not captured in toRemove
const n = length - retention + 1 // take into account the future copy
toRemove = n > 0
? sortBy(toRemove, _ => _.other_config[TAG_EXPORT_TIME]).slice(0, n)
: undefined
@ -453,7 +455,7 @@ export default class {
const promise = targetXapi.importDeltaVm(
delta,
{
deleteBase: toRemove === undefined, // old replications are not captured in toRemove
deleteBase,
srId: targetSr.$id
}
)