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 <andy.lee@suse.com>

* refactor: remove unneeded code

Signed-off-by: Andy Lee <andy.lee@suse.com>

---------

Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
Andy Lee 2026-05-31 15:51:51 +08:00 committed by GitHub
parent 3e5ee422ce
commit 45872cef3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -907,14 +907,22 @@ export default {
const specInterfaces = this.spec?.template?.spec?.domain?.devices?.interfaces; const specInterfaces = this.spec?.template?.spec?.domain?.devices?.interfaces;
const mergedInterfaces = this.mergeInterfaceList(specInterfaces, 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 = { const spec = {
...this.spec.template.spec, ...this.spec.template.spec,
domain: { domain: {
...this.spec.template.spec.domain, ...this.spec.template.spec.domain,
devices: { devices,
...this.spec.template.spec.domain.devices,
interfaces: mergedInterfaces,
},
}, },
networks networks
}; };