From 13d90406572da0a22280c2c8872897b116097fb3 Mon Sep 17 00:00:00 2001 From: Paul Murray Date: Mon, 7 Dec 2015 14:46:11 +0000 Subject: [PATCH] Drop JSON decoding for supported_instances JSON encoding for supported_instances in the virt drivers was a temporary measure that is not needed. The encoding has been removed for all in tree virt drivers. This patch removes the code that checks for JSON encoding in the compute node object. blueprint mitaka-objects Change-Id: I2d0391f71436655f94f910c3b73920c6bbdd372b --- nova/objects/compute_node.py | 5 ----- nova/virt/fake.py | 4 +--- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/nova/objects/compute_node.py b/nova/objects/compute_node.py index bace3bd0d478..2ab2ec34b7b2 100644 --- a/nova/objects/compute_node.py +++ b/nova/objects/compute_node.py @@ -15,7 +15,6 @@ from oslo_config import cfg from oslo_serialization import jsonutils from oslo_utils import versionutils -import six from nova import db from nova import exception @@ -332,12 +331,8 @@ class ComputeNode(base.NovaPersistentObject, base.NovaObject, self[key] = resources[key] # supported_instances has a different name in compute_node - # TODO(pmurray): change virt drivers not to json encode - # values they add to the resources dict if 'supported_instances' in resources: si = resources['supported_instances'] - if isinstance(si, six.string_types): - si = jsonutils.loads(si) self.supported_hv_specs = [objects.HVSpec.from_list(s) for s in si] diff --git a/nova/virt/fake.py b/nova/virt/fake.py index cfd3e98cbf7f..d5456d6f3e53 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -149,9 +149,7 @@ class FakeDriver(driver.ComputeDriver): 'hypervisor_hostname': CONF.host, 'cpu_info': {}, 'disk_available_least': 0, - 'supported_instances': jsonutils.dumps([(arch.X86_64, - hv_type.FAKE, - vm_mode.HVM)]), + 'supported_instances': [(arch.X86_64, hv_type.FAKE, vm_mode.HVM)], 'numa_topology': None, } self._mounts = {}