feat: support for HotPlugNICs from Kubevirt (#582)

* refactor: rename hotplug volume
* feat: add hotplug NIC
* feat: add hot unplug
* refactor: rename NIC
* feat: get latest status
* feat: disable not ready options
* feat: filter out system networks
* refactor: update wordings

---------

Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
This commit is contained in:
Yiya Chen
2025-11-11 11:43:46 +08:00
committed by GitHub
parent 6735826e15
commit f9bff21e84
10 changed files with 471 additions and 115 deletions
@@ -29,6 +29,16 @@ export default class NetworkAttachmentDef extends SteveModel {
}
}
get isSystem() {
const systemNamespaces = this.$rootGetters['systemNamespaces'];
if (systemNamespaces.includes(this.metadata?.namespace)) {
return true;
}
return false;
}
get isIpamStatic() {
return this.parseConfig.ipam?.type === 'static';
}
@@ -200,10 +200,16 @@ export default class VirtVm extends HarvesterResource {
label: this.t('harvester.action.abortMigration')
},
{
action: 'addHotplug',
action: 'addHotplugVolume',
enabled: !!this.actions?.addVolume,
icon: 'icon icon-plus',
label: this.t('harvester.action.addHotplug')
label: this.t('harvester.action.addHotplugVolume')
},
{
action: 'addHotplugNic',
enabled: this.hotplugNicFeatureEnabled && !!this.actions?.addNic,
icon: 'icon icon-plus',
label: this.t('harvester.action.addHotplugNic')
},
{
action: 'createTemplate',
@@ -389,8 +395,20 @@ export default class VirtVm extends HarvesterResource {
this.$dispatch('promptModal', {
resources,
diskName,
component: 'HarvesterUnplugVolume'
name: diskName,
type: 'volume',
component: 'HarvesterHotUnplug',
});
}
unplugNIC(networkName) {
const resources = this;
this.$dispatch('promptModal', {
resources,
name: networkName,
type: 'network',
component: 'HarvesterHotUnplug',
});
}
@@ -498,10 +516,17 @@ export default class VirtVm extends HarvesterResource {
});
}
addHotplug(resources = this) {
addHotplugVolume(resources = this) {
this.$dispatch('promptModal', {
resources,
component: 'HarvesterAddHotplugModal'
component: 'HarvesterAddHotplugVolumeModal'
});
}
addHotplugNic(resources = this) {
this.$dispatch('promptModal', {
resources,
component: 'HarvesterAddHotplugNic'
});
}
@@ -1234,6 +1259,10 @@ export default class VirtVm extends HarvesterResource {
return this.$rootGetters['harvester-common/getFeatureEnabled']('vmMachineTypeAuto');
}
get hotplugNicFeatureEnabled() {
return this.$rootGetters['harvester-common/getFeatureEnabled']('hotplugNic');
}
get isBackupTargetUnavailable() {
const allSettings = this.$rootGetters['harvester/all'](HCI.SETTING) || [];
const backupTargetSetting = allSettings.find( (O) => O.id === 'backup-target');