diff --git a/pkg/harvester/edit/harvesterhci.io.host/HarvesterDisk.vue b/pkg/harvester/edit/harvesterhci.io.host/HarvesterDisk.vue
index 78b536c1948..084b4dbf96c 100644
--- a/pkg/harvester/edit/harvesterhci.io.host/HarvesterDisk.vue
+++ b/pkg/harvester/edit/harvesterhci.io.host/HarvesterDisk.vue
@@ -56,17 +56,11 @@ export default {
csiDrivers: this.$store.dispatch(`${ inStore }/findAll`, { type: CSI_DRIVER }),
longhornV2DataEngine: this.$store.dispatch(`${ inStore }/find`, { type: LONGHORN.SETTINGS, id: LONGHORN_V2_DATA_ENGINE }),
});
-
- this.longhornVersion = hash.longhornV2DataEngine.value === 'true' ? 'v2' : 'v1';
},
data() {
return {
- longhornVersion: 'v1',
- provisioner: {
- label: this.t(`harvester.storage.storageClass.${ LONGHORN_DRIVER }.label`, { version: 1 }),
- value: LONGHORN_DRIVER,
- }
+ provisioner: this.value.provisioner || LONGHORN_DRIVER, // TODO fix provisioner souce field
};
},
@@ -195,12 +189,43 @@ export default {
return this.blockDevice.isFormatting;
},
+ longhornVersion() {
+ const inStore = this.$store.getters['currentProduct'].inStore;
+ const v2DataEngine = this.$store.getters[`${ inStore }/byId`](LONGHORN.SETTINGS, LONGHORN_V2_DATA_ENGINE) || {};
+
+ return v2DataEngine.value === 'true' ? 'v2' : 'v1';
+ },
+
+ isLvm() {
+ return this.provisioner === LVM_DRIVER;
+ },
+
+ isLonghornV1() {
+ return this.provisioner === LONGHORN_DRIVER && this.longhornVersion === 'v1';
+ },
+
+ isLonghornV2() {
+ return this.provisioner === LONGHORN_DRIVER && this.longhornVersion === 'v2';
+ },
+
provisionersLabelKeys() {
return {
[LONGHORN_DRIVER]: `harvester.storage.storageClass.longhorn.${ this.longhornVersion }.label`,
[LVM_DRIVER]: 'harvester.storage.storageClass.lvm.label'
};
},
+
+ showLonghornOptions() {
+ return this.isCorrupted || (
+ this.value.isNew &&
+ !this.isFormatted &&
+ this.isLonghornV1
+ );
+ },
+
+ showLVMOptions() {
+ return this.isLvm;
+ }
},
methods: {
@@ -316,7 +341,7 @@ export default {
/>
-
diff --git a/pkg/harvester/edit/harvesterhci.io.storage/index.vue b/pkg/harvester/edit/harvesterhci.io.storage/index.vue
index 3479aeab7da..3829b29664a 100644
--- a/pkg/harvester/edit/harvesterhci.io.storage/index.vue
+++ b/pkg/harvester/edit/harvesterhci.io.storage/index.vue
@@ -92,7 +92,6 @@ export default {
key: '',
values: [],
},
- longhornVersion: 'v1'
};
},
@@ -105,8 +104,6 @@ export default {
csiDrivers: this.$store.dispatch(`${ inStore }/findAll`, { type: CSI_DRIVER }),
longhornV2DataEngine: this.$store.dispatch(`${ inStore }/find`, { type: LONGHORN.SETTINGS, id: LONGHORN_V2_DATA_ENGINE }),
});
-
- this.longhornVersion = hash.longhornV2DataEngine.value === 'true' ? 'v2' : 'v1';
},
computed: {
@@ -147,11 +144,24 @@ export default {
[LVM_DRIVER]: 'harvester.storage.storageClass.lvm.label'
};
},
+
+ longhornVersion() {
+ const inStore = this.$store.getters['currentProduct'].inStore;
+ const v2DataEngine = this.$store.getters[`${ inStore }/byId`](LONGHORN.SETTINGS, LONGHORN_V2_DATA_ENGINE) || {};
+
+ return v2DataEngine.value === 'true' ? 'v2' : 'v1';
+ },
},
watch: {
provisionerWatch() {
- this.$set(this.value, 'parameters', {});
+ const parameters = {};
+
+ if (this.isLonghornV2) {
+ parameters.migratable = false;
+ }
+
+ this.$set(this.value, 'parameters', parameters);
}
},
diff --git a/pkg/harvester/edit/harvesterhci.io.storage/provisioners/driver.longhorn.io.vue b/pkg/harvester/edit/harvesterhci.io.storage/provisioners/driver.longhorn.io.vue
index 329f61d2bfc..9df58d0a78d 100644
--- a/pkg/harvester/edit/harvesterhci.io.storage/provisioners/driver.longhorn.io.vue
+++ b/pkg/harvester/edit/harvesterhci.io.storage/provisioners/driver.longhorn.io.vue
@@ -9,6 +9,8 @@ import { LONGHORN } from '@shell/config/types';
import { clone } from '@shell/utils/object';
import { uniq } from '@shell/utils/array';
+const LONGHORN_V2_DATA_ENGINE = 'longhorn-system/v2-data-engine';
+
const DEFAULT_PARAMETERS = [
'numberOfReplicas',
'staleReplicaTimeout',
@@ -41,17 +43,22 @@ export default {
},
data() {
+ const inStore = this.$store.getters['currentProduct'].inStore;
+ const v2DataEngine = this.$store.getters[`${ inStore }/byId`](LONGHORN.SETTINGS, LONGHORN_V2_DATA_ENGINE) || {};
+
+ const longhornVersion = v2DataEngine.value === 'true' ? 'v2' : 'v1';
+
if (this.realMode === _CREATE) {
this.$set(this.value, 'parameters', {
numberOfReplicas: '3',
staleReplicaTimeout: '30',
diskSelector: null,
nodeSelector: null,
- migratable: 'true',
+ migratable: longhornVersion === 'v2' ? 'false' : 'true',
});
}
- return {};
+ return { longhornVersion };
},
computed: {
@@ -229,6 +236,7 @@ export default {
:label="t('harvester.storage.parameters.migratable.label')"
:mode="mode"
:options="migratableOptions"
+ :disabled="longhornVersion === 'v2'"
/>