- {{ t('clusterIndexPage.hardwareResourceGauge.reserved') }}
+ {{ t('clusterIndexPage.hardwareResourceGauge.allocated') }}
- {{ t('node.detail.glance.consumptionGauge.amount', reservedAmountTemplateValues) }}
+ {{ t('node.detail.glance.consumptionGauge.amount', allocatedAmountTemplateValues) }}
/ {{ formattedPercentage }}
@@ -160,13 +159,13 @@ export default {
diff --git a/pkg/harvester/list/harvesterhci.io.dashboard.vue b/pkg/harvester/list/harvesterhci.io.dashboard.vue
index 8cf0219ef8a..9e2f68bec96 100644
--- a/pkg/harvester/list/harvesterhci.io.dashboard.vue
+++ b/pkg/harvester/list/harvesterhci.io.dashboard.vue
@@ -134,15 +134,16 @@ export default {
const inStore = this.$store.getters['currentProduct'].inStore;
const hash = {
- vms: this.fetchClusterResources(HCI.VM),
- nodes: this.fetchClusterResources(NODE),
- events: this.fetchClusterResources(EVENT),
- metricNodes: this.fetchClusterResources(METRIC.NODE),
- settings: this.fetchClusterResources(HCI.SETTING),
- services: this.fetchClusterResources(SERVICE),
- metric: this.fetchClusterResources(METRIC.NODE),
- longhornNode: this.fetchClusterResources(LONGHORN.NODES) || [],
- _pods: this.$store.dispatch('harvester/findAll', { type: POD }),
+ vms: this.fetchClusterResources(HCI.VM),
+ nodes: this.fetchClusterResources(NODE),
+ events: this.fetchClusterResources(EVENT),
+ metricNodes: this.fetchClusterResources(METRIC.NODE),
+ settings: this.fetchClusterResources(HCI.SETTING),
+ services: this.fetchClusterResources(SERVICE),
+ metric: this.fetchClusterResources(METRIC.NODE),
+ longhornNodes: this.fetchClusterResources(LONGHORN.NODES),
+ longhornSettings: this.fetchClusterResources(LONGHORN.SETTINGS),
+ _pods: this.$store.dispatch('harvester/findAll', { type: POD }),
};
(this.accessibleResources || []).map((a) => {
@@ -155,6 +156,10 @@ export default {
hash.addons = this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.ADD_ONS });
}
+ if (this.$store.getters[`${ inStore }/schemaFor`](LONGHORN.NODES)) {
+ this.hasLonghornSchema = true;
+ }
+
const res = await allHash(hash);
for ( const k in res ) {
@@ -226,6 +231,7 @@ export default {
showClusterMetrics: false,
showVmMetrics: false,
enabledMonitoringAddon: false,
+ hasLonghornSchema: false,
};
},
@@ -305,8 +311,7 @@ export default {
currentVersion() {
const inStore = this.$store.getters['currentProduct'].inStore;
- const settings = this.$store.getters[`${ inStore }/all`](HCI.SETTING);
- const setting = settings.find( S => S.id === 'server-version');
+ const setting = this.$store.getters[`${ inStore }/byId`](HCI.SETTING, 'server-version');
return setting?.value || setting?.default;
},
@@ -364,53 +369,46 @@ export default {
return out;
},
- storageUsage() {
- const inStore = this.$store.getters['currentProduct'].inStore;
- const longhornNodes = this.$store.getters[`${ inStore }/all`](LONGHORN.NODES) || [];
-
- return longhornNodes.filter(node => node.spec?.allowScheduling).reduce((total, node) => {
- return total + node.used;
- }, 0);
- },
-
- storageReservedTotal() {
- let out = 0;
-
- (this.longhornNode || []).filter(node => node.spec?.allowScheduling).forEach((node) => {
+ storageStats() {
+ const storageOverProvisioningPercentageSetting = this.longhornSettings.find(s => s.id === 'longhorn-system/storage-over-provisioning-percentage');
+ const stats = this.longhornNodes.reduce((total, node) => {
const disks = node?.spec?.disks || {};
-
- Object.values(disks).map((disk) => {
- if (disk.allowScheduling) {
- out += disk.storageReserved;
- }
- });
- });
-
- return out;
- },
-
- storageTotal() {
- let out = 0;
-
- (this.longhornNode || []).forEach((node) => {
const diskStatus = node?.status?.diskStatus || {};
- Object.values(diskStatus).map((disk) => {
- if (disk?.storageMaximum) {
- out += disk.storageMaximum;
- }
+ total.used += node?.spec?.allowScheduling ? node.used : 0;
+
+ Object.keys(disks).map((key) => {
+ total.scheduled += node?.spec?.allowScheduling ? (diskStatus[key]?.storageScheduled || 0) : 0;
+ total.reserved += disks[key]?.storageReserved || 0;
});
+ Object.values(diskStatus).map((diskStat) => {
+ total.maximum += diskStat?.storageMaximum || 0;
+ });
+
+ return total;
+ }, {
+ used: 0,
+ scheduled: 0,
+ maximum: 0,
+ reserved: 0,
+ total: 0
});
- return out;
+ stats.total = ((stats.maximum - stats.reserved) * Number(storageOverProvisioningPercentageSetting?.value ?? 0)) / 100;
+
+ return stats;
},
storageUsed() {
- return this.createMemoryValues(this.storageTotal, this.storageUsage);
+ const stats = this.storageStats;
+
+ return this.createMemoryValues(stats.maximum, stats.used);
},
- storageReserved() {
- return this.createMemoryValues(this.storageTotal, this.storageReservedTotal);
+ storageAllocated() {
+ const stats = this.storageStats;
+
+ return this.createMemoryValues(stats.total, stats.scheduled);
},
vmEvents() {
@@ -646,7 +644,7 @@ export default {
diff --git a/pkg/harvester/list/harvesterhci.io.host.vue b/pkg/harvester/list/harvesterhci.io.host.vue
index 4705d06a559..2d992703cdc 100644
--- a/pkg/harvester/list/harvesterhci.io.host.vue
+++ b/pkg/harvester/list/harvesterhci.io.host.vue
@@ -120,7 +120,7 @@ export default {
labelKey: 'tableHeaders.storage',
value: 'id',
formatter: 'HarvesterStorageUsed',
- formatterOpts: { showReserved: true },
+ formatterOpts: { showAllocated: true },
};
out.splice(-1, 0, storageHeader);
diff --git a/shell/assets/translations/en-us.yaml b/shell/assets/translations/en-us.yaml
index 0f1b4113086..3badc7a46e3 100644
--- a/shell/assets/translations/en-us.yaml
+++ b/shell/assets/translations/en-us.yaml
@@ -1964,6 +1964,7 @@ clusterIndexPage:
ram: Memory
used: Used
reserved: Reserved
+ allocated: Allocated
units:
cores: |-
{count, plural,
diff --git a/shell/components/HardwareResourceGauge.vue b/shell/components/HardwareResourceGauge.vue
index 8a2ac37791e..176444a5477 100644
--- a/shell/components/HardwareResourceGauge.vue
+++ b/shell/components/HardwareResourceGauge.vue
@@ -20,9 +20,19 @@ export default {
default: null
},
+ usedTitle: {
+ type: String,
+ default: null
+ },
+
reserved: {
type: Object,
default: null
+ },
+
+ reservedTitle: {
+ type: String,
+ default: null
}
},
computed: {
@@ -78,7 +88,7 @@ export default {
>
- {{ t('clusterIndexPage.hardwareResourceGauge.reserved') }}
+ {{ reservedTitle ?? t('clusterIndexPage.hardwareResourceGauge.reserved') }}
{{ reserved.formattedUseful }}
@@ -112,7 +122,7 @@ export default {
>
- {{ t('clusterIndexPage.hardwareResourceGauge.used') }}
+ {{ usedTitle ?? t('clusterIndexPage.hardwareResourceGauge.used') }}
{{ used.formattedUseful }}