Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Node list in VMs Migrate dialog (backport #1168) #1172

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading