mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-13 09:36:05 +08:00
feat: expose KubeVirt high-performance storage features in VM and Volume UI (backport #1133) (#1191)
Signed-off-by: Jack Yu <jack.yu@suse.com> Co-authored-by: Alejandro Bonilla <abonilla@suse.com> Co-authored-by: Jack Yu <jack.yu@suse.com>
This commit is contained in:
co-authored by
Alejandro Bonilla
Jack Yu
parent
fb190996b6
commit
db27a174f9
@@ -8,6 +8,7 @@ import LabeledSelect from '@shell/components/form/LabeledSelect';
|
||||
import { LabeledInput } from '@components/Form/LabeledInput';
|
||||
import NameNsDescription from '@shell/components/form/NameNsDescription';
|
||||
import Conditions from '@shell/components/form/Conditions';
|
||||
import DiskPerformanceOptions from './kubevirt.io.virtualmachine/VirtualMachineVolume/DiskPerformanceOptions';
|
||||
import { Banner } from '@components/Banner';
|
||||
import { Checkbox } from '@components/Form/Checkbox';
|
||||
import jsyaml from 'js-yaml';
|
||||
@@ -45,7 +46,8 @@ export default {
|
||||
LabeledSelect,
|
||||
LabeledInput,
|
||||
NameNsDescription,
|
||||
Conditions
|
||||
Conditions,
|
||||
DiskPerformanceOptions
|
||||
},
|
||||
|
||||
mixins: [CreateEditView],
|
||||
@@ -98,7 +100,15 @@ export default {
|
||||
createWithDataVolume: false,
|
||||
snapshots: [],
|
||||
images: [],
|
||||
GIBIBYTE
|
||||
GIBIBYTE,
|
||||
// Default KubeVirt high-performance disk profile, stored as annotations and
|
||||
// applied when this volume is later attached to a VM as a disk.
|
||||
perf: {
|
||||
cache: get(this.value, `metadata.annotations."${ HCI_ANNOTATIONS.DISK_CACHE_MODE }"`) || '',
|
||||
io: get(this.value, `metadata.annotations."${ HCI_ANNOTATIONS.DISK_IO_MODE }"`) || '',
|
||||
dedicatedIOThread: get(this.value, `metadata.annotations."${ HCI_ANNOTATIONS.DISK_DEDICATED_IOTHREAD }"`) === 'true',
|
||||
volumeMode: this.value?.spec?.volumeMode,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -330,6 +340,7 @@ export default {
|
||||
}
|
||||
},
|
||||
'value.spec.volumeMode'(neu) {
|
||||
this.perf.volumeMode = neu;
|
||||
if (neu === VOLUME_MODE.FILE_SYSTEM) {
|
||||
this.setVolumeForVmAnnotation();
|
||||
} else if (neu === VOLUME_MODE.BLOCK ) {
|
||||
@@ -444,6 +455,23 @@ export default {
|
||||
imageAnnotations = { ...this.value.metadata.annotations };
|
||||
}
|
||||
|
||||
// Persist the default high-performance disk profile as annotations.
|
||||
if (this.perf.cache) {
|
||||
imageAnnotations[HCI_ANNOTATIONS.DISK_CACHE_MODE] = this.perf.cache;
|
||||
} else {
|
||||
delete imageAnnotations[HCI_ANNOTATIONS.DISK_CACHE_MODE];
|
||||
}
|
||||
if (this.perf.io) {
|
||||
imageAnnotations[HCI_ANNOTATIONS.DISK_IO_MODE] = this.perf.io;
|
||||
} else {
|
||||
delete imageAnnotations[HCI_ANNOTATIONS.DISK_IO_MODE];
|
||||
}
|
||||
if (this.perf.dedicatedIOThread) {
|
||||
imageAnnotations[HCI_ANNOTATIONS.DISK_DEDICATED_IOTHREAD] = 'true';
|
||||
} else {
|
||||
delete imageAnnotations[HCI_ANNOTATIONS.DISK_DEDICATED_IOTHREAD];
|
||||
}
|
||||
|
||||
const spec = {
|
||||
...this.value.spec,
|
||||
resources: { requests: { storage: this.storage } },
|
||||
@@ -608,6 +636,16 @@ export default {
|
||||
class="mb-20"
|
||||
@update:value="update"
|
||||
/>
|
||||
|
||||
<Banner
|
||||
color="info"
|
||||
:label="t('harvester.volume.performance.pvcTip')"
|
||||
/>
|
||||
<DiskPerformanceOptions
|
||||
:value="perf"
|
||||
:mode="mode"
|
||||
@update="update"
|
||||
/>
|
||||
</Tab>
|
||||
<Tab
|
||||
v-if="!isCreate"
|
||||
|
||||
Reference in New Issue
Block a user