mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-04 21:37:11 -04:00
added raid 50
This commit is contained in:
parent
603099dc33
commit
8bb3534b31
2 changed files with 57 additions and 19 deletions
|
@ -5,13 +5,24 @@ import { UNIT_BASE, formatBytes } from '@/utils/convert';
|
|||
const diskTotal = ref(2);
|
||||
const diskSize = ref(100);
|
||||
const diskUnit = ref(10 ** 9);
|
||||
const diskPerStripe = ref(3);
|
||||
const raidType = ref('raid_0');
|
||||
const raidInfo = computed(() => raidCalculations[raidType.value].about);
|
||||
const raidRequirements = computed(() => raidCalculations[raidType.value].requirements);
|
||||
const inputsValid = computed(() => validateSetup());
|
||||
|
||||
const totalStripes = computed(() => {
|
||||
if(inputsValid.value){
|
||||
return `${diskTotal.value / diskPerStripe.value} stripes total`;
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
||||
const calculatedCapacity = computed(() => {
|
||||
return formatBytes(raidCalculations[raidType.value].capacity(diskTotal.value, diskSize.value, diskUnit.value), 2, UNIT_BASE.BASE_10);
|
||||
return formatBytes(raidCalculations[raidType.value].capacity(diskTotal.value, diskSize.value, diskPerStripe.value, diskUnit.value), 2, UNIT_BASE.BASE_10);
|
||||
});
|
||||
|
||||
const calculatedFaultTolerance = computed(() => {
|
||||
|
@ -19,12 +30,12 @@ const calculatedFaultTolerance = computed(() => {
|
|||
});
|
||||
|
||||
const calculatedSpaceEfficiency = computed(() => {
|
||||
return raidCalculations[raidType.value].efficiency(diskTotal.value);
|
||||
return raidCalculations[raidType.value].efficiency(diskTotal.value, diskPerStripe.value).toFixed(1);
|
||||
});
|
||||
|
||||
function validateSetup() {
|
||||
// validate the selected RAID type against parameters
|
||||
return raidCalculations[raidType.value].validate(diskTotal.value, diskSize.value);
|
||||
return raidCalculations[raidType.value].validate(diskTotal.value, diskSize.value, diskPerStripe.value);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -51,6 +62,10 @@ function validateSetup() {
|
|||
/>
|
||||
</div>
|
||||
</n-form-item>
|
||||
<n-form-item v-if="raidType == 'raid_50'" label="Disks per stripe" label-placement="left" label-width="150" mb-2>
|
||||
<n-input-number v-model:value="diskPerStripe" max="10000" min="2" placeholder="Number of disks per stripe (ex: 3)" w-full />
|
||||
<n-input v-model:value="totalStripes" placeholder="" ml-1 w-full readonly />
|
||||
</n-form-item>
|
||||
<n-form-item label="RAID Type" label-placement="left" label-width="150" mb-2>
|
||||
<c-select
|
||||
v-model:value="raidType"
|
||||
|
@ -61,6 +76,7 @@ function validateSetup() {
|
|||
{ label: 'RAID 5 (parity)', value: 'raid_5' },
|
||||
{ label: 'RAID 6 (double parity)', value: 'raid_6' },
|
||||
{ label: 'RAID 10 (mirror + stripe)', value: 'raid_10' },
|
||||
{ label: 'RAID 50 (parity + stripe)', value: 'raid_50' },
|
||||
]"
|
||||
/>
|
||||
</n-form-item>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue