From 13621a6d368f8034411b3bb7d10103a426528154 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 15 May 2018 09:56:05 +0100 Subject: [PATCH] Remove unnecessary 'to_primitive' call This was raising an 'oslo.serialization' warning: UserWarning: Cannot convert Aggregate(...) to primitive, will raise ValueError instead of warning in version 3.0 The called functions expect an Aggregate object instance so there's no reason for us to be doing this. Remove it and resolve the issue. Change-Id: I8fd598f02e5c50cb072284e1ce8be624bea5e18d --- nova/tests/unit/compute/test_compute.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/nova/tests/unit/compute/test_compute.py b/nova/tests/unit/compute/test_compute.py index b30a3622d294..a4a72ee9b239 100644 --- a/nova/tests/unit/compute/test_compute.py +++ b/nova/tests/unit/compute/test_compute.py @@ -12226,7 +12226,7 @@ class ComputeAggrTestCase(BaseTestCase): fake_driver_add_to_aggregate) self.compute.add_aggregate_host(self.context, host="host", - aggregate=jsonutils.to_primitive(self.aggr), slave_info=None) + aggregate=self.aggr, slave_info=None) self.assertTrue(fake_driver_add_to_aggregate.called) def test_remove_aggregate_host(self): @@ -12239,8 +12239,7 @@ class ComputeAggrTestCase(BaseTestCase): fake_driver_remove_from_aggregate) self.compute.remove_aggregate_host(self.context, - aggregate=jsonutils.to_primitive(self.aggr), host="host", - slave_info=None) + aggregate=self.aggr, host="host", slave_info=None) self.assertTrue(fake_driver_remove_from_aggregate.called) def test_add_aggregate_host_passes_slave_info_to_driver(self): @@ -12254,8 +12253,7 @@ class ComputeAggrTestCase(BaseTestCase): driver_add_to_aggregate) self.compute.add_aggregate_host(self.context, host="the_host", - slave_info="SLAVE_INFO", - aggregate=jsonutils.to_primitive(self.aggr)) + slave_info="SLAVE_INFO", aggregate=self.aggr) def test_remove_from_aggregate_passes_slave_info_to_driver(self): def driver_remove_from_aggregate(cls, context, aggregate, host, @@ -12269,8 +12267,7 @@ class ComputeAggrTestCase(BaseTestCase): driver_remove_from_aggregate) self.compute.remove_aggregate_host(self.context, - aggregate=jsonutils.to_primitive(self.aggr), host="the_host", - slave_info="SLAVE_INFO") + aggregate=self.aggr, host="the_host", slave_info="SLAVE_INFO") class DisabledInstanceTypesTestCase(BaseTestCase):