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

Bug #1735321 reported by Andreas Karis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Andreas Karis
Pike
Fix Committed
Undecided
Sahid Orentino

Bug Description

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
~~~

Andreas Karis (akaris)
Changed in nova:
assignee: nobody → Andreas Karis (akaris)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/524038

tags: added: ocata-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/524038
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=4fd51617fb408fa389baa1aed10db3a06cc1539b
Submitter: Zuul
Branch: master

commit 4fd51617fb408fa389baa1aed10db3a06cc1539b
Author: Andreas Karis <email address hidden>
Date: Wed Nov 29 20:55:17 2017 -0500

    Fixes 'Not enough available memory' log message

    Fixes a bug in log output about where 'Not enough available
    memory to schedule instance' printed full memory instead of
    available memory

    Change-Id: Id65e9f5eec9ba1f39bcba24539b11f2e27226941
    Closes-Bug: #1735321

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/536297

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 17.0.0.0b3

This issue was fixed in the openstack/nova 17.0.0.0b3 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/pike)

Reviewed: https://review.openstack.org/536297
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=863515187575b9630c02f7318b94bd2ef9a6f4a9
Submitter: Zuul
Branch: stable/pike

commit 863515187575b9630c02f7318b94bd2ef9a6f4a9
Author: Andreas Karis <email address hidden>
Date: Wed Nov 29 20:55:17 2017 -0500

    Fixes 'Not enough available memory' log message

    Fixes a bug in log output about where 'Not enough available
    memory to schedule instance' printed full memory instead of
    available memory

    Change-Id: Id65e9f5eec9ba1f39bcba24539b11f2e27226941
    Closes-Bug: #1735321
    (cherry picked from commit 4fd51617fb408fa389baa1aed10db3a06cc1539b)

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

This issue was fixed in the openstack/nova 16.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.