From 45872cef3bbbbaf57304d3fa9555a66b7e745053 Mon Sep 17 00:00:00 2001 From: Andy Lee Date: Sun, 31 May 2026 15:51:51 +0800 Subject: [PATCH] feat: add autoattachPodInterface in edit VM mode if no network interface configured (#888) * feat: add autoattachPodInterface in edit VM mode if no network interface configured Signed-off-by: Andy Lee * refactor: remove unneeded code Signed-off-by: Andy Lee --------- Signed-off-by: Andy Lee --- pkg/harvester/mixins/harvester-vm/index.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkg/harvester/mixins/harvester-vm/index.js b/pkg/harvester/mixins/harvester-vm/index.js index 8ba418e7..24ca3964 100644 --- a/pkg/harvester/mixins/harvester-vm/index.js +++ b/pkg/harvester/mixins/harvester-vm/index.js @@ -907,14 +907,22 @@ export default { const specInterfaces = this.spec?.template?.spec?.domain?.devices?.interfaces; const mergedInterfaces = this.mergeInterfaceList(specInterfaces, interfaces); + const devices = { + ...this.spec.template.spec.domain.devices, + interfaces: mergedInterfaces, + }; + + if (this.isEdit && networkRow.length === 0) { + devices.autoattachPodInterface = false; + } else { + delete devices.autoattachPodInterface; + } + const spec = { ...this.spec.template.spec, domain: { ...this.spec.template.spec.domain, - devices: { - ...this.spec.template.spec.domain.devices, - interfaces: mergedInterfaces, - }, + devices, }, networks };