Latest changes from Harvester master - e6796a6fc0cffe03f47f6081c09469d59b97faf9

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia committed 2024-11-12 11:50:33 +01:00
1 parent 78ca1e2f49
commit 9a7ca75b74
10 files changed
+93 -63

No files matched your search

@@ -9,11 +9,13 @@ import { colorForState } from '@shell/plugins/dashboard-store/resource-class';
import { HCI, VOLUME_SNAPSHOT } from '../../types';
import HarvesterResource from '../harvester';
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../../config/harvester';
import { DATA_ENGINE_V2 } from '../../edit/harvesterhci.io.storage/index.vue';
import { LVM_DRIVER } from './storage.k8s.io.storageclass';
const DEGRADED_ERRORS = ['replica scheduling failed', 'precheck new replica failed'];
export const DATA_ENGINE_V1 = 'v1';
export const DATA_ENGINE_V2 = 'v2';
export default class HciPv extends HarvesterResource {
applyDefaults(_, realMode) {
const accessModes = realMode === _CLONE ? this.spec.accessModes : [];
@@ -34,7 +36,7 @@ export default class HciPv extends HarvesterResource {
let out = super._availableActions;
// Longhorn V2 provisioner do not support volume clone feature yet
if (this.storageClass.longhornVersion === DATA_ENGINE_V2) {
if (this.isLonghornV2) {
out = out.filter((action) => action.action !== 'goToClone');
} else {
const clone = out.find((action) => action.action === 'goToClone');
@@ -44,7 +46,7 @@ export default class HciPv extends HarvesterResource {
}
}
if (this.storageClass.provisioner !== LONGHORN_DRIVER || this.storageClass.longhornVersion !== DATA_ENGINE_V2) {
if (!this.isLonghorn || !this.isLonghornV2) {
out = [
{
action: 'exportImage',
@@ -303,6 +305,26 @@ export default class HciPv extends HarvesterResource {
return this.$rootGetters['harvester/all'](PV).find((pv) => pv.metadata?.name === this.spec?.volumeName);
}
get volumeProvider() {
return this.relatedPV?.spec.csi?.driver;
}
get dataEngine() {
return this.relatedPV?.spec.csi?.volumeAttributes?.dataEngine;
}
get isLvm() {
return this.volumeProvider === LVM_DRIVER;
}
get isLonghorn() {
return this.volumeProvider === LONGHORN_DRIVER;
}
get isLonghornV2() {
return this.dataEngine === DATA_ENGINE_V2;
}
get resourceExternalLink() {
const host = window.location.host;
const { params } = this.currentRoute();