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:
parent
cb4276a2ee
commit
06ad1dcb02
@ -445,7 +445,9 @@ export default class {
|
|||||||
obj.$type === 'vm' &&
|
obj.$type === 'vm' &&
|
||||||
obj.other_config[TAG_SOURCE_VM] === uuid
|
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
|
toRemove = n > 0
|
||||||
? sortBy(toRemove, _ => _.other_config[TAG_EXPORT_TIME]).slice(0, n)
|
? sortBy(toRemove, _ => _.other_config[TAG_EXPORT_TIME]).slice(0, n)
|
||||||
: undefined
|
: undefined
|
||||||
@ -453,7 +455,7 @@ export default class {
|
|||||||
const promise = targetXapi.importDeltaVm(
|
const promise = targetXapi.importDeltaVm(
|
||||||
delta,
|
delta,
|
||||||
{
|
{
|
||||||
deleteBase: toRemove === undefined, // old replications are not captured in toRemove
|
deleteBase,
|
||||||
srId: targetSr.$id
|
srId: targetSr.$id
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user