Skip to content

Commit

Permalink
Merge pull request #1168 from torchiaf/6591-fix
Browse files Browse the repository at this point in the history
Fix Node list in VMs Migrate dialog
  • Loading branch information
torchiaf committed Sep 25, 2024
2 parents 66068a6 + 1d16e2f commit 3368fc4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/harvester/dialog/HarvesterMigrationDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,18 @@ 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 matchingCpuManagerConfig = n.isCPUManagerEnabled; // If cpu-pinning is enabled, filter-out non-enabled CPU manager nodes.
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;
}).map((n) => {
Expand Down Expand Up @@ -143,6 +148,7 @@ export default {
</template>
<template #body>
<Banner v-if="actionResource?.isCpuPinning" color="warning" :label="cpuPinningAlertMessage" />
<LabeledSelect
v-model="nodeName"
:label="t('harvester.modal.migration.fields.nodeName.label')"
Expand All @@ -163,7 +169,6 @@ export default {
@click="apply"
/>
</div>
<Banner v-for="(err, i) in errors" :key="i" color="error" :label="err" />
</div>
</Card>
Expand Down
1 change: 1 addition & 0 deletions pkg/harvester/l10n/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ harvester:
label: Enable CPU Pinning
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
migrationMessage: This virtual machine can only be migrated to a target node that has CPU Manager enabled, as CPU Pinning is configured.
restartNow: |-
{restart, select,
true {Restart}
Expand Down
4 changes: 4 additions & 0 deletions pkg/harvester/models/kubevirt.io.virtualmachine.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@ export default class VirtVm extends HarvesterResource {
return null;
}

get isCpuPinning() {
return this.spec?.template?.spec?.domain?.cpu?.dedicatedCpuPlacement === true;
}

get isVMExpectedRunning() {
if (!this?.spec) {
return false;
Expand Down

0 comments on commit 3368fc4

Please sign in to comment.