fix(backups): ignore VMs created by current job

See xoa-support#4271
This commit is contained in:
Julien Fontanet 2021-12-13 15:37:12 +01:00
parent 10ac23e265
commit cf9f0da6e5
3 changed files with 18 additions and 0 deletions

View File

@ -36,6 +36,11 @@ const forkDeltaExport = deltaExport =>
exports.VmBackup = class VmBackup {
constructor({ config, getSnapshotNameLabel, job, remoteAdapters, remotes, schedule, settings, srs, vm }) {
if (vm.other_config['xo:backup:job'] === job.id) {
// otherwise replicated VMs would be matched and replicated again and again
throw new Error('cannot backup a VM created by this very job')
}
this.config = config
this.job = job
this.remoteAdapters = remoteAdapters

View File

@ -17,6 +17,7 @@
- [Tables/actions] Fix collapsed actions being clickable despite being disabled (PR [#6023](https://github.com/vatesfr/xen-orchestra/pull/6023))
- [Continuous Replication] Fix `could not find the base VM`
- [Backup/Smart mode] Always ignore replicated VMs created by the current job
### Packages to release
@ -35,4 +36,7 @@
>
> In case of conflict, the highest (lowest in previous list) `$version` wins.
- @xen-orchestra/backups minor
- @xen-orchestra/proxy minor
- xo-server minor
- xo-web minor

View File

@ -187,6 +187,15 @@ export default class BackupNg {
filter: createPredicate({
type: 'VM',
...vmsPattern,
// don't match VMs created by this very job
//
// otherwise replicated VMs would be matched and replicated again and again
other_config: {
__not: {
'xo:backup:job': job.id,
},
},
}),
})
)