Resource MEMORY_MB Unable to retrieve providers information

Bug #2055784 reported by Victor Serbu
34
This bug affects 7 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Undecided
Andres Quintero

Bug Description

Hello
When I click on admin -> compute -> hypervisor I get error and nothing is displayed in resource providers summary.
This
This happens because i have an environment in which i have activate pci passthrough in nova and there are tracked in placement: https://docs.openstack.org/nova/2023.1/admin/pci-passthrough.html#pci-tracking-in-placement

and this inventory doesn't have MEMORY_MB or DISK_GB (i looked at https://opendev.org/openstack/horizon/src/branch/master/openstack_dashboard/api/placement.py#L117-L127)

eg
one compute node where i have activated pci passthrough
```
(openstack) [osc@ansible-3 ~]$ openstack resource provider show 1fe9d32f-43cd-445a-8a49-a68f9ff5158f
+----------------------+--------------------------------------+
| Field | Value |
+----------------------+--------------------------------------+
| uuid | 1fe9d32f-43cd-445a-8a49-a68f9ff5158f |
| name | compute-19_0000:04:00.0 |
| generation | 44 |
| root_provider_uuid | e9cb6a8d-e638-4245-bf79-981211c5a232 |
| parent_provider_uuid | e9cb6a8d-e638-4245-bf79-981211c5a232 |
+----------------------+--------------------------------------+
(openstack) [osc@ansible-3 ~]$ openstack resource provider usage show 1fe9d32f-43cd-445a-8a49-a68f9ff5158f
+----------------------+-------+
| resource_class | usage |
+----------------------+-------+
| CUSTOM_PCI_10DE_2330 | 1 |
+----------------------+-------+
```

One simple compute node show as
```
(openstack) [osc@ansible-3 ~]$ openstack resource provider usage show f7af998e-1563-4a55-9145-4ee5f527d12b
+----------------+--------+
| resource_class | usage |
+----------------+--------+
| VCPU | 412 |
| MEMORY_MB | 824320 |
| DISK_GB | 0 |
+----------------+--------+

```

Changed in horizon:
assignee: nobody → Andres Quintero (aquintero93)
Revision history for this message
Andrew Bonney (andrewbonney) wrote :

We're seeing the same issue.

Revision history for this message
Sam Schmitt (samcat116) wrote :

I see the same thing with Ironic baremetal nodes tracked in placement.

Revision history for this message
Josué González Ruiz (josuegonzale) wrote :

We are currently experiencing the same problem

Revision history for this message
Aldin Setiawan (just-humanz403) wrote :

same issues

Revision history for this message
Aldin Setiawan (just-humanz403) wrote :

i just try to patch it (or at least ignore the error)

```
nano +117 ./var/lib/kolla/venv/lib/python3.10/site-packages/openstack_dashboard/api/placement.py
```

and then add&replace this code on line 117 until 121
```
        if 'MEMORY_MB' in usages.keys():
            p['memory_mb_used'] = usages['MEMORY_MB']
            p['memory_mb_reserved'] = inventories['MEMORY_MB']['reserved']
            p['memory_mb'] = inventories['MEMORY_MB']['total']
            p['memory_mb_ar'] = inventories['MEMORY_MB']['allocation_ratio']
            p['memory_mb_capacity'] = p['memory_mb_ar'] * p['memory_mb']
        else:
            continue
```

then restart the service
```
docker restart horizon
```

it's dirty but work

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/horizon/+/926710

Changed in horizon:
status: New → In Progress
Revision history for this message
Takashi Kajinami (kajinamit) wrote :

The problem here is that horizon does not care what the RP represents and attempts to look up fields which are specific to compute node providers.
So if there is any additional RP (for example pci device RP) then horizon is not able to render resource providers correctly.

Although the change in #5 may work, it hides any non-compute RP from resource provider tabs. IMO it's probably more appropriate toe keep the RP with these compute specific fields empty because the table title is "Resource Providers", IIRC.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by "Takashi Kajinami <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/horizon/+/926710
Reason: this is duplicate of https://review.opendev.org/c/openstack/horizon/+/926160

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.opendev.org/c/openstack/horizon/+/926160
Committed: https://opendev.org/openstack/horizon/commit/30888edfd52bfaadad241aa2fcdf44151d0aed96
Submitter: "Zuul (22348)"
Branch: master

commit 30888edfd52bfaadad241aa2fcdf44151d0aed96
Author: Tatiana Ovchinnikova <email address hidden>
Date: Mon Aug 12 14:40:45 2024 -0500

    Fix Placement statistics display

    For some inventories MEMORY_MB and DISK_GB are optional,
    so we need to check before displaying them.

    Closes-Bug: #2055784
    Change-Id: I2ef63caf72f0f8f72fe8af87b21742088221578c

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to horizon (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/horizon/+/926883

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to horizon (master)

Reviewed: https://review.opendev.org/c/openstack/horizon/+/926883
Committed: https://opendev.org/openstack/horizon/commit/c786ebb588a37548381964a967ae9394dc8b31a5
Submitter: "Zuul (22348)"
Branch: master

commit c786ebb588a37548381964a967ae9394dc8b31a5
Author: Takashi Kajinami <email address hidden>
Date: Thu Aug 22 17:42:33 2024 +0900

    Fix generation of inventory capacities

    This is follow-up of change I2ef63caf72f0f8f72fe8af87b21742088221578c
    and fixes a few values referenced before being assigned.

    Related-Bug: #2055784
    Change-Id: I7ecc47b2b923d264342c69258b309ce1037c9102

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/2024.1)

Fix proposed to branch: stable/2024.1
Review: https://review.opendev.org/c/openstack/horizon/+/927429

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/2023.2)

Fix proposed to branch: stable/2023.2
Review: https://review.opendev.org/c/openstack/horizon/+/927430

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/2023.1)

Fix proposed to branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/horizon/+/927431

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 25.1.0

This issue was fixed in the openstack/horizon 25.1.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.