Invalid value for 'hw:mem_page_size' raises confusing error

Bug #1879964 reported by Stephen Finucane
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Stephen Finucane
Train
Fix Released
Undecided
Unassigned
Ussuri
Fix Released
Undecided
Unassigned

Bug Description

Configure a flavor like so:

  openstack flavor create hugepage --ram 1024 --disk 10 --vcpus 1 test
  openstack flavor set hugepage --property hw:mem_page_size=2M test

Attempt to boot an instance. It will fail with the following error message:

  Invalid memory page size '0' (HTTP 400) (Request-ID: req-338bf619-3a54-45c5-9c59-ad8c1d425e91)

You wouldn't know from reading it, but this is because the property should read 'hw:mem_page_size=2MB' (note the extra 'B').

Changed in nova:
importance: Undecided → Low
status: New → Confirmed
assignee: nobody → Stephen Finucane (stephenfinucane)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.opendev.org/729967

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.opendev.org/729967
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=f76d09b19d5b7530b7e4e9fc255835f6aff5db6a
Submitter: Zuul
Branch: master

commit f76d09b19d5b7530b7e4e9fc255835f6aff5db6a
Author: Stephen Finucane <email address hidden>
Date: Thu May 21 14:43:25 2020 +0100

    hardware: Raise useful error for invalid mempage size

    The 'hw:mem_page_size' extra spec allows you to specify values in three
    ways: via a relative size alias (large, small, any), via exact byte
    values, and via an SI/IEC/mixed representation (e.g. 2MB, 1GB).
    Currently, attempting to use an invalid variant of the latter, such as
    '2M', will raise a rather confusing error message:

      Invalid memory page size '0'

    Correct this so we instead see something like so:

      Invalid memory page size '2M'

    Change-Id: I3af99f03514904da09f7b71f430b43bf75e8be67
    Signed-off-by: Stephen Finucane <email address hidden>
    Closes-Bug: #1879964

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

Fix proposed to branch: stable/train
Review: https://review.opendev.org/735950

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

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/736073

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

Reviewed: https://review.opendev.org/736073
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=eedc0b5ff319b3cce42dba4c4720bcb98798e064
Submitter: Zuul
Branch: stable/ussuri

commit eedc0b5ff319b3cce42dba4c4720bcb98798e064
Author: Stephen Finucane <email address hidden>
Date: Thu May 21 14:43:25 2020 +0100

    hardware: Raise useful error for invalid mempage size

    The 'hw:mem_page_size' extra spec allows you to specify values in three
    ways: via a relative size alias (large, small, any), via exact byte
    values, and via an SI/IEC/mixed representation (e.g. 2MB, 1GB).
    Currently, attempting to use an invalid variant of the latter, such as
    '2M', will raise a rather confusing error message:

      Invalid memory page size '0'

    Correct this so we instead see something like so:

      Invalid memory page size '2M'

    Change-Id: I3af99f03514904da09f7b71f430b43bf75e8be67
    Signed-off-by: Stephen Finucane <email address hidden>
    Closes-Bug: #1879964
    (cherry picked from commit f76d09b19d5b7530b7e4e9fc255835f6aff5db6a)

tags: added: in-stable-ussuri
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/train)

Reviewed: https://review.opendev.org/735950
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=58c9c3f238e71c69b5b4a760c47a1788cd657ea9
Submitter: Zuul
Branch: stable/train

commit 58c9c3f238e71c69b5b4a760c47a1788cd657ea9
Author: Stephen Finucane <email address hidden>
Date: Thu May 21 14:43:25 2020 +0100

    hardware: Raise useful error for invalid mempage size

    The 'hw:mem_page_size' extra spec allows you to specify values in three
    ways: via a relative size alias (large, small, any), via exact byte
    values, and via an SI/IEC/mixed representation (e.g. 2MB, 1GB).
    Currently, attempting to use an invalid variant of the latter, such as
    '2M', will raise a rather confusing error message:

      Invalid memory page size '0'

    Correct this so we instead see something like so:

      Invalid memory page size '2M'

    Changes:
            nova/virt/hardware.py

    NOTE(stephenfin): We need to drop use of 'raise...from', which is Python
    3-only syntax. The net effect of this change is uglier (but still valid)
    tracebacks.

    Change-Id: I3af99f03514904da09f7b71f430b43bf75e8be67
    Signed-off-by: Stephen Finucane <email address hidden>
    Closes-Bug: #1879964
    (cherry picked from commit f76d09b19d5b7530b7e4e9fc255835f6aff5db6a)
    (cherry picked from commit eedc0b5ff319b3cce42dba4c4720bcb98798e064)

tags: added: in-stable-train
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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