Latest changes from Harvester master - e6796a6fc0cffe03f47f6081c09469d59b97faf9

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia
2024-11-12 11:50:33 +01:00
parent 78ca1e2f49
commit 9a7ca75b74
10 changed files with 93 additions and 63 deletions
+16 -12
View File
@@ -20,7 +20,7 @@ import { STATE, NAME, AGE, NAMESPACE } from '@shell/config/table-headers';
import { InterfaceOption, VOLUME_DATA_SOURCE_KIND } from '../config/harvester-map';
import { HCI, VOLUME_SNAPSHOT } from '../types';
import { LVM_DRIVER } from '../models/harvester/storage.k8s.io.storageclass';
import { DATA_ENGINE_V2 } from './harvesterhci.io.storage/index.vue';
import { DATA_ENGINE_V2 } from '../models/harvester/persistentvolumeclaim';
export default {
name: 'HarvesterVolume',
@@ -228,14 +228,22 @@ export default {
rebuildStatus() {
return this.value.longhornEngine?.status?.rebuildStatus;
},
isLonghornV2() {
return this.value.storageClass?.isLonghornV2;
}
},
methods: {
getAccessMode() {
const storageClassName = this.value.spec.storageClassName;
const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName);
let readWriteOnce = this.value.isLvm || this.value.isLonghornV2;
if (storageClass) {
readWriteOnce = storageClass.provisioner === LVM_DRIVER || storageClass.parameters?.dataEngine === DATA_ENGINE_V2;
}
return readWriteOnce ? ['ReadWriteOnce'] : ['ReadWriteMany'];
},
willSave() {
this.update();
},
@@ -243,10 +251,6 @@ export default {
let imageAnnotations = '';
let storageClassName = this.value.spec.storageClassName;
const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName);
const storageClassProvisioner = storageClass?.provisioner;
const storageClassDataEngine = storageClass?.parameters?.dataEngine;
if (this.isVMImage && this.imageId) {
const images = this.$store.getters['harvester/all'](HCI.IMAGE);
@@ -263,7 +267,7 @@ export default {
...this.value.spec,
resources: { requests: { storage: this.storage } },
storageClassName,
accessModes: storageClassProvisioner === LVM_DRIVER || storageClassDataEngine === DATA_ENGINE_V2 ? ['ReadWriteOnce'] : ['ReadWriteMany'],
accessModes: this.getAccessMode(),
};
this.value.setAnnotations(imageAnnotations);
@@ -362,14 +366,14 @@ export default {
:output-modifier="true"
:increment="1024"
:mode="mode"
:disabled="isLonghornV2 && isEdit"
:disabled="value?.isLonghornV2 && isEdit"
required
class="mb-20"
@update:value="update"
/>
<Banner
v-if="isLonghornV2 && isEdit"
v-if="value?.isLonghornV2 && isEdit"
color="warning"
>
<span>{{ t('harvester.volume.longhorn.disableResize') }}</span>