Skip to content

Add utilization info on storage pool list page #2144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

weirdwiz
Copy link
Contributor

@weirdwiz weirdwiz commented Jul 8, 2025

Screenshot 2025-07-22 at 3 41 29 PM Screenshot 2025-07-24 at 6 29 50 PM Screenshot 2025-07-24 at 6 30 04 PM Screenshot 2025-07-24 at 6 30 47 PM

Copy link
Contributor

openshift-ci bot commented Jul 8, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: weirdwiz
Once this PR has been reviewed and has the lgtm label, please assign alfonsomthd for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@SanjalKatiyar
Copy link
Collaborator

@weirdwiz can u plz update this PR... @bipuladh's epic added quite a few refactoring...

@weirdwiz weirdwiz force-pushed the master branch 7 times, most recently from ea22dc6 to 4429cfe Compare July 24, 2025 13:11
Copy link
Contributor

openshift-ci bot commented Jul 24, 2025

@weirdwiz: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/odf-console-e2e-aws a021e9c link true /test odf-console-e2e-aws

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@SanjalKatiyar
Copy link
Collaborator

Comment on lines +3 to +4
import { global_danger_color_100 as dangerColor } from '@patternfly/react-tokens/dist/js/global_danger_color_100';
import { global_warning_color_100 as warningColor } from '@patternfly/react-tokens/dist/js/global_warning_color_100';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { global_danger_color_100 as dangerColor } from '@patternfly/react-tokens/dist/js/global_danger_color_100';
import { global_warning_color_100 as warningColor } from '@patternfly/react-tokens/dist/js/global_warning_color_100';
import { global_danger_color_100 as dangerColor } from '@patternfly/react-tokens';
import { global_warning_color_100 as warningColor } from '@patternfly/react-tokens';

Comment on lines +27 to +58
<div className="odf-pool-utilization-popover">
<div className="odf-pool-utilization-popover__header">
<Icon style={{ color: iconColor }} className="pf-v5-u-mr-sm" />
<span className="odf-pool-utilization-popover__pool-name">
{pool.metadata.name}
</span>
</div>
<div className="odf-pool-utilization-popover__body">
<div className="odf-pool-utilization-popover__item">
<strong>{t('Used:')}</strong> {pool.usedCapacity}
<Label
variant="filled"
color={pool.type === PoolType.BLOCK ? 'blue' : 'green'}
className="pf-v5-u-ml-sm"
>
{volumeMode}
</Label>
</div>
<div className="odf-pool-utilization-popover__item">
<strong>{t('Maximum available:')}</strong> {pool.totalCapacity}
</div>
{pool.critical && (
<div className="odf-pool-utilization-popover__message">
{t(
'Storage pool critically full. Add capacity to avoid disruptions'
)}
</div>
)}
</div>
</div>
);
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +1 to +97
.odf-pool-utilization-card {
&__alert {
display: flex;
align-items: center;
gap: var(--pf-v5-global--spacer--sm);
margin-bottom: var(--pf-v5-global--spacer--sm);

&-icon {
color: var(--pf-v5-global--warning-color--100);
font-size: var(--pf-v5-global--icon--FontSize--lg);
}

&-count {
font-size: var(--pf-v5-global--FontSize--2xl);
font-weight: var(--pf-v5-global--FontWeight--bold);
color: var(--pf-v5-global--warning-color--100);
}
}

&__description {
color: var(--pf-v5-global--Color--200);
margin-bottom: var(--pf-v5-global--spacer--md);
}

&__usage {
display: flex;
align-items: center;
cursor: pointer;
}

&__highlighted-row {
border-left: 3px solid var(--pf-v5-global--primary-color--100);
padding-left: var(--pf-v5-global--spacer--md);
}

&__no-issues,
&__loading,
&__error {
text-align: center;
padding: var(--pf-v5-global--spacer--xl) var(--pf-v5-global--spacer--md);
color: var(--pf-v5-global--Color--200);
}

&__healthy-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: var(--pf-v5-global--spacer--2xl) var(--pf-v5-global--spacer--md);
min-height: 200px;
}

&__healthy-icon {
margin-bottom: var(--pf-v5-global--spacer--md);
}

&__healthy-message {
font-size: var(--pf-v5-global--FontSize--xl);
color: var(--pf-v5-global--Color--100);
margin: 0;
}

&__error {
color: var(--pf-v5-global--danger-color--100);
}
}

.odf-pool-utilization-popover {
&__header {
display: flex;
align-items: center;
margin-bottom: var(--pf-v5-global--spacer--sm);
font-weight: var(--pf-v5-global--FontWeight--bold);
}

&__pool-name {
color: var(--pf-v5-global--Color--100);
}

&__body {
display: flex;
flex-direction: column;
gap: var(--pf-v5-global--spacer--sm);
}

&__item {
display: flex;
align-items: center;
gap: var(--pf-v5-global--spacer--sm);
}

&__message {
margin-top: var(--pf-v5-global--spacer--sm);
padding-top: var(--pf-v5-global--spacer--sm);
color: var(--pf-v5-global--Color--200);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most of this won't be needed if u use https://v5-archive.patternfly.org/components/description-list#horizontal from PF5...

Comment on lines +1 to +78
.odf-pool-utilization-card {
&__alert {
display: flex;
align-items: center;
gap: var(--pf-v5-global--spacer--sm);
margin-bottom: var(--pf-v5-global--spacer--sm);

&-icon {
color: var(--pf-v5-global--warning-color--100);
font-size: var(--pf-v5-global--icon--FontSize--lg);
}

&-count {
font-size: var(--pf-v5-global--FontSize--2xl);
font-weight: var(--pf-v5-global--FontWeight--bold);
color: var(--pf-v5-global--warning-color--100);
}
}

&__description {
color: var(--pf-v5-global--Color--200);
margin-bottom: var(--pf-v5-global--spacer--md);
}

&__usage {
display: flex;
align-items: center;
cursor: pointer;
}

&__highlighted-row {
border-left: 3px solid var(--pf-v5-global--primary-color--100);
padding-left: var(--pf-v5-global--spacer--md);
}

&__no-issues,
&__loading,
&__error {
text-align: center;
padding: var(--pf-v5-global--spacer--xl) var(--pf-v5-global--spacer--md);
color: var(--pf-v5-global--Color--200);
}

&__error {
color: var(--pf-v5-global--danger-color--100);
}
}

.odf-pool-utilization-popover {
&__header {
display: flex;
align-items: center;
margin-bottom: var(--pf-v5-global--spacer--sm);
font-weight: var(--pf-v5-global--FontWeight--bold);
}

&__pool-name {
color: var(--pf-v5-global--Color--100);
}

&__body {
display: flex;
flex-direction: column;
gap: var(--pf-v5-global--spacer--sm);
}

&__item {
display: flex;
align-items: center;
gap: var(--pf-v5-global--spacer--sm);
}

&__message {
margin-top: var(--pf-v5-global--spacer--sm);
padding-top: var(--pf-v5-global--spacer--sm);
color: var(--pf-v5-global--Color--200);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see multiple classes been repeated (copy-pasted) here from other file... keep same classes at a single common scss file and import from there...

@@ -0,0 +1 @@
export * from './PoolUtilizationPopoverContent';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move all the files under this folder to pool-utilization-card folder directly... it's a helper component only used in that card, we don't need entire new folder for this under components...

}: CustomData = rowData;

const poolType = obj.type;
const hideItems =
poolType === PoolType.FILESYSTEM
? [ModalKeys.EDIT_LABELS, ModalKeys.EDIT_ANN]
: [];
const replica = obj.spec?.replicated?.size;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why have we removed this ??

Comment on lines -295 to -297
const rawCapacity: string = poolRawCapacity?.[name]
? humanizeBinaryBytes(poolRawCapacity?.[name])?.string
: '-';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here...

Comment on lines +389 to +407
<div
className="odf-pool-utilization-card__usage"
style={{ cursor: 'pointer' }}
>
{isCritical ? (
<ExclamationCircleIcon
style={{ color: dangerColor.value }}
className="pf-v5-u-mr-sm"
/>
) : (
<ExclamationTriangleIcon
style={{ color: warningColor.value }}
className="pf-v5-u-mr-sm"
/>
)}
<span>
{usedCapacityDisplay} ({utilizationPercentage.toFixed(1)}%)
</span>
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Button with variant as "link"

Comment on lines +3 to +5
import { global_danger_color_100 as dangerColor } from '@patternfly/react-tokens/dist/js/global_danger_color_100';
import { global_success_color_100 as successColor } from '@patternfly/react-tokens/dist/js/global_success_color_100';
import { global_warning_color_100 as warningColor } from '@patternfly/react-tokens/dist/js/global_warning_color_100';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to import from dist

Comment on lines +13 to +20
export const POOL_NEAR_FULL_THRESHOLD = 70; // percent
export const POOL_FULL_THRESHOLD = 90; // percent

export enum PoolUtilizationState {
NORMAL = 'NORMAL',
NEAR_FULL = 'NEAR_FULL',
FULL = 'FULL',
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to constants

@@ -36,6 +36,10 @@
"{{count}} results found for {{clusterName}}_other": "{{count}} results found for {{clusterName}}",
"{{count}} selected_one": "{{count}} selected",
"{{count}} selected_other": "{{count}} selected",
"{{count}} storage pools critically full_one": "{{count}} storage pools critically full",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"{{count}} storage pools critically full_one": "{{count}} storage pools critically full",
"{{count}} storage pools critically full_one": "{{count}} storage pool critically full",

@@ -36,6 +36,10 @@
"{{count}} results found for {{clusterName}}_other": "{{count}} results found for {{clusterName}}",
"{{count}} selected_one": "{{count}} selected",
"{{count}} selected_other": "{{count}} selected",
"{{count}} storage pools critically full_one": "{{count}} storage pools critically full",
"{{count}} storage pools critically full_other": "{{count}} storage pools critically full",
"{{count}} storage pools need attention_one": "{{count}} storage pools need attention",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"{{count}} storage pools need attention_one": "{{count}} storage pools need attention",
"{{count}} storage pools need attention_one": "{{count}} storage pool needs attention",

@@ -267,6 +269,21 @@ export const getPoolQuery = (
[StorageDashboardQuery.POOL_COMPRESSION_ELIGIBILITY]: `(((ceph_pool_compress_under_bytes{managedBy='${managedByOCS}'} > 0) / ceph_pool_stored_raw{managedBy='${managedByOCS}'}) * 100) * on (pool_id) group_left(name)ceph_pool_metadata{name=~'${names}',managedBy='${managedByOCS}'}`,
[StorageDashboardQuery.POOL_COMPRESSION_RATIO]: `((ceph_pool_compress_under_bytes{managedBy='${managedByOCS}'} / ceph_pool_compress_bytes_used{managedBy='${managedByOCS}'} > 0) and on(pool_id) (((ceph_pool_compress_under_bytes{managedBy='${managedByOCS}'} > 0) / ceph_pool_stored_raw{managedBy='${managedByOCS}'}) * 100 > 0.5)) * on (pool_id) group_left(name)ceph_pool_metadata{name=~'${names}',managedBy='${managedByOCS}'}`,
[StorageDashboardQuery.POOL_MIRRORING_IMAGE_HEALTH]: `max by (namespace, managedBy, rados_namespace, name) (ocs_pool_mirroring_image_health{managedBy='${managedByOCS}', name=~'${names}'}) * on (namespace, managedBy, rados_namespace, name) group_left () (max by (namespace, managedBy, rados_namespace, name) (ocs_pool_mirroring_status{managedBy='${managedByOCS}', name=~'${names}'}))`,
[StorageDashboardQuery.POOL_UTILIZATION_PERCENTAGE]: `((ceph_pool_bytes_used{managedBy='${managedByOCS}'} / (ceph_pool_bytes_used{managedBy='${managedByOCS}'} + ceph_pool_avail_raw{managedBy='${managedByOCS}'})) * 100) * on (pool_id) group_left(name)ceph_pool_metadata{name=~'${names}',managedBy='${managedByOCS}'}`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aruniiird can you PTAL at the queries?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants