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-09-25 11:19:41 +08:00 committed by Francesco Torchia
parent 4e84b1264e
commit 42c431d278
No known key found for this signature in database
GPG Key ID: E6D011B7415D4393
3 changed files with 12 additions and 2 deletions

View File

@ -70,13 +70,17 @@ export default {
return resource; return resource;
}, },
cpuPinningAlertMessage() {
return this.t('harvester.virtualMachine.cpuPinning.migrationMessage');
},
nodeNameList() { nodeNameList() {
const nodes = this.$store.getters['harvester/all'](NODE); const nodes = this.$store.getters['harvester/all'](NODE);
return nodes.filter((n) => { return nodes.filter((n) => {
const isNotSelfNode = !!this.availableNodes.includes(n.id); const isNotSelfNode = !!this.availableNodes.includes(n.id);
const isNotWitnessNode = n.isEtcd !== 'true'; // do not allow to migrate to self node and witness node 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. const matchingCpuManagerConfig = !isCpuPinning || n.isCPUManagerEnabled; // If cpu-pinning is enabled, filter-out non-enabled CPU manager nodes.
return isNotSelfNode && isNotWitnessNode && matchingCpuManagerConfig; return isNotSelfNode && isNotWitnessNode && matchingCpuManagerConfig;
@ -146,6 +150,7 @@ export default {
</template> </template>
<template #body> <template #body>
<Banner v-if="actionResource?.isCpuPinning" color="warning" :label="cpuPinningAlertMessage" />
<LabeledSelect <LabeledSelect
v-model:value="nodeName" v-model:value="nodeName"
:label="t('harvester.modal.migration.fields.nodeName.label')" :label="t('harvester.modal.migration.fields.nodeName.label')"
@ -167,7 +172,7 @@ export default {
/> />
</div> </div>
<Banner v-for="(err, i) in errors" :key="i"/> <Banner v-for="(err, i) in errors" :key="i" color="error" :label="err" />
</template> </template>
</Card> </Card>
</template> </template>

View File

@ -561,6 +561,7 @@ harvester:
label: Enable CPU Pinning label: Enable CPU Pinning
tooltip: Enable CPU Pinning brings better performance and reduce latency for the virtual machine tooltip: Enable CPU Pinning brings better performance and reduce latency for the virtual machine
restartVMMessage: Changing the CPU Pinning setting requires a virtual machine reboot for the change to take effect restartVMMessage: Changing the CPU Pinning setting requires a virtual machine reboot for the change to take effect
migrationMessage: This virtual machine can only be migrated to a target node that has CPU Manager enabled, as CPU Pinning is configured.
restartNow: |- restartNow: |-
{restart, select, {restart, select,
true {Restart} true {Restart}

View File

@ -459,6 +459,10 @@ export default class VirtVm extends HarvesterResource {
return null; return null;
} }
get isCpuPinning() {
return this.spec?.template?.spec?.domain?.cpu?.dedicatedCpuPlacement === true;
}
get isVMExpectedRunning() { get isVMExpectedRunning() {
if (!this?.spec) { if (!this?.spec) {
return false; return false;