Cannot create VMs where their flavor has a cpu quota even when the kernel supports CPU controller

Bug #2008102 reported by Jorge San Emeterio
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
In Progress
Undecided
Jorge San Emeterio

Bug Description

Description
===========
Given a flavor enriched with the "quota:cpu_quota" property, creation of servers based on it will fail on system's running under cgroups v2, complaining that the CPU controller is unavailable even when the kernel does provide it.

Steps to reproduce
==================
1.- openstack flavor create flavor_cpu --id 101 --ram 2048 --disk 10 --vcpus 2
2.- openstack flavor set flavor_cpu --property hw:boot_menu='true' --property quota:cpu_period='1000000' --property quota:cpu_quota='1000000000' --property quota:cpu_shares='2048'
3.- openstack image create asb-qcow2 --disk-format qcow2 --container-format bare --file /tmp/cirros-0.6.1-x86_64-disk.img
4.- openstack server create --flavor flavor_cpu --image asb-qcow2
5.- openstack server show vm-r9-qcow2

Expected result
===============
Server is built and active.

Actual result
=============
Error: "{'code': 500, 'created': '2022-08-17T08:24:38Z', 'message': 'Requested CPU control policy not supported by host'..."

Environment
===========
Rocky Linux 9 or Ubuntu 22.04
DevStack

Revision history for this message
Jorge San Emeterio (jsanemet) wrote :
Changed in nova:
status: New → In Progress
Rajesh Tailor (ratailor)
Changed in nova:
assignee: nobody → Rajesh Tailor (ratailor)
Revision history for this message
Jorge San Emeterio (jsanemet) wrote :

I forgot to assign it to myself, fix is in here: https://review.opendev.org/c/openstack/nova/+/873127

Changed in nova:
assignee: Rajesh Tailor (ratailor) → Jorge San Emeterio (jsanemet)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.opendev.org/c/openstack/nova/+/873127
Committed: https://opendev.org/openstack/nova/commit/973ff4fc1a0586937d13f2b39e517422713b1003
Submitter: "Zuul (22348)"
Branch: master

commit 973ff4fc1a0586937d13f2b39e517422713b1003
Author: Jorge San Emeterio <email address hidden>
Date: Wed Feb 8 15:33:54 2023 +0100

    Have host look for CPU controller of cgroupsv2 location.

    Make the host class look under '/sys/fs/cgroup/cgroup.controllers' for support of the cpu controller. The host will try searching through cgroupsv1 first, just like up until now, and in the case that fails, it will try cgroupsv2 then. The host will not support the feature if both checks fail.

    This new check needs to be mocked by all tests that focus on this piece of code, as it touches a system file that requires privileges. For such thing, the CGroupsFixture is defined to easily add suck mocking to all test cases that require so.

    I also removed old mocking at test_driver.py in favor of the fixture from above.

    Partial-Bug: #2008102
    Change-Id: I99b57c27c8a4425389bec2b7f05af660bab85610

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

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

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

Fix proposed to branch: stable/zed
Review: https://review.opendev.org/c/openstack/nova/+/882914

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

Fix proposed to branch: stable/yoga
Review: https://review.opendev.org/c/openstack/nova/+/882920

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

Fix proposed to branch: stable/xena
Review: https://review.opendev.org/c/openstack/nova/+/882921

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

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/nova/+/882939

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

Reviewed: https://review.opendev.org/c/openstack/nova/+/882913
Committed: https://opendev.org/openstack/nova/commit/eb3fe4ddc621380afa32ec9aec0c285f36f99ee3
Submitter: "Zuul (22348)"
Branch: stable/2023.1

commit eb3fe4ddc621380afa32ec9aec0c285f36f99ee3
Author: Jorge San Emeterio <email address hidden>
Date: Wed Feb 8 15:33:54 2023 +0100

    Have host look for CPU controller of cgroupsv2 location.

    Make the host class look under '/sys/fs/cgroup/cgroup.controllers' for support of the cpu controller. The host will try searching through cgroupsv1 first, just like up until now, and in the case that fails, it will try cgroupsv2 then. The host will not support the feature if both checks fail.

    This new check needs to be mocked by all tests that focus on this piece of code, as it touches a system file that requires privileges. For such thing, the CGroupsFixture is defined to easily add suck mocking to all test cases that require so.

    I also removed old mocking at test_driver.py in favor of the fixture from above.

    Partial-Bug: #2008102
    Change-Id: I99b57c27c8a4425389bec2b7f05af660bab85610
    (cherry picked from commit 973ff4fc1a0586937d13f2b39e517422713b1003)

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

Reviewed: https://review.opendev.org/c/openstack/nova/+/882920
Committed: https://opendev.org/openstack/nova/commit/aa295b4ad71b59ba9ba612f07f1f108a8a25473b
Submitter: "Zuul (22348)"
Branch: stable/yoga

commit aa295b4ad71b59ba9ba612f07f1f108a8a25473b
Author: Jorge San Emeterio <email address hidden>
Date: Wed Feb 8 15:33:54 2023 +0100

    Have host look for CPU controller of cgroupsv2 location.

    Make the host class look under '/sys/fs/cgroup/cgroup.controllers' for support of the cpu controller. The host will try searching through cgroupsv1 first, just like up until now, and in the case that fails, it will try cgroupsv2 then. The host will not support the feature if both checks fail.

    This new check needs to be mocked by all tests that focus on this piece of code, as it touches a system file that requires privileges. For such thing, the CGroupsFixture is defined to easily add suck mocking to all test cases that require so.

    I also removed old mocking at test_driver.py in favor of the fixture from above.

    Conflicts:
        nova/tests/unit/virt/libvirt/test_driver.py

    NOTE(auniyal):
    - as new cgroup fixture is added, removed old mocking in few more unit test cases in test_driver
    - did not remove test_guest_cpu_shares_with_multi_vcpu from test_driver

    Partial-Bug: #2008102
    Change-Id: I99b57c27c8a4425389bec2b7f05af660bab85610
    (cherry picked from commit 973ff4fc1a0586937d13f2b39e517422713b1003)
    (cherry picked from commit eb3fe4ddc621380afa32ec9aec0c285f36f99ee3)
    (cherry picked from commit 9e86be5a5365b1896d489de7149e471fd22881d6)

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

Reviewed: https://review.opendev.org/c/openstack/nova/+/882921
Committed: https://opendev.org/openstack/nova/commit/722ddc4796c6f3705cc1b724c2a56f8b5ab905cc
Submitter: "Zuul (22348)"
Branch: stable/xena

commit 722ddc4796c6f3705cc1b724c2a56f8b5ab905cc
Author: Jorge San Emeterio <email address hidden>
Date: Wed Feb 8 15:33:54 2023 +0100

    Have host look for CPU controller of cgroupsv2 location.

    Make the host class look under '/sys/fs/cgroup/cgroup.controllers' for support of the cpu controller. The host will try searching through cgroupsv1 first, just like up until now, and in the case that fails, it will try cgroupsv2 then. The host will not support the feature if both checks fail.

    This new check needs to be mocked by all tests that focus on this piece of code, as it touches a system file that requires privileges. For such thing, the CGroupsFixture is defined to easily add suck mocking to all test cases that require so.

    I also removed old mocking at test_driver.py in favor of the fixture from above.

    Conflicts:
        nova/tests/unit/virt/libvirt/test_driver.py

    NOTE(auniyal):
    - as new cgroup fixture is added, removed old mocking in few more unit test cases in test_driver
    - did not remove test_guest_cpu_shares_with_multi_vcpu from test_driver

    Partial-Bug: #2008102
    Change-Id: I99b57c27c8a4425389bec2b7f05af660bab85610
    (cherry picked from commit 973ff4fc1a0586937d13f2b39e517422713b1003)
    (cherry picked from commit eb3fe4ddc621380afa32ec9aec0c285f36f99ee3)
    (cherry picked from commit 9e86be5a5365b1896d489de7149e471fd22881d6)
    (cherry picked from commit aa295b4ad71b59ba9ba612f07f1f108a8a25473b)

tags: added: in-stable-xena
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (stable/wallaby)

Change abandoned by "Elod Illes <email address hidden>" on branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/nova/+/882939
Reason: stable/wallaby branch of openstack/nova is about to be deleted. To be able to do that, all open patches need to be abandoned. Please cherry pick the patch to unmaintained/wallaby if you want to further work on this patch.

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.