Add pci_stats attribute to ComputeNode Etcd model.

This will fix the gate problem [1].

Related-Bug: #1722698

[1] http://logs.openstack.org/86/509286/1/check/gate-zun-devstack-dsvm-docker-etcd-nv/be2f826/logs/screen-zun-compute.txt.gz#_Oct_09_21_20_00_225823

Change-Id: If2322c98f0bb2ea3de5c2f7e577125ea5064dd93
This commit is contained in:
Kien Nguyen 2017-10-11 11:32:19 +07:00
parent e2bdfa13f5
commit ddc8d59bc0

View File

@ -206,7 +206,12 @@ class ComputeNode(Base):
"""Represents a compute node. """
_path = '/compute_nodes'
_fields = objects.ComputeNode.fields.keys()
# NOTE(kiennt): Use list(fields) instead of fields.keys()
# because in Python 3, the dict.keys() method
# returns a dictionary view object, which acts
# as a set. To do the replacement, _fields should
# be a list.
_fields = list(objects.ComputeNode.fields)
def __init__(self, compute_node_data):
self.path = ComputeNode.path()
@ -230,6 +235,14 @@ class ComputeNode(Base):
@classmethod
def fields(cls):
# NOTE(kiennt): The pci_device_pools field in object maps to the
# pci_stats field in the database. Therefore, need
# replace these fields.
for index, value in enumerate(cls._fields):
if value == 'pci_device_pools':
cls._fields.pop(index)
cls._fields.insert(index, 'pci_stats')
break
return cls._fields
def save(self, session=None):