add warning banner for cpu pinning VM in migration dialog

Signed-off-by: andy.lee <andy.lee@suse.com>
This commit is contained in:
andy.lee
2024-10-23 17:01:36 +02:00
committed by Francesco Torchia
parent 4e84b1264e
commit 42c431d278
3 changed files with 12 additions and 2 deletions
@@ -70,13 +70,17 @@ export default {
return resource;
},
cpuPinningAlertMessage() {
return this.t('harvester.virtualMachine.cpuPinning.migrationMessage');
},
nodeNameList() {
const nodes = this.$store.getters['harvester/all'](NODE);
return nodes.filter((n) => {
const isNotSelfNode = !!this.availableNodes.includes(n.id);
const isNotWitnessNode = n.isEtcd !== 'true'; // do not allow to migrate to self node and witness node
const isCpuPinning = this.actionResource?.spec?.template?.spec?.domain?.cpu?.dedicatedCpuPlacement;
const isCpuPinning = this.actionResource?.isCpuPinning;
const matchingCpuManagerConfig = !isCpuPinning || n.isCPUManagerEnabled; // If cpu-pinning is enabled, filter-out non-enabled CPU manager nodes.
return isNotSelfNode && isNotWitnessNode && matchingCpuManagerConfig;
@@ -146,6 +150,7 @@ export default {
</template>
<template #body>
<Banner v-if="actionResource?.isCpuPinning" color="warning" :label="cpuPinningAlertMessage" />
<LabeledSelect
v-model:value="nodeName"
:label="t('harvester.modal.migration.fields.nodeName.label')"
@@ -167,7 +172,7 @@ export default {
/>
</div>
<Banner v-for="(err, i) in errors" :key="i"/>
<Banner v-for="(err, i) in errors" :key="i" color="error" :label="err" />
</template>
</Card>
</template>