fix(xo-server/delta NG): handle removed disks (#3479)
This commit is contained in:
parent
a10fea2823
commit
eb9655125c
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
### 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))
|
||||||
|
|
||||||
### Released packages
|
### Released packages
|
||||||
|
|
||||||
- xo-server v5.28.0
|
- xo-server v5.28.0
|
||||||
|
@ -9,10 +9,11 @@ import { type Pattern, createPredicate } from 'value-matcher'
|
|||||||
import { type Readable, PassThrough } from 'stream'
|
import { type Readable, PassThrough } from 'stream'
|
||||||
import { AssertionError } from 'assert'
|
import { AssertionError } from 'assert'
|
||||||
import { basename, dirname } from 'path'
|
import { basename, dirname } from 'path'
|
||||||
|
import { NULL_REF } from 'xen-api'
|
||||||
import {
|
import {
|
||||||
countBy,
|
countBy,
|
||||||
flatMap,
|
flatMap,
|
||||||
forEach,
|
forOwn,
|
||||||
groupBy,
|
groupBy,
|
||||||
isEmpty,
|
isEmpty,
|
||||||
last,
|
last,
|
||||||
@ -1135,6 +1136,13 @@ export default class BackupNg {
|
|||||||
const fullRequired = { __proto__: null }
|
const fullRequired = { __proto__: null }
|
||||||
const vdis: $Dict<Vdi> = getVmDisks(baseSnapshot)
|
const vdis: $Dict<Vdi> = getVmDisks(baseSnapshot)
|
||||||
|
|
||||||
|
// ignore VDI snapshots which no longer have a parent
|
||||||
|
forOwn(vdis, (vdi, key, vdis) => {
|
||||||
|
if (vdi.snapshot_of === NULL_REF) {
|
||||||
|
delete vdis[key]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
for (const { $id: srId, xapi } of srs) {
|
for (const { $id: srId, xapi } of srs) {
|
||||||
const replicatedVm = listReplicatedVms(
|
const replicatedVm = listReplicatedVms(
|
||||||
xapi,
|
xapi,
|
||||||
@ -1151,7 +1159,7 @@ export default class BackupNg {
|
|||||||
getVmDisks(replicatedVm),
|
getVmDisks(replicatedVm),
|
||||||
vdi => vdi.other_config[TAG_COPY_SRC]
|
vdi => vdi.other_config[TAG_COPY_SRC]
|
||||||
)
|
)
|
||||||
forEach(vdis, vdi => {
|
forOwn(vdis, vdi => {
|
||||||
if (!(vdi.uuid in replicatedVdis)) {
|
if (!(vdi.uuid in replicatedVdis)) {
|
||||||
fullRequired[vdi.$snapshot_of.$id] = true
|
fullRequired[vdi.$snapshot_of.$id] = true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user