From b5670c287d9d5e28a69c58ee8cad0f9df51cfe09 Mon Sep 17 00:00:00 2001 From: "andy.lee" Date: Tue, 30 Jul 2024 16:46:47 +0800 Subject: [PATCH] Add enable/disable node disk scheduling Signed-off-by: andy.lee --- .../HarvesterHostDisk.vue | 32 ++++++++++++++++--- .../harvesterhci.io.host/HarvesterDisk.vue | 28 ++++++++++++++-- .../edit/harvesterhci.io.host/index.vue | 3 +- pkg/harvester/l10n/en-us.yaml | 1 + 4 files changed, 56 insertions(+), 8 deletions(-) diff --git a/pkg/harvester/detail/harvesterhci.io.host/HarvesterHostDisk.vue b/pkg/harvester/detail/harvesterhci.io.host/HarvesterHostDisk.vue index 5692c856bae..93c4821a6b7 100644 --- a/pkg/harvester/detail/harvesterhci.io.host/HarvesterHostDisk.vue +++ b/pkg/harvester/detail/harvesterhci.io.host/HarvesterHostDisk.vue @@ -4,13 +4,15 @@ import LabelValue from '@shell/components/LabelValue'; import { BadgeState } from '@components/BadgeState'; import { Banner } from '@components/Banner'; import HarvesterDisk from '../../mixins/harvester-disk'; +import { RadioGroup } from '@components/Form/Radio'; export default { components: { LabelValue, BadgeState, Banner, - Tag + Tag, + RadioGroup }, mixins: [ @@ -37,6 +39,18 @@ export default { return {}; }, computed: { + targetDisk() { + return this.disks.find(disk => disk.name === this.value.name); + }, + schedulableTooltipMessage() { + const { name, path } = this.value; + + if (this.targetDisk && !this.targetDisk.allowScheduling && name && path) { + return this.t('harvester.host.disk.allowScheduling.tooltip', { name, path }); + } else { + return this.schedulableCondition.message; + } + }, allowSchedulingOptions() { return [{ label: this.t('generic.enabled'), @@ -117,6 +131,16 @@ export default {
+
+ +
{{ t('harvester.host.disk.conditions') }}: diff --git a/pkg/harvester/edit/harvesterhci.io.host/HarvesterDisk.vue b/pkg/harvester/edit/harvesterhci.io.host/HarvesterDisk.vue index bd10b089347..3391ff17c54 100644 --- a/pkg/harvester/edit/harvesterhci.io.host/HarvesterDisk.vue +++ b/pkg/harvester/edit/harvesterhci.io.host/HarvesterDisk.vue @@ -44,6 +44,18 @@ export default { return {}; }, computed: { + targetDisk() { + return this.disks.find(disk => disk.name === this.value.name); + }, + schedulableTooltipMessage() { + const { name, path } = this.value; + + if (this.targetDisk && !this.targetDisk.allowScheduling && name && path) { + return this.t('harvester.host.disk.allowScheduling.tooltip', { name, path }); + } else { + return this.schedulableCondition.message; + } + }, allowSchedulingOptions() { return [{ label: this.t('generic.enabled'), @@ -181,6 +193,16 @@ export default {
+
+ +
{{ t('harvester.host.disk.conditions') }}: diff --git a/pkg/harvester/edit/harvesterhci.io.host/index.vue b/pkg/harvester/edit/harvesterhci.io.host/index.vue index bed326e31c0..0decf075920 100644 --- a/pkg/harvester/edit/harvesterhci.io.host/index.vue +++ b/pkg/harvester/edit/harvesterhci.io.host/index.vue @@ -478,10 +478,11 @@ export default { const disks = this.longhornNode?.spec?.disks || {}; + // update each disk tags and scheduling this.newDisks.map((disk) => { (disks[disk.name] || {}).tags = disk.tags; + (disks[disk.name] || {}).allowScheduling = disk.allowScheduling; }); - let count = 0; const retrySave = async() => { diff --git a/pkg/harvester/l10n/en-us.yaml b/pkg/harvester/l10n/en-us.yaml index 1907d6e0ba9..0cca30624fa 100644 --- a/pkg/harvester/l10n/en-us.yaml +++ b/pkg/harvester/l10n/en-us.yaml @@ -400,6 +400,7 @@ harvester: label: Storage Reserved allowScheduling: label: Scheduling + tooltip: Disk {name} ({path}) scheduling is disabled evictionRequested: label: Eviction Requested forceFormatted: