"openstack hypervisor stats show" shows wrong memory information

Bug #1767315 reported by Kosal Raj I
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Undecided
jichenjc

Bug Description

Description
===========
"openstack hypervisor stats show" shows wrong memory information
Steps to reproduce
==================
- The deployment is done through tripleo-quickstart for openstack queens

(overcloud) [stack@undercloud ~]$ openstack hypervisor stats show
+----------------------+-------+
| Field | Value |
+----------------------+-------+
| count | 1 |
| current_workload | 0 |
| disk_available_least | 43 |
| free_disk_gb | 49 |
| free_ram_mb | -49 |
| local_gb | 49 |
| local_gb_used | 0 |
| memory_mb | 4047 |
| memory_mb_used | 4096 |
| running_vms | 0 |
| vcpus | 2 |
| vcpus_used | 0 |
+----------------------+-------+
(overcloud) [stack@undercloud ~]$

[root@overcloud-novacompute-0 ~]# free -m
              total used free shared buff/cache available
Mem: 3742 556 203 1 2982 2688
Swap: 0 0 0
[root@overcloud-novacompute-0 ~]#

Expected result
===============
Should leverage the actual available memory.

Actual result
=============
Showing wrong memory value.

Environment
===========
- Openstack queens

[heat-admin@overcloud-novacompute-0 ~]$ rpm -qa | grep nova
openstack-nova-placement-api-17.0.3-0.20180420001136.bf0a069.el7.centos.noarch
python-nova-17.0.3-0.20180420001136.bf0a069.el7.centos.noarch
puppet-nova-12.4.1-0.20180423041756.95ca7cd.el7.centos.noarch
openstack-nova-scheduler-17.0.3-0.20180420001136.bf0a069.el7.centos.noarch
python2-novaclient-9.1.1-0.20180213141814.a1c0074.el7.centos.noarch
openstack-nova-conductor-17.0.3-0.20180420001136.bf0a069.el7.centos.noarch
openstack-nova-migration-17.0.3-0.20180420001136.bf0a069.el7.centos.noarch
openstack-nova-console-17.0.3-0.20180420001136.bf0a069.el7.centos.noarch
openstack-nova-common-17.0.3-0.20180420001136.bf0a069.el7.centos.noarch
openstack-nova-compute-17.0.3-0.20180420001136.bf0a069.el7.centos.noarch
openstack-nova-api-17.0.3-0.20180420001136.bf0a069.el7.centos.noarch
openstack-nova-novncproxy-17.0.3-0.20180420001136.bf0a069.el7.centos.noarch
[heat-admin@overcloud-novacompute-0 ~]$

Logs & Configs
==============
- default configuration

Revision history for this message
Kosal Raj I (kosalraj) wrote :

Adding to the previous comment,

[root@overcloud-novacompute-0 ~]# cat /proc/meminfo
MemTotal: 3832560 kB
MemFree: 207168 kB
MemAvailable: 2751872 kB
Buffers: 2600 kB
Cached: 2520524 kB
SwapCached: 0 kB
Active: 1085244 kB
Inactive: 1823424 kB
Active(anon): 402760 kB
Inactive(anon): 172 kB
Active(file): 682484 kB
Inactive(file): 1823252 kB
Unevictable: 47572 kB
Mlocked: 47572 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 8 kB
Writeback: 0 kB
AnonPages: 433116 kB
Mapped: 101336 kB
Shmem: 1292 kB
Slab: 531460 kB
SReclaimable: 327828 kB
SUnreclaim: 203632 kB
KernelStack: 4448 kB
PageTables: 9580 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 1916280 kB
Committed_AS: 2039136 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 15252 kB
VmallocChunk: 34359711484 kB
HardwareCorrupted: 0 kB
AnonHugePages: 100352 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 122856 kB
DirectMap2M: 4022272 kB
DirectMap1G: 0 kB
[root@overcloud-novacompute-0 ~]#

Revision history for this message
jichenjc (jichenjc) wrote :

looks like we at least need provide some info
https://developer.openstack.org/api-ref/compute/

the -49 seems incorrect as well, but as far as I can tell , the memory is not the 'free' memory of the hypervisor, allocation rate need to be included as well so might be negative

Changed in nova:
status: New → Confirmed
assignee: nobody → jichenjc (jichenjc)
Revision history for this message
Kosal Raj I (kosalraj) wrote :

Did you meaning about ram_allocation_ratio ? This is using the default value.

Even available memory is around 2.5+ GB. Any idea why it is showing -49 ?

Because of which the instance spawning is failing.

Revision history for this message
sean mooney (sean-k-mooney) wrote :

this is not a but at least not as reported.

free_ram_mb is not ment to be equal to the free value of "free -m"

memory_mb is 4047 and memory_mb 4096

as a result the total amount of memery that you have acounted against guests is 49 mb more then the avalible ram

so free_ram_mb which is caluated as memory_mb - memory_mb_used
is -49 as you are oversubsibed by 49MBs

the default ram allocation ratio is 1.5 which is why you are allowed to allocate more ram then you have up to 6GiB in your
case.

not that memory_mb_used is calulated by suming the total ram of all vms scheduled to a node + the reserved_host_memory_mb config value which i would guess defaults to 4096 in triplo.

https://docs.openstack.org/nova/latest/configuration/config.html#DEFAULT.reserved_host_memory_mb

Changed in nova:
status: Confirmed → Invalid
Revision history for this message
sean mooney (sean-k-mooney) wrote :
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.