From b61f1e38033d1c0bb51997e20dd69b6c8292301e Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Sun, 4 Apr 2021 22:41:46 +0200 Subject: [PATCH] fix(xapi/VM_snapshot): VM#refresh_snapshots does not exist Fixes xoa-support#3587 --- @xen-orchestra/xapi/src/vm.js | 7 ++++--- CHANGELOG.unreleased.md | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/@xen-orchestra/xapi/src/vm.js b/@xen-orchestra/xapi/src/vm.js index 8218b9278..a9a29d71e 100644 --- a/@xen-orchestra/xapi/src/vm.js +++ b/@xen-orchestra/xapi/src/vm.js @@ -452,6 +452,7 @@ module.exports = class Vm { do { if (!vm.tags.includes('xo-disable-quiesce')) { try { + let { snapshots } = vm ref = await pRetry( async () => { try { @@ -463,13 +464,13 @@ module.exports = class Vm { // detect and remove new broken snapshots // // see https://github.com/vatesfr/xen-orchestra/issues/3936 - const prevSnapshotRefs = new Set(vm.snapshots) + const prevSnapshotRefs = new Set(snapshots) const snapshotNameLabelPrefix = `Snapshot of ${vm.uuid} [` - await vm.refresh_snapshots() + snapshots = await this.getField('VM', vm.$ref, 'snapshots') const createdSnapshots = ( await this.getRecords( 'VM', - vm.snapshots.filter(_ => !prevSnapshotRefs.has(_)) + snapshots.filter(_ => !prevSnapshotRefs.has(_)) ) ).filter(_ => _.name_label.startsWith(snapshotNameLabelPrefix)) // be safe: only delete if there was a single match diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 124c77e89..0ced6d610 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -14,6 +14,7 @@ > Users must be able to say: “I had this issue, happy to know it's fixed” - [Backup restore] Generate new MAC addresses is disabled by default (PR [#5707](https://github.com/vatesfr/xen-orchestra/pull/5707)) +- [Backup] Fix `vm.refresh_snapshots is not a function` error ### Packages to release @@ -32,5 +33,7 @@ > > In case of conflict, the highest (lowest in previous list) `$version` wins. +- @xen-orchestra/xapi patch - xo-server-load-balancer minor +- xo-server patch - xo-web patch