Fix incorrect known vcpuset when CPUPinningUnknown raised
When exception.CPUPinningUnknown or exception.CPUUnPinningUnknown
is raised, the value of known vcpuset is NUMACell's pinned_cpus,
it should be NUMACell's cpuset.
Close-Bug: #1729784
Change-Id: I1902dc40623af62fd83fac222099f664d7d19ed9
(cherry picked from commit ecf12a4dd1
)
This commit is contained in:
parent
c88720628a
commit
ae56863746
|
@ -79,7 +79,7 @@ class NUMACell(base.NovaObject):
|
|||
def pin_cpus(self, cpus):
|
||||
if cpus - self.cpuset:
|
||||
raise exception.CPUPinningUnknown(requested=list(cpus),
|
||||
cpuset=list(self.pinned_cpus))
|
||||
cpuset=list(self.cpuset))
|
||||
if self.pinned_cpus & cpus:
|
||||
raise exception.CPUPinningInvalid(requested=list(cpus),
|
||||
free=list(self.cpuset -
|
||||
|
@ -89,7 +89,7 @@ class NUMACell(base.NovaObject):
|
|||
def unpin_cpus(self, cpus):
|
||||
if cpus - self.cpuset:
|
||||
raise exception.CPUUnpinningUnknown(requested=list(cpus),
|
||||
cpuset=list(self.pinned_cpus))
|
||||
cpuset=list(self.cpuset))
|
||||
if (self.pinned_cpus & cpus) != cpus:
|
||||
raise exception.CPUUnpinningInvalid(requested=list(cpus),
|
||||
pinned=list(self.pinned_cpus))
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import testtools
|
||||
|
||||
from nova import exception
|
||||
from nova import objects
|
||||
from nova.tests.unit.objects import test_objects
|
||||
|
@ -89,12 +91,23 @@ class _TestNUMA(object):
|
|||
mempages=[])
|
||||
numacell.pin_cpus(set([2, 3]))
|
||||
self.assertEqual(set([4]), numacell.free_cpus)
|
||||
self.assertRaises(exception.CPUPinningUnknown,
|
||||
numacell.pin_cpus, set([1, 55]))
|
||||
|
||||
expect_msg = (
|
||||
exception.CPUPinningUnknown.msg_fmt % {'requested': "\[1, 55\]",
|
||||
'cpuset': "\[1, 2, 3, 4\]"})
|
||||
with testtools.ExpectedException(exception.CPUPinningUnknown,
|
||||
expect_msg):
|
||||
numacell.pin_cpus(set([1, 55]))
|
||||
|
||||
self.assertRaises(exception.CPUPinningInvalid,
|
||||
numacell.pin_cpus, set([1, 4]))
|
||||
self.assertRaises(exception.CPUUnpinningUnknown,
|
||||
numacell.unpin_cpus, set([1, 55]))
|
||||
|
||||
expect_msg = (exception.CPUUnpinningUnknown.msg_fmt %
|
||||
{'requested': "\[1, 55\]", 'cpuset': "\[1, 2, 3, 4\]"})
|
||||
with testtools.ExpectedException(exception.CPUUnpinningUnknown,
|
||||
expect_msg):
|
||||
numacell.unpin_cpus(set([1, 55]))
|
||||
|
||||
self.assertRaises(exception.CPUUnpinningInvalid,
|
||||
numacell.unpin_cpus, set([1, 4]))
|
||||
numacell.unpin_cpus(set([1, 2, 3]))
|
||||
|
|
Loading…
Reference in New Issue