From 5160cca1aad3cbf50f3e41ab5cbf95d986156ce6 Mon Sep 17 00:00:00 2001 From: Florent BEAUCHAMP Date: Wed, 8 Nov 2023 17:00:25 +0100 Subject: [PATCH] fix(@xen-orchestra/vmware-explorer): better handling of VM import without any storage --- @xen-orchestra/vmware-explorer/esxi.mjs | 3 +++ CHANGELOG.unreleased.md | 2 ++ 2 files changed, 5 insertions(+) diff --git a/@xen-orchestra/vmware-explorer/esxi.mjs b/@xen-orchestra/vmware-explorer/esxi.mjs index 5ce10f28d98..a4e91355b44 100644 --- a/@xen-orchestra/vmware-explorer/esxi.mjs +++ b/@xen-orchestra/vmware-explorer/esxi.mjs @@ -235,6 +235,9 @@ export default class Esxi extends EventEmitter { return Object.keys(datas).map(id => { const { config, storage, runtime } = datas[id] + if (storage === undefined) { + throw new Error(`source VM ${id} don't have any storage`) + } const perDatastoreUsage = Array.isArray(storage.perDatastoreUsage) ? storage.perDatastoreUsage : [storage.perDatastoreUsage] diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 0b4443d9221..90a40b1a16e 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] In case of snapshot with memory, create the suspend VDI on the correct SR instead of the default one +- [Import/Esxi] Handle `Cannot read properties of undefined (reading 'perDatastoreUsage')` error whe importing a VM without any storage (PR [#7168](https://github.com/vatesfr/xen-orchestra/pull/7168)) ### Packages to release @@ -32,6 +33,7 @@ - @xen-orchestra/backups patch +- @xen-orchestra/vmware-explorer patch - xo-server minor