fix(xapi/VM_snapshot): VM#refresh_snapshots does not exist

Fixes xoa-support#3587
This commit is contained in:
Julien Fontanet
2021-04-04 22:41:46 +02:00
parent db40f80be7
commit b61f1e3803
2 changed files with 7 additions and 3 deletions

View File

@@ -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

View File

@@ -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