'hw:realtime_mask' extra spec is not validated
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
Stephen Finucane |
Bug Description
The 'hw:realtime_mask' extra spec is (currently) used to specify what cores in a host should *not* be part of the realtime set of cores on the host. Currently, this is mandatory and omitting it will cause a HTTP 400 error. For example:
$ openstack flavor create --ram 512 --disk 1 --vcpus 2 \
--property hw:cpu_
--property hw:cpu_realtime=yes \
test.rt
will fail with:
Realtime policy needs vCPU(s) mask configured with at least 1 RT vCPU and 1 ordinary vCPU. See hw:cpu_
Similarly, attempting to mask *all* values will result in a failure. For example:
$ openstack flavor create --ram 512 --disk 1 --vcpus 2 \
--property hw:cpu_
--property hw:cpu_realtime=yes \
--property hw:cpu_
test.rt
will also fail with:
Realtime policy needs vCPU(s) mask configured with at least 1 RT vCPU and 1 ordinary vCPU. See hw:cpu_
However, the value is otherwise unvalidated by nova, which can cause libvirt to explode when specific values are passed. For example, consider the following flavor:
$ openstack flavor create --ram 512 --disk 1 --vcpus 2 \
--property hw:cpu_
--property hw:cpu_realtime=yes \
--property hw:cpu_
test.rt
This states that the instances should have two cores, and some imaginary third core (masks are 0-indexed) will be the non-realtime one. This is clearly nonsensical and, surely enough, creating an instance using this core causes things to go bang:
Failed to build and run instance: libvirt.
Traceback (most recent call last):
File "/opt/stack/
accel_
File "/opt/stack/
cleanup_
File "/opt/stack/
cleanup_
File "/usr/local/
self.
File "/usr/local/
six.
File "/usr/local/
raise value
File "/opt/stack/
post_
File "/opt/stack/
guest = libvirt_
File "/opt/stack/
encodeuti
File "/usr/local/
self.
File "/usr/local/
six.
File "/usr/local/
raise value
File "/opt/stack/
guest = host.write_
File "/opt/stack/
domain = self.get_
File "/usr/local/
result = proxy_call(
File "/usr/local/
rv = execute(f, *args, **kwargs)
File "/usr/local/
six.
File "/usr/local/
raise value
File "/usr/local/
rv = meth(*args, **kwargs)
File "/usr/local/
if ret is None:raise libvirtError(
libvirt.
The error happens because libvirt is attempting to configure the set CPUs on which to pin emulators threads, which in the realtime case are all the non-realtime cores. However, since there are no cores set aside for non-realtime purposes - due to the invalid mask - we end up with an empty emulator thread set [1]. One *could* work around this by configuring an emulator thread policy. For example:
openstack flavor create --ram 512 --disk 1 --vcpus 2 \
--property 'hw:cpu_
--property 'hw:emulator_
--property 'hw:cpu_
--property 'hw:cpu_
test.rt
Similarly, they could ensure at least one core in the range is valid:
openstack flavor create --ram 512 --disk 1 --vcpus 2 \
--property 'hw:cpu_
--property 'hw:emulator_
--property 'hw:cpu_
--property 'hw:cpu_
test.rt
However, both cases are still wrong and the 'hw:cpu_
Changed in nova: | |
importance: | Undecided → Medium |
assignee: | nobody → Stephen Finucane (stephenfinucane) |
status: | New → Confirmed |
description: | updated |
tags: | added: libvi |
tags: |
added: libvirt removed: libvi |
Changed in nova: | |
status: | Confirmed → In Progress |
Reviewed: https:/ /review. opendev. org/468203 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=b0659741879 9b382d091bd2ff4 b747e6f5a10d96
Committed: https:/
Submitter: Zuul
Branch: master
commit b06597418799b38 2d091bd2ff4b747 e6f5a10d96
Author: Chris Friesen <email address hidden>
Date: Thu May 25 17:13:22 2017 -0600
hardware: Add validation for 'cpu_realtime_mask'
It's possible to specify some strange values for the cpu realtime mask
and the code won't currently complain, so let's make it a bit more
strict.
Change-Id: I0ba06529affe5b 48af5ac37bc2424 2dffdac77d3
Closes-Bug: #1884231