Bug 1537047 - Bug in log output in hardware.py "Not enough available memory to schedule instance" prints full memory instead of available memory
Summary: Bug in log output in hardware.py "Not enough available memory to schedule ins...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-nova
Version: 12.0 (Pike)
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: z3
: 12.0 (Pike)
Assignee: Sahid Ferdjaoui
QA Contact: Joe H. Rahme
URL:
Whiteboard:
Depends On: 1519054 1537045
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-01-22 10:38 UTC by Sahid Ferdjaoui
Modified: 2022-07-09 11:43 UTC (History)
16 users (show)

Fixed In Version: openstack-nova-16.1.4-2.el7ost
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1537045
Environment:
Last Closed: 2018-08-20 12:55:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1735321 0 None None None 2018-01-22 10:38:49 UTC
OpenStack gerrit 524038 0 None MERGED Fixes 'Not enough available memory' log message 2020-12-10 18:49:44 UTC
Red Hat Issue Tracker OSP-17243 0 None None None 2022-07-09 11:43:46 UTC
Red Hat Product Errata RHSA-2018:2332 0 None None None 2018-08-20 12:57:40 UTC

Description Sahid Ferdjaoui 2018-01-22 10:38:49 UTC
+++ This bug was initially created as a clone of Bug #1537045 +++

+++ This bug was initially created as a clone of Bug #1519054 +++

Description of problem:
Bug in log output in hardware.py "Not enough available memory to schedule instance" prints full memory instead of available memory

Version-Release number of selected component (if applicable):


Additional info:

When nova fails scheduling, it will print:
~~~
2017-11-29 10:50:16.904 325123 DEBUG nova.virt.hardware [req-b62c53d2-13db-4fac-a125-409b4f046418 8f883df20fce46dbef3ce634610c51be53b87e658359f05b7eba1062ce7e5d8b 5b54e36678a542d899f1ff62268fc25a - - -] Not enough available memory to schedule instance. Oversubscription is not possible with pinned instances. Required: 32768, actual: 65406 _numa_fit_instance_cell_with_pinning /usr/lib/python2.7/site-packages/nova/virt/hardware.py:845
2017-11-29 10:50:16.904 325123 DEBUG oslo_concurrency.lockutils [req-b62c53d2-13db-4fac-a125-409b4f046418 8f883df20fce46dbef3ce634610c51be53b87e658359f05b7eba1062ce7e5d8b 5b54e36678a542d899f1ff62268fc25a - - -] Lock "compute_resources" released by "nova.compute.resource_tracker.instance_claim" :: held 0.021s inner /usr/lib/python2.7/site-packages/oslo_concurrency/lockutils.py:282
2017-11-29 10:50:16.905 325123 DEBUG nova.compute.manager [req-b62c53d2-13db-4fac-a125-409b4f046418 8f883df20fce46dbef3ce634610c51be53b87e658359f05b7eba1062ce7e5d8b 5b54e36678a542d899f1ff62268fc25a - - -] [instance: 86cc16bd-5f51-402b-aa03-01ab0c3ffaf4] Insufficient compute resources: Requested instance NUMA topology cannot fit the given host NUMA topology. _build_and_run_instance /usr/lib/python2.7/site-packages/nova/compute/manager.py:1934
~~~

This of course looks very confusing (we need 32 GB, we have 64, so why is this failing?).

The problem here is the log output, which is flawed --- /usr/lib/python2.7/site-packages/nova/virt/hardware.py:
~~~
    840     if host_cell.avail_memory < instance_cell.memory:
    841         LOG.debug('Not enough available memory to schedule instance. '
    842                   'Oversubscription is not possible with pinned instances. '
    843                   'Required: %(required)s, actual: %(actual)s',
    844                   {'required': instance_cell.memory,
    845                    'actual': host_cell.memory})
    846         return
~~~

This should be:
~~~
    840     if host_cell.avail_memory < instance_cell.memory:
    841         LOG.debug('Not enough available memory to schedule instance. '
    842                   'Oversubscription is not possible with pinned instances. '
    843                   'Required: %(required)s, actual: %(actual)s',
    844                   {'required': instance_cell.memory,
    845                    'actual': host_cell.avail_memory})
    846         return
~~~

Or even better:
~~~
    840     if host_cell.avail_memory < instance_cell.memory:
    841         LOG.debug('Not enough available memory to schedule instance. '
    842                   'Oversubscription is not possible with pinned instances. '
    843                   'Required: %(required)s, actual: %(actual)s, total: %(total)s',
    844                   {'required': instance_cell.memory,
    845                    'actual': host_cell.avail_memory,
    846                    'total': host_cell.memory})
    847         return
~~~

--- Additional comment from Sahid Ferdjaoui on 2017-11-30 03:44:05 EST ---

Thanks for the fix upstream. While merged I will take care of doing the backport.

Comment 1 Sahid Ferdjaoui 2018-01-22 10:49:03 UTC
Let see if the backport on sable-pike is going to be accepted upstream:

   https://review.openstack.org/#/c/536297/

Comment 2 Sahid Ferdjaoui 2018-02-21 11:23:32 UTC
Merged upstream.

Comment 10 errata-xmlrpc 2018-08-20 12:55:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:2332


Note You need to log in before you can comment on or make changes to this bug.